Overview
tRPC is a framework for building fully typesafe APIs in TypeScript without requiring schemas or code generation. It leverages TypeScript's type inference to automatically provide end-to-end type safety between client and server, catching API contract mismatches at build time rather than runtime.
The framework combines concepts from REST and GraphQL, offering a lightweight alternative to traditional API layers. With zero runtime dependencies and a tiny client-side footprint, tRPC enables rapid full-stack development with automatic autocompletion and type checking across the client-server boundary. It works standalone or can be mounted as an endpoint on existing REST APIs through its extensive ecosystem of adapters for popular frameworks like Next.js, Express, Fastify, and many others.
Key features
- End-to-end type safety without code generation
- Automatic client autocompletion and intellisense
- Zero runtime dependencies
- Framework agnostic with adapters for Next.js, Express, Fastify, and more
- Support for queries, mutations, and subscriptions
- Request batching
- Input validation with Zod, Yup, or Valibot
- Real-time subscriptions support
- No build or compile steps required
- Tiny bundle size and lightweight
- Snappy developer experience with instant feedback
- Works with existing projects and brownfield codebases
- Extensive adapter ecosystem for popular frameworks
- Type inference catches errors before runtime
- Requires TypeScript (>=5.7.2) and strict mode recommended
- Tightly couples client and server code in monorepo structure
- Not suitable for public APIs without OpenAPI adapters
- Learning curve for developers unfamiliar with TypeScript inference patterns
Best for
Alternatives
More Framework
Compare allReact framework for production with SSR, static generation, API routes, and App Router.
Framework for building autonomous AI agents, designed by Vercel as a filesystem-first approach to agent development.
Modern C# framework designed for building reactive full-stack web applications entirely in pure C#.