Skip to main content

Cookbook

Use this page when you want complete, practical recipes instead of reading the API page by page.

Recipe 1: SQL User CRUD API

Use this when you want a standard REST API on SQL with generated model, service, and controller layers.
Model:
Service:
Routes:

Recipe 2: Blog API with Relations

Use this when you want a realistic relational example quickly.
Typical relation definitions:
Service query example:

Recipe 3: Mongo Document API

Use this when the app is document-first.
Keep the service and controller surface the same as SQL. Let the model base decide driver behavior.

Recipe 4: Soft Delete Admin Restore Flow

Use this when records should be recoverable from an admin screen. For PostgreSQL-focused apps, keep the soft-delete column explicit and timezone-aware.
Schema:
Service:
Routes:

Recipe 5: Cache-First Dashboard Service

Use this when read endpoints are expensive and you need deterministic invalidation.

Recipe 6: Test-Only Application Surface

Use this when app and test artifacts must be isolated.
Generated paths:
  • src/test/database/models
  • src/test/services
  • src/test/controllers

Recipe 7: Mixin-Driven Service Layer

Use this when runtime behavior should go beyond plain CRUD. Practical mixin scenarios:
  • soft delete and restore
  • eager loading
  • serialization
  • casts
  • scopes
  • lifecycle hooks
  • pivot attach, detach, and sync
  • service-boundary caching
See Mixin Scenarios.

Next detailed guides