How it works
A GraphQL server publishes a typed schema of everything it offers: users, orders, their fields and how they link. A client sends a query naming just the fields it wants, even across related records (a user with their last three orders), and receives exactly that in one round trip. Mutations change data and subscriptions push live updates.
Facebook built it in 2012 for its mobile apps and released it in 2015; the GraphQL Foundation now looks after the specification. Common tools include Apollo, GraphQL Yoga and Relay, while Hasura, PostGraphile and Supabase's pg_graphql generate an API from a database. The flexibility has costs: caching is harder than with REST, and servers must guard against slow nested queries and the N+1 problem.
GraphQL pros and cons
Pros
- Clients fetch exactly the data a screen needs in one request
- A strongly typed schema doubles as documentation
- One API serves web, mobile and partners with different needs
- Tooling generates typed client code from the schema
Cons
- More complex to build, secure and monitor than REST
- HTTP and CDN caching do not work out of the box
- Deeply nested queries can overload the server without limits
When to use GraphQL
Pick it when
- Several clients (web, iOS, Android) need different views of the same data
- Deeply connected data, such as social graphs or large catalogues
Skip it when
- A small API with one client, where REST or tRPC is simpler
- Caching public responses on a CDN matters a lot
GraphQL pricing
Open source
Free: an open specification with open-source servers and clients.
Approximate, checked September 2026.What the other tools cost
GraphQL vs the alternatives
Related terms
More in Backend and APIs
API styles