Skip to main content

Glossary · web

GraphQL

Definition

GraphQL is an API query language Facebook open-sourced in 2015. Single endpoint (/graphql), client requests only the fields it needs. Solves over-fetching and under-fetching; ideal for complex screen-data mapping. Apollo Server + Apollo Client is the most common stack.

Published: 2026-05-05Updated: 2026-05-05

Detailed explanation

GraphQL's core idea: the client declaratively says what it wants, the server returns exactly that. In REST, fetching 'a user + their last 5 orders + each order's products' takes 3-5 endpoint calls; in GraphQL, one query.

3 main operations: Query (read), Mutation (write), Subscription (real-time WebSocket). Schema-first design — backend and frontend operate on a shared schema.

When over REST? Mobile apps (over-fetching costly), complex dashboards (10+ data sources), partner APIs (flexibility needed). When REST? Simple CRUD, public APIs, CDN cache critical.

Use cases

Complex mobile apps (over-fetching costly)

Multi-source dashboards (REST 10+ endpoints)

Real-time features (WebSocket subscription)

Partner API (flexible query required)

Pros

  • +No over-fetching or under-fetching
  • +Single endpoint + introspection
  • +Strong type system (schema-first)
  • +Native real-time subscriptions

Cons

  • Caching is harder (no REST's CDN cache advantage)
  • Server complexity (resolver writing)
  • Tooling mature but narrower than REST
  • N+1 query problem (needs DataLoader)

Related terms

APIRESTtRPCApollo

Related services

Planning a project around GraphQL?

In a 30-minute discovery call we share a written architecture + cost + team recommendation tailored to your project.

Start a discovery call