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)
- 1:1 mapping with Entity (DB table)
- CRUD operation focused
- Uses UpsertBuilder, Subset
- Type safety guaranteed
Frame (BaseFrameClass)
- Independent logic unrelated to Entity
- Utilities, health checks, proxies, etc.
- Flexible API structure
- Simple implementation
Comparison Table
When to Use Frame
✅ Use Frame When
-
Health Check API
-
Utility API
-
External API Proxy
-
Aggregated Statistics
-
Auth/Permission Check
❌ Use Model When
-
Entity CRUD Operations
-
Related Data Processing
-
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
3. Group Related Features
When to Convert to Model?
Consider converting from Frame to Model when:-
Frequently querying/modifying DB data
- Started as simple queries but now needs CRUD
-
Type safety becomes important
- Complex data structures emerge
- Need Entity type auto-generation
-
Need to process related data
- Processing relationships between multiple tables
- JOIN, foreign keys, etc.
-
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