APIs: REST vs GraphQL vs gRPC
APIs: REST vs GraphQL vs gRPC
Overview
APIs define how your frontend and backend (or services) talk.
REST
- Resources and endpoints (GET/POST/PUT/DELETE)
- Simple, widely adopted, cache-friendly
GraphQL
- Single endpoint; clients ask exactly for needed fields
- Great for complex UIs; requires schema and resolvers
gRPC
- Binary protocol over HTTP/2 using protobufs; great for service-to-service
- Not browser-native; best for backend microservices
Choosing
- Most capstone teams should start with REST
- Consider GraphQL if you have nested UIs and over/under-fetching pain
Example
- REST: GET /api/projects/:id returns project with tasks
- GraphQL: query project(id) { id name tasks { id title status } }
Checklist
- Document endpoints or schema early
- Handle pagination, filtering, and errors consistently
- Version your API
Resources
- OpenAPI/Swagger docs
- graphql.org/learn
- grpc.io/docs