Service framework overview
Understand business modules, routes, platform capabilities, and background jobs.
Service owns business rules and writes. Routes select an operation, controllers handle input and responses, and use cases perform the work. Platform selects drivers for databases, caches, and queues. Start in the feature that owns the operation, then open the relevant API, data, or background-work chapter.
What Service owns
Service applies business rules when an administrator saves settings, a visitor submits an inquiry, or a background task generates a translation. Admin initiates HTTP operations and the theme consumes public data. Service organizes operations as routes for HTTP and in-process callers.
| Typical change | Where to start |
|---|---|
| Validate a save or check access | The owning context’s route, validator, and use case |
| Change a public API response | Route declaration, handler, and response contract |
| Select database or storage behavior | Platform capabilities and the selected runtime |
| Retry translation or schedule processing | Background job and consumer in the owning business context |
Business modules and shared capabilities
The contexts under packages/service/features include CMS, surveys, comments, analytics, and accounts. To reuse a cross-context use case, start with its owning context’s root service.ts. Use Platform capabilities for database, cache, email, and queue access. The resulting boundary helps you distinguish a business failure from a runtime configuration issue.
Follow one operation further
Start with routes and the request lifecycle to see how public HTTP and in-process calls resolve a handler. For persistence and asynchronous work, see runtime and background jobs. For checking an operation from a client, see the API reference.
Find the chapter for your next change
- For an endpoint, start with controllers and validation and authentication and authorization.
- For infrastructure dependencies, read dependency injection and context, then database, ORM, and migrations.
- To run a specific action, see queues and jobs. When multiple features respond to a fact, see events and subscribers. For clock-driven work, see scheduled tasks.
Run one complete request first in your first Service endpoint.