Skip to main content
Frame is used to create independent API endpoints that are not connected to database Entities.

Frame Overview

No Entity Required

Works without DB tables Free API implementation

Simple Structure

Extend BaseFrameClass Use @api decorator

Various Uses

Health check, utilities External API proxy

Independent Logic

Implement business logic only No Entity constraints

Model vs Frame

Model (BaseModelClass)

Model Characteristics:
  • 1:1 mapping with Entity (DB table)
  • CRUD operation focused
  • Uses UpsertBuilder, Subset
  • Type safety guaranteed

Frame (BaseFrameClass)

Frame Characteristics:
  • Independent logic unrelated to Entity
  • Utilities, health checks, proxies, etc.
  • Flexible API structure
  • Simple implementation

Comparison Table

When to Use Frame

✅ Use Frame When

  1. Health Check API
  2. Utility API
  3. External API Proxy
  4. Aggregated Statistics
  5. Auth/Permission Check

❌ Use Model When

  1. Entity CRUD Operations
  2. Related Data Processing
  3. Complex Business Logic

Structural Differences

Model Structure

Frame Structure

Frame only requires the .frame.ts file without Entity definition.

Simple Examples

Health Check Frame

Utility Frame

Pros and Cons

Pros

Fast Implementation

No Entity definition needed Simple structure

Flexibility

Unrestricted logic Free API design

Independence

Independent of DB schema Easy external API integration

Easy Testing

Simple logic No mock needed

Cons

Reduced Type Safety

Entity types not used Manual type management

No Auto Generation

No Subset, Types auto-generation Manual writing required

Practical Tips

1. Keep Frame Simple

2. Proper Naming

When to Convert to Model?

Consider converting from Frame to Model when:
  1. Frequently querying/modifying DB data
    • Started as simple queries but now needs CRUD
  2. Type safety becomes important
    • Complex data structures emerge
    • Need Entity type auto-generation
  3. Need to process related data
    • Processing relationships between multiple tables
    • JOIN, foreign keys, etc.
  4. Business logic becomes complex
    • Beyond simple utilities
    • Transaction processing needed

Next Steps

Creating Frames

BaseFrameClass usage

Use Cases

Health check, utility examples

@api Decorator

API basic usage

Model

Entity-based API