Definition
GraphQL exposes a typed schema. Clients send queries describing nested data needs; the server returns JSON matching that shape — no over-fetching or chaining multiple REST calls.
Popular for mobile apps and complex dashboards; adds server complexity vs. simple REST.
In simple terms
REST is a fixed menu; GraphQL is ordering à la carte — you list exactly what you want on one ticket.
Where you see it
- GitHub's API offers GraphQL.
- Mobile clients reduce payload size with field selection.
- Some full-stack apps use GraphQL with Apollo or Relay.
How it works
1.Define schema
Types, queries, and mutations in a single graph.
2.Client query
Request nested fields in one HTTP POST.
3.Resolve
Server resolvers fetch from databases and services.
Why it matters
- GraphQL is a common alternative to REST when clients need flexible data shapes.
Often confused
GraphQL replaces databases.
It is an API layer; you still need PostgreSQL, Redis, or other stores behind resolvers.