Skip to main content
Learn how to create Frames and their structure.

Basic Structure

Creating Frame File

Generated endpoint:
  • GET /api/health/check
Frame URL path is determined by the frameName property. It’s converted to lowercase and becomes /api/{frameName}/{methodName}.

Required Elements

1. Extend BaseFrameClass

2. Define frameName

3. @api Decorator

4. Export Instance

Practical Examples

Health Check Frame

Utility Frame

External API Proxy Frame

DB Access

Frame can also access DB. Frame classes provide getPuri just like Models, so obtain the Puri query builder with this.getPuri().
The handle returned by getPuri is not bound to a specific table, so even a Frame that is not tied to an Entity can query every registered table. The examples below assume import { Puri } from "sonamu";.

Read Operations

Write Operations (@transactional)

Error Handling

try-catch Pattern

Validation Logic

File Structure

Separate Types File (Optional)

Cautions

Cautions when using Frame: 1. frameName property is required 2. Methods must be async functions 3. Instance must be exported 4. Consider Model for complex logic 5. Convert to Model if Entity is needed

Common Mistakes

Next Steps

Use Cases

Practical Frame examples

What are Frames?

Understanding Frame concept

@api Decorator

API basic usage

Error Handling

API error handling