LOAD-BEARINGfree
FoundationsTier 1 · unit 3 of 6 · 12 min read

REST, gRPC, GraphQL: pick by shape

These three constantly get framed as a ranking — which is "best"? Wrong question. They're three different tools for three different shapes of problem, like asking whether a hammer beats a screwdriver. The skill is recognising the shape in front of you.

REST: resources over plain HTTP

REST models everything as resources (users, posts, orders) manipulated with standard HTTP verbs: GET /users/42 fetches, POST /orders creates, DELETE /posts/7 removes. Data travels as human-readable JSON.

Its superpowers: universality (every language, tool, and firewall on Earth speaks HTTP), debuggability (test any endpoint with curl or a browser — see the problem with your own eyes), and above all cacheability: because a GET to a given URL is a stable, well-understood operation, the web's entire enormous caching machinery — browser caches, CDNs, proxies — works automatically. That's decades of free infrastructure.

Its weaknesses: over-fetching (the endpoint returns 40 fields, you needed 3) and under-fetching (one screen needs a user, their posts, and their followers — that's three round trips). Mobile apps suffer most: eight sequential calls to paint one screen, each paying the Tier 1 latency tax.

Reach for it when: third parties will consume your API, or responses benefit from HTTP/CDN caching. Default choice for public APIs.

gRPC: compact and fast, for machines talking to machines

gRPC sends Protobuf — a binary format — over HTTP/2. You define your API in a schema file first; code generators then produce typed client and server code in any language, so a typo becomes a compile error instead of a 3am production bug. Payloads run 30–50% smaller than JSON and parse much faster, and it supports streaming in both directions natively — a long-lived pipe where both sides can send whenever they like.

Its weaknesses: browsers can't speak it directly (you need a translating proxy), and you can't debug it by eye — the bytes are meaningless without the schema.

Reach for it when: your own services talk to each other, especially high-volume internal calls where the efficiency compounds, or anything needing bidirectional streaming.

GraphQL: the client writes the shopping list

GraphQL flips the power dynamic. One endpoint; the client sends a query describing exactly the shape it wants — "this user's name, their last 10 posts, each post's like count" — and gets exactly that, in one round trip. Over-fetching: dead. The eight mobile calls: collapsed into one. Product teams ship new screens without waiting for the backend to build new endpoints.

The bills arrive later, and they're real:

  • HTTP caching essentially stops working. Every query is a POST to /graphql with a unique body — the CDN sees an opaque blob it can't cache. You rebuild caching by hand, at the resolver layer.
  • Query cost becomes your problem. A client (or attacker) can request a deeply nested graph — users → posts → commenters → their posts → ... — and one query flattens your database. You must add query-depth and cost limits.
  • The N+1 problem moves into your resolvers. Naively, "10 posts, each with its author" runs 1 query for posts + 10 for authors. Batching tools (DataLoader pattern) fix it, but they're mandatory homework, not optional polish.

Reach for it when: many diverse clients (iOS, Android, web, watch) with different data needs, and screens changing faster than backend endpoints can ship.

Decision heuristic
Third parties will consume itREST
Internal, high QPS, low latencygRPC
Many clients, varied field needsGraphQL
Streaming both directionsgRPC
Must be CDN-cacheableREST
The trap

Adopting GraphQL to fix a "too many endpoints" annoyance, then discovering you've traded it for a caching problem, a per-field authorisation problem, and a query-cost problem. GraphQL is a real solution to a real problem — many diverse clients with divergent needs. Make sure you actually have that problem before paying its rent.