Skip to content

REST vs gRPC vs GraphQL

REST uses HTTP verbs with resources. gRPC uses protobufs and HTTP/2. GraphQL lets clients request exactly the data they need.


AspectRESTgRPCGraphQL
Data formatJSON (usually)Protobuf (binary)JSON (query)
TransportHTTP/1.1HTTP/2HTTP/1.1 or 2
SchemaOpenAPI / Swagger.proto fileSDL (Schema Definition Language)
Client controlServer decides response shapeServer defines service contract✅ Client picks fields
Streaming❌ No✅ BidirectionalPartial (subscriptions)
Human-readable✅ Yes❌ Binary✅ Yes
PerformanceGood⚡ Excellent (binary, multiplexed)Good (but complex queries)

The standard: GET /users/123 → returns user data.

GET /users/123
→ { "id": 123, "name": "Alice", "email": "alice@example.com" }

Pros: Simple, universal, cached easily, human-readable. Cons: Fixed response shape (over-fetching/under-fetching), no type safety.


The high-performer: Define services in a .proto file. Generate clients.

service UserService {
rpc GetUser (GetUserRequest) returns (User);
}
message GetUserRequest { int64 id = 1; }
message User { int64 id = 1; string name = 2; string email = 3; }

Pros: Blazing fast (binary protobuf), type-safe, streaming, multi-language. Cons: Not human-readable, harder to debug, no browser support (needs gRPC-web).


The flex option: Clients write queries to get exactly what they need.

query {
user(id: 123) {
name
email # Only request the fields you want
}
}

Pros: No over-fetching, single endpoint, strong typing, great developer tools. Cons: Complex queries can overload the server, caching is harder, N+1 problem.


ScenarioBest Choice
Public API (external developers)REST — universal, simple, cached by CDN
Microservice-to-microservicegRPC — fast, type-safe, streaming
Complex UIs with varied data needsGraphQL — flexible, single endpoint
Mobile apps (low bandwidth)gRPC (binary) or GraphQL (select fields)
Simple CRUDREST — KISS principle

  • REST is the safest default. Use it unless you have a specific reason for gRPC or GraphQL.
  • gRPC adds performance but requires code generation and protobuf tooling.
  • GraphQL gives frontend teams independence but shifts complexity to the backend.
  • Many systems use REST for external APIs + gRPC for internal services.

  • REST = simple HTTP endpoints. The standard. Start here.
  • gRPC = fast binary protocol. Great for internal service-to-service calls.
  • GraphQL = clients ask for exactly what they need. Great for complex frontends.