REST vs gRPC vs GraphQL
All three let one system ask another for data or ask it to do something. They differ in who decides the shape of the data, how strictly the contract is typed, and what the network has to carry.
- REST: resources identified by URLs, manipulated with standard HTTP methods (
GET,POST,PUT,DELETE), usually with JSON. The server decides the shape of each response. - gRPC (opens in a new tab): remote procedure calls defined in a Protocol Buffers (opens in a new tab) schema, sent over HTTP/2 in a compact binary format, with generated client and server code.
- GraphQL (opens in a new tab): a single endpoint and a typed schema; the client sends a query describing exactly the fields it wants, and the server returns that shape.
At a glance
Section titled “At a glance”| Aspect | REST | gRPC | GraphQL |
|---|---|---|---|
| Contract | Optional (OpenAPI (opens in a new tab)) | Required (.proto schema) |
Required (GraphQL schema) |
| Who shapes the response | Server | Server | Client |
| Payload | Usually JSON text | Binary Protocol Buffers | JSON |
| Transport | Any HTTP version | HTTP/2 | Usually HTTP |
| Streaming | Limited (server-sent events, WebSockets alongside) | Built in, in both directions | Subscriptions, usually over WebSockets |
| Browser support | Native | Needs a proxy such as gRPC-Web | Native |
| HTTP caching | Works naturally with GET and CDNs |
Not with standard HTTP caches | Hard; queries are usually POSTed to one URL |
| Tooling and familiarity | Universal | Strong for service-to-service | Strong for frontends |
| Main risk | Many round trips; over- or under-fetching | Harder to debug by hand; browser limits | Expensive or abusive queries; N+1 queries on the server |
Choose REST when
Section titled “Choose REST when”- The API is public, or used by many clients you don’t control.
- Resources map naturally to URLs and standard operations.
- HTTP caching and CDNs matter, for example for read-heavy public data.
- You want anyone to be able to call it with
curl.
Choose gRPC when
Section titled “Choose gRPC when”- Services call each other inside your platform, where you control both ends.
- Latency, throughput or payload size matter: high call volumes, mobile on poor networks, or large numbers of small messages.
- You need streaming in either direction.
- You want a strict, generated contract across services written in different languages.
Choose GraphQL when
Section titled “Choose GraphQL when”- Several frontends (web, iOS, Android, partners) need different slices of the same data.
- A screen would otherwise need many REST calls, or a backend for frontend per client.
- The data is a graph of related entities that clients navigate.
- You can invest in the server side: query cost limits, depth limits, persisted queries and batching to avoid N+1 database queries.
Common combinations
Section titled “Common combinations”Many systems use more than one: gRPC between internal services, REST for public and partner APIs, and GraphQL as a layer in front of the services for the organization’s own frontends. The choice is per boundary, not per company.
The verdict
Section titled “The verdict”Default to REST for public and partner APIs, where reach and caching matter most. Use gRPC between services you own when performance or streaming matters. Use GraphQL when many different frontends need flexible access to the same data, and you’re prepared to protect the server from expensive queries.
Read more
Section titled “Read more”Written and edited by Abhinav Taduka, enterprise software architect.
New pages are added regularly. Follow Abhinav on LinkedIn to see them first.