What problem does it solve?
Creating new API domains in a tRPC-based Next.js app often requires repetitive boilerplate: creating router files, defining procedures with input validation, co-locating database queries, and registering the router in the central appRouter. This Skill standardizes that workflow so new feature APIs are created consistently, validated, and discoverable by the application.
Core Features & Use Cases
- Router file template: Provides a consistent pattern for list, byId, and create procedures and encourages input validation with Zod.
- App registration guidance: Shows how to export the router and register it in server/api/root.ts so the appRouter exposes the new domain.
- Auth and DB conventions: Recommends using publicProcedure for unauthenticated routes, adding Supabase auth checks for protected endpoints, and keeping queries co-located or extracting them to server/db/queries when large.
- Use Case: Add a comments feature with endpoints to list comments, fetch a comment by UUID, and create new comments with server-side validation and auth.
Quick Start
Create a new router file named comments at server/api/routers/comments.ts with zod-validated procedures, export commentsRouter, and import and register it in server/api/root.ts so the appRouter exposes the comments domain.