Programming
We provide developers and engineers the guides and tutorials they...
Search
We provide developers and engineers the guides and tutorials they...
Content is king. It's not just about how you're going to write, b...
Looking for an engaging connection with thousands of other people...
REST vs GraphQL vs gRPC compared: how each works, over-fetching, caching, performance, tooling and typing, and which API style fits which use case.
Quick answer: These are three ways for programs to talk to each other over a network. REST models your data as resources at URLs and uses standard HTTP methods on them. It is simple, cacheable and understood everywhere, which makes it the default for public APIs. GraphQL exposes a single endpoint and a typed schema, and lets the client request exactly the fields it needs in one query. It suits applications with complex, varied screens. gRPC has clients call functions on a server, sending compact binary messages over HTTP/2. It is fast and strictly typed, which suits communication between internal services. Many systems use all three in different places.
REST (Representational State Transfer) is an architectural style defined by Roy Fielding in 2000. In practice it means: nouns in URLs, HTTP verbs for actions, and status codes for outcomes. See the overview on Wikipedia.
GET /users/42
{ "id": 42, "name": "Ada Lovelace", "email": "[email protected]", "createdAt": "2026-01-04T10:00:00Z" }
| Method | Meaning | Example |
|---|---|---|
| GET | Read | GET /users/42 |
| POST | Create | POST /users |
| PUT / PATCH | Replace / update | PATCH /users/42 |
| DELETE | Remove | DELETE /users/42 |
Each request is stateless: it carries everything the server needs.
Strengths
GET responses can be cached by browsers and CDNs with standard headers.Weaknesses
GraphQL was created at Facebook and released publicly in 2015, originally to serve mobile apps on slow networks. The official introduction describes it as a query language for your API.
There is one endpoint. The client sends a query describing the shape of data it wants:
query {
user(id: 42) {
name
posts(first: 3) {
title
comments { text }
}
}
}
The response has exactly that shape, and nothing more:
{
"data": {
"user": {
"name": "Ada Lovelace",
"posts": [
{ "title": "On the Analytical Engine", "comments": [{ "text": "Remarkable." }] }
]
}
}
}
The server defines a strongly typed schema. Queries read, mutations write, and subscriptions push updates. Each field is backed by a function called a resolver.
Strengths
Weaknesses
POST to a single URL, so ordinary HTTP caching does not apply without extra techniques.200 response, which changes how monitoring works.gRPC is an open-source framework from Google, released in 2015. See the overview on Wikipedia. It follows the remote procedure call model: the client calls a method as if it were a local function.
You define the service and its messages in a .proto file using Protocol Buffers:
syntax = "proto3";
service UserService {
rpc GetUser (GetUserRequest) returns (User);
rpc WatchUsers (WatchRequest) returns (stream User);
}
message GetUserRequest { int64 id = 1; }
message User {
int64 id = 1;
string name = 2;
string email = 3;
}
From that file, a compiler generates client and server code in many languages. Messages are encoded in a compact binary format and sent over HTTP/2.
Strengths
.proto file is the single source of truth, and generated code catches mismatches at compile time.Weaknesses
| REST | GraphQL | gRPC | |
|---|---|---|---|
| Model | Resources | A graph of typed fields | Procedures |
| Endpoints | Many | One | One per method |
| Data format | Usually JSON | JSON | Protocol Buffers (binary) |
| Transport | HTTP/1.1 or newer | HTTP | HTTP/2 |
| Schema | Optional (OpenAPI) | Required | Required (.proto) |
| Client chooses the fields | No | Yes | No |
| HTTP caching | Straightforward | Difficult | Not applicable |
| Streaming | Limited | Subscriptions | Native, in both directions |
| Browser support | Native | Native | Needs a bridge |
| Human-readable | Yes | Yes | No |
| Typical use | Public APIs, CRUD | Apps with complex, varied views | Service-to-service calls |
A common large-system layout uses all three: gRPC between internal services, a GraphQL or REST layer facing the web and mobile apps (sometimes called a backend for frontend), and REST for the public API.
Other options exist too. tRPC gives end-to-end type safety when the client and server are both TypeScript. Webhooks let a server call you when something happens. Server-Sent Events push one-way updates.
A badly designed API is painful in any style, and a well-designed one is pleasant in any style.
Not in general. GraphQL solves over- and under-fetching for complex clients, at the cost of harder caching and more server complexity. REST is simpler and caches well.
Usually, because of binary encoding and HTTP/2. For many applications the difference is small next to database and network time.
Not directly. Browser applications use gRPC-Web or a similar protocol, through a proxy.
Yes, and many organisations do: gRPC internally, with REST or GraphQL at the edge.
REST, GraphQL and gRPC answer different needs. REST is the common language of the web, GraphQL gives clients control over the data they receive, and gRPC makes service-to-service calls fast and strictly typed. Choose by who is calling your API and what they need from it, and remember that careful design matters more than the style.