The Problem tRPC Solves
Understand the type drift between frontend and backend API contracts and how tRPC eliminates it without codegen.
The Type Drift Problem
When you build a REST API in TypeScript, the server defines the response shape. The client must manually create matching TypeScript types. These types drift over time as the API evolves, and the compiler cannot catch the mismatch because the types are defined in separate packages.
A renamed field on the server becomes a silent runtime bug on the client.
GraphQL Codegen as One Solution
GraphQL solves type drift by generating TypeScript types from the schema using tools like graphql-codegen. This works well but adds complexity: a separate query language (GraphQL SDL), a code generation step in the build pipeline, and schema management tooling.
For teams already invested in GraphQL, codegen is the right answer. For teams that want type safety without the GraphQL overhead, tRPC offers an alternative.