GraphQL is a query language and runtime that lets clients request exactly the data they need from an API. Instead of fixed endpoints, a single GraphQL endpoint interprets the query structure and returns a JSON response matching that shape. This approach reduces the amount of data transferred and simplifies front‑end development.
Also called: Graph Query Language
Why it matters
Clients pay for a site that loads quickly and stays up to date; GraphQL ensures the front‑end receives only the necessary fields, which can lower bandwidth usage and speed up page rendering, leading to a smoother user experience and lower hosting costs.
How it works
When a client sends a POST request containing a GraphQL query to the server’s /graphql endpoint, the server parses the query, matches each field to a resolver function defined in the schema, executes those resolvers—often fetching from a database—and assembles a JSON object that mirrors the query shape before returning it to the client.
The mistake people make
A common mistake is assuming GraphQL automatically prevents over‑fetching; developers often write overly broad queries or neglect to limit nested fields, which can produce large payloads and negate performance gains, or they overlook N+1 query issues caused by naïve resolver implementations.