SA-301d · Module 1
REST vs. GraphQL Decision Framework
4 min read
REST and GraphQL are not competitors. They are tools optimized for different access patterns. REST excels at resource-oriented access with predictable, cacheable responses — when the client knows what resources it needs and each resource has a natural URL. GraphQL excels at flexible, client-driven queries — when the client needs varying subsets of data across multiple resources and over-fetching or under-fetching with REST endpoints would be significant.
- Choose REST When The API is resource-centric with well-defined entities. Caching is critical — REST leverages HTTP caching natively. The consumer base is large and diverse with varying technical sophistication. The API is public-facing and must be discoverable without specialized tooling. The team has deep REST experience and the operational model favors simplicity.
- Choose GraphQL When Multiple clients need different subsets of the same data — mobile needs a compact payload, web needs a rich payload. The data model is deeply nested with many relationships. The frontend team wants to iterate on data requirements without backend changes. Over-fetching is a measurable performance problem. The team has the capacity to operate a GraphQL server and manage schema evolution.
- Choose gRPC When Inter-service communication with strict performance requirements. The consumer and producer are both internal services with code generation tooling. Binary protocol efficiency matters — high throughput, low latency, streaming. The trade-off: gRPC is not browser-native and requires a gateway for web clients.