Part I — The Pipes · Lesson 1.8
Choosing: REST vs GraphQL vs gRPC
In one linePick by who the clients are and how nested the data is — not by what's newest.
Where you've seen itShopify ships all three — REST for public third-party apps, GraphQL for its own admin UI, gRPC between internal services.
Diagram
How it works
- Start from the client. Unknown third parties → REST. Your own app → REST or GraphQL. Another service → gRPC.
- Then check data shape. Nested, screen-specific trees favour GraphQL; flat entities favour REST.
- Then check caching needs. If CDN caching is the main lever, REST wins outright.
- Then check volume. Internal, high-throughput, latency-sensitive → gRPC.
- Combine freely — a BFF that speaks GraphQL outward and gRPC inward is a normal, defensible answer.
Trade-offs
| Don't choose GraphQL if | Don't choose REST if | Don't choose gRPC if |
|---|---|---|
| CDN caching is your main win | Screens need 5+ nested resources | The browser must call it directly |
| Team can't own query governance | Payloads are 10× what the UI uses | You need curl-level debuggability |
Interview angle
"Design the API layer for a mobile-heavy social app."
- Mobile bandwidth + per-screen nesting → GraphQL at the edge, one query per screen.
- Keep images and static content on plain REST/CDN URLs so they stay cacheable.
- Internal fan-out (feed, ranking, notifications) over gRPC behind a BFF.
Recap
- Client type first, data shape second, caching third, volume fourth.
- These are layers, not rivals — most real systems run all three.
- Naming the trade-off you accepted matters more than the choice itself.