Definition
GraphQL is a query language and runtime for APIs, created at Facebook and released as open source in 2015. Instead of fixed endpoints that each return a set structure, GraphQL exposes a single endpoint where the client describes precisely which fields it wants, across related objects, and receives exactly that in one response. It is a different style from REST, aimed at giving front-end applications flexibility and reducing wasted data transfer.
In a company, GraphQL typically appears when a product has rich interfaces, such as a mobile app and a web app that need different slices of the same data, or when many teams consume the same backend. It reduces the back and forth between front-end and back-end developers, because the front end can shape its own queries. Companies such as GitHub and Shopify offer GraphQL APIs to partners alongside or instead of REST.
GraphQL is an established option rather than a replacement for REST: it shines for complex client applications and aggregating many data sources, and it adds complexity in caching, security and rate limiting that REST handles more simply. The misconception is that GraphQL is a database or a newer, better REST. It is a tool with a specific sweet spot, and most companies are well served by REST for straightforward integrations.
In practice
A marketplace app shows a product page combining listing, seller, reviews and shipping data. With GraphQL the app fetches all of it in one request shaped for that screen, instead of 4 REST calls and unused fields.
Why it matters
If your product team debates GraphQL versus REST, the question is about front-end complexity and team structure, not fashion. Understanding the trade-off helps you avoid adopting complexity you do not need.
Frequently asked questions
- Is GraphQL better than REST?
- Neither is better in general. GraphQL gives clients flexibility and fewer round trips, which helps complex apps with varied data needs. REST is simpler to build, cache and secure, and is more widely understood. Choose based on your product's data needs and your team's experience.
- Do I need GraphQL for my business application?
- Only if you have rich client applications pulling varied, related data from many sources, or several teams consuming one backend. For standard integrations between business systems, a well-designed REST API is simpler and cheaper to run.