Backend and APIs · Comparison

REST vs GraphQL vs tRPC vs gRPC

Four ways for apps and services to ask a backend for data. They differ in who can call them, how strictly the contract is typed, and what travels over the wire.

4 options · 7 questions side by side · updated

CompareRESTGraphQLtRPCgRPC
ShapeA URL for each resourceOne endpoint; queries name the fieldsTypeScript functions called over HTTPFunctions defined in .proto files
Data formatUsually JSONJSONJSONProtocol Buffers (binary)
ContractOptional (OpenAPI)Typed schema, requiredInferred from TypeScript code.proto files, required
ClientsAnything that speaks HTTPAny language, with client librariesTypeScript onlyMany languages; browsers need a proxy
CachingStandard HTTP and CDN cachingNeeds client-side cachingClient-side, often TanStack QueryNot cached by HTTP tools
Best forPublic APIs and most appsMany clients needing different dataFull-stack TypeScript appsTraffic between services
Watch out forOver- or under-fetching dataComplexity and expensive nested queriesTies both ends to TypeScriptHarder debugging and browser support

How to choose between REST, GraphQL, tRPC and gRPC

  • Pick REST for public APIs and whenever many kinds of client will call the backend.
  • Pick GraphQL when several apps need different views of deeply linked data.
  • Pick tRPC when one team writes both ends in TypeScript and wants types to flow automatically.
  • Pick gRPC for efficient, strictly typed calls between internal services.

The options

More comparisons

Crafted in the dark. Shipped to the world.

Tell us what you are building. You get a private project space with a proposal and a line-by-line quote within a day.