Glossary · Web Development

GraphQL

pronounced as a word plus letters: GRAF-kew-elnoun

GraphQL is a query language for APIs that lets a client request exactly the data it needs in a single request.

Part of speech
noun
Pronunciation
pronounced as a word plus letters: GRAF-kew-el
Origin
Developed internally at Facebook in 2012 and released publicly in 2015. The name combines 'graph,' reflecting its data model, with 'QL' for query language.

What is GraphQL?

GraphQL is a query language for APIs that lets a client request exactly the data it needs, no more and no less, and receive it all in a single response. Where a traditional REST API exposes many fixed endpoints that each return a predetermined bundle of data, GraphQL exposes a single endpoint and lets the client describe precisely which fields it wants. If an app needs a user's name and their three most recent orders but nothing else, it asks for exactly that, and the server returns exactly that shape. This precision is the core idea and the source of GraphQL's appeal.

The system works against a schema, a formal description of all the data types available and how they relate to one another. Because the data is modeled as a connected graph of types, a client can traverse relationships in one query, for example fetching a blog post, its author, and that author's other posts together, rather than making several round trips. The client sends a query written in the GraphQL syntax, the server validates it against the schema, resolves each requested field, and returns a JSON response mirroring the structure of the query. The schema also serves as living documentation and enables strong tooling, since editors can autocomplete fields and catch errors before a query ever runs.

GraphQL was developed internally at Facebook in 2012 to solve real problems in its mobile apps, then released publicly in 2015. The name combines "graph," reflecting the way it models data as an interconnected graph, with "QL" for query language. Facebook's mobile teams were struggling with APIs that returned too much or too little data over slow connections, and GraphQL was the answer: give the client control over the payload so each request is efficient. After open sourcing, it was adopted widely and is now governed by an independent foundation.

For a business, GraphQL matters most where performance and flexibility are priorities. By eliminating over-fetching and under-fetching, it reduces wasted bandwidth and the number of network requests, which helps sites and apps feel fast, especially on mobile. It fits naturally with modern front-end frameworks and headless content architectures, where a single flexible data layer must serve many different screens and channels. Front-end teams can iterate quickly because they can adjust what data they request without waiting for a back-end change to create a new endpoint. That decoupling can shorten development cycles and make a digital product easier to evolve.

GraphQL is not automatically the right choice, and the tradeoffs are real. Its flexibility shifts complexity to the server, where resolving arbitrary queries efficiently, guarding against expensive or abusive queries, and caching results all take more thought than with REST. Simple caching that REST gets almost for free at the HTTP level requires extra work in GraphQL because everything flows through one endpoint. For a small site with straightforward data needs, a REST API is often simpler and perfectly adequate. GraphQL earns its keep when you have rich, interrelated data, many client types with different needs, or a front end that changes often. Understanding both REST and GraphQL helps you match the tool to the situation rather than following fashion.

Why it matters

GraphQL can make sites faster and simpler to build by cutting over-fetching and reducing round trips, which is valuable for content-rich and headless projects.