GraphQL
Definition
GraphQL describes API queries that allow clients to specifically request the data fields they need.
GraphQL is a query language for interfaces and an associated execution model. A typed schema describes available data and operations. Clients select required fields; the server resolves the query. Changes are described via mutations. GraphQL is not a specific database.
Simply explained
An application queries exactly the information offered that it needs for its current view.
Why it matters in practice
This can supply different interfaces more flexibly with data but requires a carefully designed interface and controlled queries.
Example from business
Possible example: A mobile view requests only title and price for a product, while a detail page retrieves additional offered fields.
Limits and pitfalls
- Flexible queries are not automatically cheap or safe. Access control, limiting expensive queries, and a comprehensible schema remain tasks of the server implementation.
Origin & history
GraphQL describes data access via a common schema instead of exclusively through fixed tailored response structures. It can be connected with different existing data sources.
Use in mid-sized companies
- An operation checks whether multiple interfaces actually require different data subsets and then defines the schema, permissions, and load limits of the interface.
Frequently asked questions
Does GraphQL replace a database?
No. It describes access to offered data and operations; the underlying storage can be structured differently.
Sources
- Learn GraphQL. · GraphQL Foundation (o. J.): Learn GraphQL.
Editorially reviewed on: