PART 1 · VISUAL CONCEPT 01

Query AST, Resolver Tree & Exact Projection

How does a GraphQL server turn a query string into an exact JSON payload without over-fetching?

Interactive Lab 01 · Parse, Validate & Resolve

Toggle Fields & Step Through the AST Resolver Tree

Step 0 / 4 · Lex & Parse
Live GraphQL Query POST /graphql
AST & Resolver Execution Tree (Click Any Node) Promise.all
Exact JSON Response 0% Over-Fetch

          
Active AST Node & Kind Query.user FieldNode
Resolver Signature Query.user(root, {id:42}, ctx) Custom DB Resolver
Parent Object Passed { } (root) From parent resolver
Execution Phase & Latency Sequential · 12 ms Click any SVG node to inspect
Interactive Lab 02 · Auto-Synced With Lab 1 Fields

Exact Projection vs. REST Over-Fetching & Under-Fetching

REST Multi-Endpoint Waterfall
2 Round Trips
Returned Payload Fields (Amber = Over-Fetched Waste) 68% wasted
GraphQL Single Exact Request
1 Round Trip · 0% Waste
POST /graphql (1 Graph Query) 118 B
Exact Projected Fields Only (0 Unused Keys) 0% wasted
Live Network & Byte Telemetry
Saved 0 ms · 0% smaller
Mental Model · 24-Line Recursive Execution Engine

How GraphQL Walks the Selection Set

executeSelectionSet.ts

      

Every Field Is a Function

Scalar leaves like name or email don't need custom code—the engine falls back to the default trivial resolver (parent) => parent[fieldName].

Siblings Run in Parallel

Parent-to-child resolution is sequential (child needs parent), while sibling fields fire concurrently via Promise.all.

Validated Before Execution

The parsed AST is type-checked against the SDL schema first—unknown fields like user.ssn fail at Step 1 before touching any database.