REST for simple CRUD, GraphQL for flexible frontends, gRPC for microservices.
REST¶
- HTTP verbs (GET, POST, PUT, DELETE)
- Resource-based URL design
- Simple, well understood
- Over-fetching / under-fetching problem
GraphQL¶
- Single endpoint, client defines the response
- No over/under-fetching
- Strongly typed schema
- Introspection and tooling
- More complex server-side
gRPC¶
- Protocol Buffers (binary)
- HTTP/2 streaming
- Code generation (protoc)
- Extremely fast
- Less suitable for browsers
When to Use Which¶
- REST — public APIs, simple CRUD, most projects
- GraphQL — mobile/web apps with complex UI, multiple data sources
- gRPC — microservices communication, low latency, streaming
REST Is the Default¶
REST for most. GraphQL for data-heavy frontends. gRPC for inter-service.
restgraphqlgrpcapi