Skip to content
StackDecode
System Design
2. Networking FundamentalsAnimated

GraphQL

A query language where the client asks for exactly the fields it needs.

The idea

One endpoint accepts a query describing the shape of the response; resolvers fetch each field.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

ClientGraphQL serverUsers serviceOrders servicequery { user { name orders { total } } }
  • current message
  • earlier
  • failure or attack

The client asks for exactly the fields it needs in one request.

step:
1/6
from:
Client
to:
GraphQL server
1/6

Time runs downward. Solid arrows are requests, dashed arrows are replies.

Step by step

  1. 1Client sends a query
  2. 2Server validates against the schema
  3. 3Resolvers fetch the data
  4. 4Response matches the query shape

Where it is used

Complex UIs with varied data needs.

Watch out for

Expensive queries need depth and cost limits, and caching is harder.

Related