Adding a Module
Walks through adding a new feature module end-to-end: backend schema → zod + DTO → service → controller → register → route auth policy → regenerate spec → consume from frontend. The example is a fictional Tasks module with a small CRUD surface (list, create, update, delete), scoped to a workspace the way every user resource in the template is: its routes live under /workspaces/:workspaceId/tasks, and any member of that workspace sees the same tasks. Teams and Workspaces explains the model.
The Items module already in the template (backend/src/items/) follows this exact pattern; read it side-by-side if you get stuck.
Pages
- Define the persistence layer
- Define schemas + DTOs
- Write the service
- Write the controller
- Wire the module
- Add the route auth policy
- Regenerate the OpenAPI spec
- Regenerate frontend types
- Consume from the frontend
Related
- Architecture - Module structure overview, REST surface, DTO extractor pattern
- Auth Flow - Guard reference, RSC + Server Action patterns
- Teams and Workspaces - Roles, the workspace guard, invites
- Home - Docs index