tRPC

End-to-end typesafe APIs made easy
Watch Video
#
tRPC allows you to easily build & consume fully typesafe APIs, without schemas or code generation. IntroductionAs TypeScript and static typing increasingly becomes a best practice in web programming, the API presents a major pain point. We need better ways to statically type our API endpoints and share those types between our client and server (or server-to-server).
#
An alternative to traditional REST or GraphQLCurrently GraphQL is the dominant way to implement typesafe APIs in TypeScript (and it's amazing!). Since GraphQL is designed as a language-agnostic specification for implementing APIs, it doesn't take full advantage of the power of a language like TypeScript - further reading.
If your project is built with full-stack TypeScript, you can share types directly between your client and server, without relying on code generation.
#
Introducing tRPCWe set out to build a simple library for building typesafe APIs that leverages the full power of modern TypeScript. Introducing tRPC! Featuring:
- ๐งโโ๏ธย Full static typesafety & autocompletion on the client - on inputs, outputs, & errors.
- ๐ย Snappy DX. No code generation, run-time bloat, or build pipeline.
- ๐ย Light. tRPC has zero deps and a tiny client-side footprint.
- ๐ปย Easy to add to your existing brownfield project.
- ๐ย Batteries included. React-library + Next.js/Express adapters/Nuxt. (But tRPC is not tied to React - reach out if you want to make a Svelte/... lib)
- ๐ฅย Simple to use APIs for queries, mutations, & subscriptions support.
- โก๏ธย Request batching - requests made at the same time can be automatically combined into one
... and
- ๐ย Quite a few Example Apps that you can use for reference or as a starting point.
- โ ย Well-tested & running in production.