Scaffold a new tRPC router with proper types, imports, and registration in the app router
Ask the user for the router name if not provided as an argument.
Read the pattern: Read src/main/lib/trpc/routers/projects.ts as a template for a simple CRUD router.
Create the router file: Create src/main/lib/trpc/routers/{name}.ts following the pattern:
publicProcedure and router from ../indexz from zod for input validation{name}Router const using the router() functionRegister in index: Edit src/main/lib/trpc/routers/index.ts:
import { {name}Router } from "./{name}"router({}) call inside : createAppRouter{name}: {name}Router,Confirm: Run bun run ts:check to verify the new router compiles.
// In src/main/lib/trpc/routers/index.ts
import { {name}Router } from "./{name}";
// Inside createAppRouter():
return router({
// ... existing routers
{name}: {name}Router,
});
The AppRouter type is automatically inferred from the return type of createAppRouter, so the client gets type safety with no extra work.