How do you decide between REST, GraphQL, and gRPC for a new API?
Answer
The choice depends on use case, team, and performance requirements. REST is best for: public APIs where discoverability and caching matter, simple CRUD resources, teams familiar with HTTP semantics, and clients that benefit from CDN caching. REST's uniform interface is universally understood. GraphQL is best for: complex data graphs with many related entities, mobile clients that need to minimize over-fetching, multiple different clients (web, mobile, TV) with different data needs, and developer portals where schema introspection aids exploration. Its flexibility comes with increased complexity (N+1 problem, authorization complexity, no HTTP caching). gRPC is best for: internal microservice-to-microservice communication where performance is critical, strongly-typed contracts with generated client/server code, streaming large datasets, and polyglot environments. gRPC uses Protocol Buffers (binary, ~10x faster than JSON), HTTP/2 multiplexing, and bi-directional streaming, but is not natively supported by browsers without a proxy layer. In practice, many systems combine all three: gRPC internally, GraphQL for the BFF (Backend for Frontend), and REST for the public API.
Previous
What is the Richardson Maturity Model and what are its four levels?
Next
What is consumer-driven contract testing with Pact?
More REST API Design Questions
View all →- Advanced What is the Richardson Maturity Model and what are its four levels?
- Advanced What is consumer-driven contract testing with Pact?
- Advanced What are backward compatibility strategies and Postel's Law in REST API evolution?
- Advanced What is event-driven REST and when do you use webhooks vs SSE vs WebSockets?
- Advanced How do you optimize REST API performance — N+1 avoidance, sparse fieldsets, and response compression?