Skip to content
Devgo

tRPC

End-to-end typesafe APIs for TypeScript — no schemas, no codegen. Define procedures on the backend; the client calls them with full type safety. The fastest way to build a TS full-stack app. No REST/GraphQL needed — just functions.

Created by

Alex Johansson (KATT) · Created tRPC in 2021

When to use
  • TypeScript full-stack apps.
  • Internal APIs between frontend and backend.
  • When you want type safety without schemas.
When not to
  • Public APIs (use REST/GraphQL).
  • Polyglot stacks (not TS-only).
  • When you need a separate API contract.

Definition

tRPC lets you define backend procedures (queries, mutations) and call them from the frontend with full type safety. The client imports the router type and calls procedures like functions — infers types automatically. Works with , , Fastify.

Why it exists

/ require schemas and codegen. tRPC removes that — the compiler IS the API contract. If it compiles, the types are correct. No schema drift.

How it works

Define a router with procedures (publicProcedure.query()/.mutation()). Export the AppRouter type. Client creates a caller with that type. Calls are type-safe requests under the hood. Supports subscriptions (WebSocket).

Scaling limits

-only (not for polyglot APIs). No public API (internal APIs only). Couples frontend and backend. Less ecosystem than REST/.

Cost shape

Free and open source.

Alternatives

  • REST — Language-agnostic, more boilerplate, no type safety.
  • GraphQL — Flexible queries, schema overhead, codegen.

Failure modes

  • TS-only limitation.
  • No public API.
  • Frontend/backend coupling.
  • Schema-less can hide breaking changes.

, ,