Stack · API layer
Next.js + tRPC.
Next.js + tRPC removes the boilerplate of a separate API. End-to-end type safety from server to client.
CategoryAPI layer
Best forType-safe full-stack
Why together · 01
Why this combo works.
Procedures defined in TS, called from React with full inference. No OpenAPI specs, no manual types. Zod-validated inputs.
Setup
Set up the appRouter in /server, expose via /api/trpc, use createTRPCNext on the client.
Gotchas
- Doesn't replace REST when you need to expose APIs to non-TS consumers
- Bundle size is bigger than fetch + types
- Server components consume tRPC slightly differently than client
- Mutations need careful invalidation
Building this stack?
We've shipped it.
Used on internal-tools and dashboard projects. If you're going to ship on this stack, brief us. We can save you a few weeks of gotchas.
Brief us