API Design Patterns
REST, GraphQL, and gRPC are the three dominant API styles, each optimised for a different context. REST is the standard for public APIs and browser clients — stateless, cacheable, and universally understood. GraphQL solves over-fetching for complex UIs — clients declare exactly the fields they need. gRPC uses Protocol Buffers over HTTP/2 for high-performance service-to-service calls — binary encoding is smaller and faster than JSON, with first-class streaming support.
API versioning prevents breaking changes from reaching existing clients. URL versioning (/v1/, /v2/) is explicit and easy to route. Deprecation requires a sunset period — announce the timeline, log usage of old endpoints, and monitor adoption before removal.
Check your understanding
REST vs GraphQL vs gRPC — one typical fit each?Show answerHide answer
Answer
REST: public/browser APIs. GraphQL: UIs with varying field needs. gRPC: internal typed service calls.Why version public APIs?Show answerHide answer
Answer
So breaking changes do not strand existing clients — with a documented deprecation window.What does over-fetching mean?Show answerHide answer
Answer
Returning many fields the client does not need for the current view — costly on mobile networks.