tRPC Course: Type-Safe APIs with TypeScript and React
Learn to build end-to-end type-safe APIs with tRPC 11, TypeScript and Zod, where the server code is the contract and the client gets full types without code generation. You start with what tRPC is and when it fits compared with REST, GraphQL and gRPC, then build a router, validate input and output, add context and middleware for authentication, and handle errors safely, including masking internal messages. The middle of the course runs tRPC on Fastify and Express, covers links, batching, streaming and superjson, and connects a React app through the TanStack Query integration with cache invalidation, optimistic updates and infinite lists. The last lessons add real-time subscriptions over Server-Sent Events and cover production concerns: deploy skew, safe API evolution, CSRF, OpenAPI for outside callers and a capstone checklist. Every example was run against tRPC 11.23.