Skip to content

tRPC

A TypeScript library for building APIs whose types are shared between server and client, with no code generati

Stars
40.8k
Forks
1.7k
Licence
MIT
Language
TypeScript
Last update
4 days ago
Type
Library

What it is

tRPC lets you build and call APIs in TypeScript where the client gets full type checking and autocompletion from the server's code, without writing separate schemas or generating code. The README says the client imports only type declarations from the server, not the server code itself. It includes adapters for React, Next.js, Express and Fastify, and says it is not tied to React.

  • Build a full-stack Next.js app with typed API procedures, using the official starter example
  • Add typed endpoints to an Express or Fastify server and call them from a React frontend
  • Use request batching so simultaneous requests are combined into one
  • Add subscriptions for live data, as listed in the features

Great for

  • TypeScript teams building a web app where the frontend and backend are both written in TypeScript
  • Developers adding typed APIs to an existing project (the README calls it easy to add to brownfield projects)
  • Next.js or React developers who want typed calls between client and server
  • Projects that want to avoid maintaining schemas or a code generation step

Not ideal for

  • Teams whose clients are not TypeScript, since the main benefit is shared TypeScript types (the README does not describe other-language clients)
  • Projects that need a language-neutral public API for third parties, where a standard like OpenAPI is usually expected (the README does not discuss this)
Step-by-step guide: how to use tRPCInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Node.js · A package manager such as npm, yarn, pnpm or bun

    Create a full-stack Next.js starter (npm)

    npx create-next-app --example https://github.com/trpc/trpc --example-path examples/next-prisma-starter trpc-prisma-starter
  2. 2

    Run it

    • Pick an example from the examples folder or the trpc.io example apps list
    • Run the create-next-app command for the Next.js and Prisma starter
    • Open the generated project and follow the trpc.io documentation to run it
  3. 3

    Get the most out of it

    • Install the tRPC skills for AI coding agents with the command in the README (npx @tanstack/intent@latest install) for better code generation
    • Read the examples folder to see working setups
    • Browse the community adapters list on trpc.io for non-React or non-Express frameworks
    • Use the documentation on tRPC.io for full setup details

Downloads

Strengths

  • No code generation or build pipeline, according to the README
  • The README states zero dependencies and a small client-side footprint
  • Full static type safety for inputs, outputs and errors on the client

Trade-offs

  • The README is focused on TypeScript; it does not describe use outside that ecosystem
  • Relies on TypeScript type inference across the client and server, so both sides need to be in the same TypeScript project setup
  • Documentation is hosted on an external site (trpc.io), and this README excerpt is truncated

How it compares

ProjectStarsTypeLevelUpdatedBest for
trpc (this)40.8kLibraryintermediate4 days agoTypeScript teams building a web app where the frontend and backend are both written in TypeScript
graphql17.6kFrameworkintermediate4 days agoDevelopers building data-driven React apps who want a pre-assembled stack
blitz14.1kFrameworkintermediate12 months agoDevelopers already comfortable with React and Next.js who want more built-in full-stack structure
fumadocs13.5kLibraryintermediate4 days agoReact developers who want to build a documentation site
cal.diy49.6kAppadvanced4 days agoIndividuals who want to self-host their own booking page
create-t3-app29.2kCLIintermediate11 months agoDevelopers who already know some TypeScript and want a Next.js starting point

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.