tRPC

tRPC

End-to-end type-safe TypeScript API toolkit that shares server procedure types directly with frontend clients with zero codegen.

★ 41.0K

Share end-to-end TypeScript API types between backend and frontend without code generation

Keeping REST OpenAPI specs or GraphQL schemas synced between a Node.js backend and a React frontend usually requires running codegen watchers every time you rename a database column. If someone forgets to regenerate the client types, the bug only surfaces at runtime. tRPC imports your backend router’s TypeScript type declarations directly into your frontend code with zero build-step code generation. It holds 41.0K GitHub stars and 1,800 forks under the MIT license.

Why full-stack TypeScript teams choose tRPC

  • Instant IDE autocompletion and compile-time type errors fire across your frontend the second you change a backend procedure’s input or return value.
  • Zero runtime bloat and zero build pipelines keep the client bundle tiny because only TypeScript `import type` declarations cross the boundary.
  • First-class Zod, Valibot, and ArkType validation middleware secures runtime procedure inputs while inferring static return types automatically.
  • Built-in TanStack Query integration gives React and Next.js apps automatic request batching, caching, optimistic updates, and SSR hydration.

When tRPC is not a fit

Because tRPC relies on TypeScript’s compiler inference, both your server and client must live in a shared TypeScript monorepo or publish internal `.d.ts` packages (though OpenAPI plugins exist for external consumers). Add tRPC to your Next.js, Hono, or Express monorepo today to catch API contract mismatches before you even save the file.

Ready to try tRPC?

Experience the full capabilities on their official website.

Visit Official Website