624 B
624 B
@repo/api — tRPC Router Definitions
tRPC routers that call controllers from @repo/core. Each procedure validates input and delegates to a controller.
Rules
- NEVER put business logic in routers — delegate to controllers
- Input validation uses Zod schemas
- Each domain gets its own router file
Adding a New tRPC Router
- Create
src/router/{domain}.router.ts - Import
routerandpublicProcedurefrom../trpc.js - Define procedures (
.query()for reads,.mutation()for writes) - Each procedure calls a controller from
@repo/core - Add router to root
appRouterinsrc/router/index.ts