Admin and customer boundaries
Many parts of the application are scoped to either the admin portal or the customer portal. This separation appears in routes, API clients, repositories, authorization, and UI components.- Admin-scoped code may operate across the platform and across organizations.
- Customer-scoped code operates within the authenticated organization.
Request lifecycle
A typical API request moves through the same layers: The route handler coordinates the request. It validates the input, performs any authorization and business-rule checks, calls a repository, serializes the result, and returns one of the application’s standard API response formats.Architectural patterns
API architecture
Use one consistent interface for reads and mutations while keeping future
consumers open.
Repositories
Keep Prisma access behind entity repositories and preserve portal trust
boundaries.
Validation
Validate every backend input and share Zod schemas where the same rules
apply to frontend forms.
Serialization
Make every frontend data shape explicit at API and Server Component
boundaries.
Coding agents
Use the included agent instructions and authentication skills to build in
line with the existing architecture.