I see teams paralyzed by this choice. Here is the decision matrix I use for enterprise architecture.
1. REST (JSON over HTTP)
Use when: Public facing APIs. Simple CRUD. When caching (CDN/Browser) is critical.
Pros: Universal support, simple, cacheable.
Cons: Over-fetching/under-fetching data. Loosely typed.
2. gRPC (Protobuf)
Use when: Internal Microservice-to-Microservice communication. High performance requirements. Streaming data.
Pros: Small binary payloads. Strong contracts. Code generation.
Cons: Not browser native (requires gRPC-Web). Harder to debug (binary).
3. GraphQL
Use when: Serving complex Frontends (Mobile/Web). Aggregating data from multiple backends. “Backends for Frontends” (BFF) pattern.
Pros: Client asks for exactly what it needs. Single endpoint.
Cons: “N+1” query performance issues. Caching is hard.
The Hybrid approach
My default stack in 2021: gRPC for internal service communication, exposed via a GraphQL gateway for the frontend apps. It gives you performance internally and flexibility externally.
Discover more from C4: Container, Code, Cloud & Context
Subscribe to get the latest posts sent to your email.