REST vs GraphQL
On this page
Different philosophies
REST is resource-oriented: multiple endpoints, standard HTTP semantics, predictable caching. GraphQL is query-oriented: a single endpoint where the client specifies exactly what data it wants.
Request model comparison
- REST: GET /users/42
- GraphQL: POST /graphql with a query body
Flexibility
- REST: Fixed response shape per endpoint.
- GraphQL: Client chooses fields dynamically.
Over-fetching and under-fetching
GraphQL helps reduce over-fetching by letting clients request only needed fields. REST can achieve similar behavior with fields/include patterns but requires design discipline.
Caching
- REST: Native HTTP caching (ETag, Cache-Control, CDN support).
- GraphQL: Harder to cache at HTTP layer because most calls use POST. Requires extra tooling or persisted queries.
Tooling and ecosystem
- REST: Simple tooling, curl-friendly, CDN-friendly.
- GraphQL: Strong schema tooling, introspection, type-safe clients.
Complexity
- REST complexity lives in endpoint design and consistency.
- GraphQL complexity lives in resolvers, performance tuning, and query cost control.
Team considerations
- Small teams: REST is often simpler and easier to operate.
- Large frontend-heavy orgs: GraphQL can reduce coordination friction.
When REST shines
- CDN caching is important.
- Simple CRUD APIs.
- Public APIs consumed by many unknown clients.
When GraphQL shines
- Highly dynamic UIs with many nested relationships.
- Strong type systems across frontend and backend.
- Multiple clients needing different data shapes.
Checklist
- Do you need HTTP-level caching? REST may be simpler.
- Do clients need highly customized data shapes? GraphQL may help.
- Does your team have capacity to manage GraphQL performance complexity?