Devii · APIs & integration · 2026-05-13 · 7 min read
tRPC: End-To-End Type Safety Between TypeScript Client And Server
Procedures, routers, and serialization without OpenAPI codegen for TS monorepos.
**tRPC** (`trpc.io`) exposes typed **procedures** (queries and mutations) from a server router consumed by TypeScript clients with compile-time inference. It targets monorepos where client and server share types.
Transports typically use HTTP with JSON or **superjson** for Dates and Maps. React Query integration (`@trpc/react-query`) handles caching and invalidation patterns.
tRPC is not a public HTTP API standard for third-party consumers; external partners still need REST, GraphQL, or gRPC with published schemas. Use tRPC internally, expose OpenAPI at the edge if required.
Validate inputs with Zod via `@trpc/server` adapters. Version routers when breaking procedure shapes, or namespace by version prefix.