Every modern application talks to other software through APIs. Mobile apps call back-end servers, front ends fetch data, microservices exchange messages, and partners integrate with your platform.
Three API styles dominate these conversations: REST, GraphQL and gRPC. Each solves different problems well, and each creates new problems if used in the wrong place. Let’s break them down with practical examples.
The same request, three ways
Imagine a mobile app screen showing a customer’s name, their last three orders and each order’s status.
REST
GET /customers/42
GET /customers/42/orders?limit=3
Two requests to resource-based URLs. Each returns a fixed JSON structure defined by the server.
GraphQL
query {
customer(id: 42) {
name
orders(last: 3) { id status total }
}
}
One request to a single endpoint. The client asks for exactly the fields it needs.
gRPC
service CustomerService {
rpc GetCustomerSummary (CustomerRequest) returns (CustomerSummary);
}
A strongly typed method call defined in a .proto file. Data travels as compact binary Protocol Buffers over HTTP/2.
REST: the reliable default
REST (Representational State Transfer) organises APIs around resources (customers, orders, invoices) and standard HTTP methods (GET, POST, PUT, PATCH, DELETE).
Strengths
- Simple, widely understood and easy to test with a browser,
curlor Postman - HTTP caching works naturally with GET requests and CDNs
- Excellent tooling, including OpenAPI specifications for documentation and client generation
- Ideal for public APIs and third-party integrations
Weaknesses
- Over-fetching: endpoints may return more data than a client needs
- Under-fetching: clients may need several calls to build one screen
- Versioning decisions (
/v1/,/v2/) need discipline
Best for: public APIs, partner integrations, CRUD-style applications and most web back ends.
GraphQL: flexible queries for complex front ends
GraphQL, originally developed at Facebook, exposes a schema describing types and relationships. Clients send queries specifying exactly what they need.
Strengths
- No over-fetching or under-fetching: clients get precisely the requested fields
- One endpoint for many data needs
- Strongly typed schema with built-in introspection and great developer tools
- Front-end teams can evolve screens without waiting for new back-end endpoints
Weaknesses
- Caching is harder, because most requests are POSTs to one URL
- Performance traps: naive resolvers can trigger the “N+1 query” problem (use batching tools like DataLoader)
- Security complexity: deeply nested queries can overload servers unless you limit query depth and cost
- More moving parts on the server than a simple REST API
Best for: apps with many different screens and clients (web, iOS, Android) needing different data shapes, and products with rich, interconnected data.
gRPC: fast, typed service-to-service communication
gRPC, developed by Google, uses Protocol Buffers to define services and messages, and runs over HTTP/2.
Strengths
- High performance: compact binary messages and multiplexed connections
- Strong contracts: code generation for many languages from one
.protofile - Streaming: supports server streaming, client streaming and bidirectional streaming
- Great for internal microservice communication and low-latency systems
Weaknesses
- Not browser-native: web clients typically need gRPC-Web and a proxy
- Binary payloads are harder to inspect and debug manually
- Less suitable for public APIs consumed by unknown third parties
Best for: microservices talking to each other, real-time streaming, mobile-to-server communication where efficiency matters, and polyglot systems.
Side-by-side comparison
| Factor | REST | GraphQL | gRPC |
|---|---|---|---|
| Data format | Usually JSON | JSON | Protocol Buffers (binary) |
| Transport | HTTP/1.1 or HTTP/2 | Usually HTTP | HTTP/2 |
| Contract | OpenAPI (optional but recommended) | GraphQL schema (required) | .proto files (required) |
| Flexibility for clients | Fixed responses | Client chooses fields | Fixed messages |
| Performance | Good | Good (depends on resolvers) | Excellent |
| HTTP caching | Easy | Harder | Not typical |
| Browser support | Native | Native | Needs gRPC-Web |
| Streaming | Limited (SSE, WebSockets separately) | Subscriptions | Built in |
| Learning curve | Low | Medium | Medium |
| Best fit | Public and CRUD APIs | Complex front ends | Internal services |
Security considerations
All three need authentication (for example OAuth 2.0 and JWT tokens), authorisation checks, TLS and input validation. Some style-specific points:
- REST: protect each endpoint; watch for broken object-level authorisation (users accessing IDs that aren’t theirs).
- GraphQL: limit query depth and complexity, disable introspection in production if appropriate, and check authorisation at the field and resolver level.
- gRPC: use TLS and mutual TLS for service-to-service traffic, and validate message contents, since strong typing doesn’t guarantee valid business data.
Using more than one
Many mature systems combine styles:
- REST for public and partner APIs
- GraphQL as a “backend for frontend” layer serving web and mobile apps
- gRPC between internal microservices
There’s no rule that you must pick only one.
A simple decision guide
| If you need… | Choose |
|---|---|
| A public API for third-party developers | REST |
| Simple CRUD for a web app | REST |
| Many client apps with different data needs | GraphQL |
| To reduce round trips on mobile with complex screens | GraphQL |
| Fast communication between internal services | gRPC |
| Real-time streaming between services | gRPC |
| Maximum simplicity and tooling | REST |
Common mistakes
- Choosing GraphQL for a simple app with three screens and one client, which adds complexity without benefit
- Exposing gRPC directly to browsers without planning for gRPC-Web
- Designing REST endpoints around database tables instead of business resources
- Skipping API documentation, whatever the style
The takeaway
REST remains the most practical default in 2027: simple, cacheable and universally supported. GraphQL shines when many front ends need flexible data. gRPC excels at fast, strongly typed communication inside your system.
Choose based on who consumes the API and what they need, not on what’s trendy. The best API is the one your consumers can understand, rely on and use without constantly asking your team for help.
Leave a Comment