GraphQL or REST?

GraphQL Course · lesson 9 of 14 · 5 min read

An honest comparison - GraphQL is a trade, not an upgrade.

Open this lesson in the learning hub

Key points

  • GraphQL wins when many different clients need different shapes of the same data.
  • REST wins when the API is simple, cacheable and consumed one way.
  • HTTP caching is much harder with GraphQL: one URL, POST bodies, so CDN caching mostly does not apply.
  • File upload, rate limiting per endpoint and simple monitoring are all easier in REST.
  • You can run both: GraphQL for a rich client, REST for webhooks, uploads and third parties.

GraphQL trades caching and simplicity for client flexibility - take the trade only if you need the flexibility.

This is a reading copy. The full lesson — with the visual explainer, the interactive lab and a Run button for the code — lives in the GraphQL Course course, and every lesson in it is listed on the GraphQL Course contents page.