tRPC vs REST Comparison

End-to-end type-safe APIs for TypeScript

VS
REST

Language-agnostic industry standard since 2000

9 min readBackend

Quick Verdict

For a TypeScript full-stack monorepo, tRPC is the gold standard for type safety. For public APIs or polyglot clients, choose REST. GraphQL sits in between — type-safe and language-agnostic, but with higher complexity. A hybrid approach works well too: tRPC internally, with a public REST facade on top.

tRPCREST
Read the full verdict

Score Comparison

Loading chart...

Detailed Scoring

Detailed Scoring: tRPC and REST — category-by-category scores out of 10
CategorytRPCREST
Performance
9/10
9/10
Ease of Learning
8/10
10/10
Ecosystem
8/10
10/10
Community
9/10
10/10
Job Market
7/10
10/10
Future-Proof
8/10
8/10

Pros & Cons

tRPC

Pros

  • End-to-end type safety from server to client — no code generation needed
  • Inline Zod validation
  • Native React Query integration
  • Subscription support over WebSocket
  • Middleware and context system
  • No OpenAPI or GraphQL schema to maintain
  • The backbone of Theo's T3 Stack
  • Used by Vercel, Cal.com, and Cloudflare

Cons

  • TypeScript-only — difficult for polyglot teams
  • Native mobile clients aren't TypeScript-compatible, so REST or GraphQL is still needed there
  • Poor choice for public APIs since there's no open spec
  • Build times can grow in large monorepos

Best For

TypeScript full-stack apps (Next.js, Remix)Internal APIs where the server and web client are owned by the same teamProjects where type safety is criticalRapid iteration — schema changes propagate to the client instantlyEngineering projects in the style of the T3 Stack

REST

Pros

  • Language-agnostic — works with any client
  • 25+ years as the industry standard
  • Mature OpenAPI/Swagger ecosystem
  • Native HTTP caching (Cloudflare, Varnish)
  • The default standard for public APIs
  • Works directly with native mobile clients
  • Universal tooling (Postman, curl)
  • Strong long-term backward compatibility

Cons

  • Type safety is manual — requires OpenAPI code generation
  • Boilerplate-heavy — routes, validators, and types are managed separately
  • Prone to over-fetching or under-fetching (the reason GraphQL exists)
  • Versioning gets complicated (v1, v2, deprecation cycles)

Best For

Public APIsPolyglot teams (iOS, Android, web, third-party integrators)Long-term, stable APIsHigh-cache scenarios (Cloudflare edge)Industry-standard compliance

Code Comparison

tRPC
// server/router.ts
export const appRouter = t.router({
    getUser: t.procedure
        .input(z.object({ id: z.string() }))
        .query(async ({ input }) => {
            return await db.user.findUnique({ where: { id: input.id } });
        }),
});

// client (type-safe, autocomplete!)
const user = await trpc.getUser.query({ id: "123" });
// user.name, user.email — fully typed
REST
// OpenAPI-first
GET /api/users/:id
Response: { "id": "123", "name": "John", "email": "..." }

// Client (manual type def or codegen)
const res = await fetch("/api/users/123");
const user: User = await res.json();  // Manual type assertion

Conclusion

For a TypeScript full-stack monorepo, tRPC is the gold standard for type safety. For public APIs or polyglot clients, choose REST. GraphQL sits in between — type-safe and language-agnostic, but with higher complexity. A hybrid approach works well too: tRPC internally, with a public REST facade on top.

Get Free Consultation
FAQ

Frequently Asked Questions

GraphQL is a separate design paradigm — a query language in its own right. This comparison is about tRPC's TypeScript-only approach versus REST's universal one. GraphQL can still be part of a hybrid strategy.

Related Blog Posts

View All Posts
All Comparisons