Backend Boilerplates
typescript
Advanced
tRPC Router with Zod Input
Type-safe tRPC router procedure with Zod validation and context-based auth check.
typescript
import { z } from "zod";
import { router, publicProcedure, protectedProcedure } from "./trpc";
export const moduleRouter = router({
list: publicProcedure
.input(z.object({ category: z.string().optional(), page: z.number().default(1) }))
.query(async ({ input, ctx }) => {
return ctx.db.module.findMany({
where: { category: input.category, isPublished: true },
skip: (input.page - 1) * 20,
take: 20,
});
}),
});
Prerequisites
- trpc >= 10
- zod
- prisma
Pro Tips
- → Combine with React Query for automatic cache invalidation.
Commercial Licensing
Acquire a production access token or template license for enterprise deployment.
Module Info
- Language
- typescript
- Level
- Advanced
- Read time
- 5 min
- Published
- Aug 2025
- License
- Commercial License
Newsletter
New modules every week, directly to your inbox.
Similar Modules
Laravel Artisan Seeder Command
Artisan command to re-seed production data with a confirmation prompt.
php
·
Intermediate
CSV to PostgreSQL Bulk Loader
Stream a large CSV directly into PostgreSQL using COPY for maximum throughput.
python
·
Intermediate
Go Event Sourcing Store
Minimal append-only event store in Go backed by a Postgres table.
go
·
Advanced