tRPC overview (in our stack)
tRPC is our internal API layer between the browser UI and server-side logic. It provides:
- end-to-end typing (client ↔ server)
- a single place to enforce validation (Zod) + auth (middleware)
- a clean boundary for calling internal microservices (server-side)
Mental model
Key concepts to learn (with docs)
- What is tRPC: https://trpc.io/docs
- Routers / procedures: https://trpc.io/docs/server/routers
- Input validation (Zod): https://trpc.io/docs/server/validators
- Middleware: https://trpc.io/docs/server/middlewares
- Error handling: https://trpc.io/docs/server/error-handling
Standard approach (what we’ll converge on)
- Every procedure has:
- input schema (Zod)
- clear auth requirements (public vs protected)
- consistent error mapping (developer logs vs user message)
- Microservice calls happen inside procedures (or server-only helper modules called by procedures).
Exercises
content/exercises/04-trpc/01-protected-procedure.mdx
Last updated on