GraphQL PlaygroundIn-browser executor · 12 lessons · No server needed
1 / 28
Your First QuerySelect fields with a query

A GraphQL query selects exactly the fields you need. The server returns only what you ask for — no more, no less. Wrap field names in {} to form a selection set. The root type is Query.

Every GraphQL request starts at the root Query type. From there you select fields, and for object fields you open another selection set {} to choose which sub-fields to return.

Schema SDL
Query Editor
Ctrl+Enter
Variables
Response
Click Run to execute the query
Key takeaways
  • GraphQL returns exactly the fields you request — nothing more
  • Nested objects use their own selection set `{}`
  • The root `Query` type is the entry point for all reads
1 / 28

GraphQL Playground — Learn GraphQL In Your Browser with a Full In-Browser Executor

Updated May 21, 2026
Share & Support

What's included

Features

Complete in-browser GraphQL executor — custom tokenizer, parser, and AST-walking executor in pure JavaScript, no npm packages — compare with REST patterns in the REST API builder
28 structured lessons across 12 chapters, beginner to pro — from first query to pagination, auth, and performance, building on JavaScript playground fundamentals
Filtering, sorting, offset pagination, and cursor pagination with Relay-style connections (edges, node, cursor, pageInfo)
Enums and interfaces with inline fragments, errors and nullability, plus operation- and field-level authorization modeled with context
Performance & Production chapter: runnable N+1 problem and DataLoader batching lessons, schema design best practices, and a subscriptions/federation overview
Full query language support — fields, arguments, aliases, nested selections, operation names
Mutation support — mutation keyword, root Mutation type, resolver-based write operations that return fields; mock equivalent REST endpoints with the API mock generator
Input types — object literal arguments parsed and resolved for createPost(input: { ... }) patterns
Variables panel — declare $var: Type in operation, pass JSON values, supports default values with = value syntax
Fragment support — fragment Name on Type { } definitions and ...Name spreads fully expanded before execution
Directives — @include(if: Boolean) and @skip(if: Boolean) applied per-field during execution
Introspection — __schema system field returns queryType, mutationType, and full types list from lesson schema
Inline fragments — ... on TypeName { } syntax for union types, matched via __typename on resolved items
Schema SDL display — collapsible panel showing the type definitions for the current lesson in GraphQL SDL format
Schema Explorer panel — right sidebar with collapsible type/field tree showing all types and their field types
Syntax-highlighted JSON response — keys in pink, strings in green, numbers in amber, booleans in purple
Lesson sidebar with 6 chapter groups and active highlighting with GraphQL pink left border indicator
Keyboard shortcut — Ctrl+Enter runs the current query without clicking the Run button
Last active lesson saved to localStorage and restored on return visits

About this tool

Learn GraphQL Without a Server — Run Real GraphQL Operations Instantly in Your Browser

GraphQL has become the standard query language for modern APIs — powering data layers at GitHub, Shopify, Twitter, and thousands of other companies. Yet learning GraphQL traditionally requires setting up a server, installing dependencies, configuring a schema, and wiring up resolvers before writing your first query. This playground removes every barrier. Open any lesson and you can write and execute GraphQL immediately.

All GraphQL operations run entirely in your browser — no data is sent to any server. The playground includes a complete custom GraphQL tokenizer, parser, and executor implemented in pure JavaScript. Every query, mutation, fragment, directive, and introspection call executes locally against in-memory resolvers defined alongside each lesson. There is no npm, no Node.js, no backend, and no API key.

How the executor works: When you click Run, the query string is tokenized into tokens (field names, braces, arguments, directives), parsed into an AST (Abstract Syntax Tree) representing the operations and selection sets, and then executed by walking the AST and calling resolver functions for each field. Aliases rename response keys, variables replace {kind:'variable'} nodes, @include and @skip directives gate field inclusion, fragment spreads expand into inline selection sets, and inline fragments match on __typename for union types. The result is the familiar { data: {...} } JSON response rendered with syntax highlighting in the response panel.

The 28-lesson curriculum spans 12 chapters and takes you from your first query to production concerns. Your First Query starts with field selection — the core idea that GraphQL returns only the fields you ask for — and then covers arguments for filtering and finding by ID. You immediately see that requesting { hello } returns only hello, not any other field the type might have.

Nested & Lists shows how GraphQL traverses relationships. The nested objects lesson demonstrates that resolver functions receive the parent object as their first argument — a User resolver passes the user to a Posts resolver, which filters by authorId. The aliases lesson shows how alice: user(id: "1") and bob: user(id: "2") coexist in one query response without key collisions.

Mutations introduces the mutation keyword and the pattern of returning fields from write operations. The input types lesson shows the standard input CreatePostInput { ... } pattern for grouping mutation arguments, which is cleaner than many separate top-level arguments and makes mutations reusable.

Variables covers the canonical way to parameterise queries — declare $id: ID! in the operation signature and pass {"id": "2"} as a separate JSON object. The default variables lesson shows = value syntax in declarations, so clients can omit optional variables entirely.

Fragments & Directives covers two of the most powerful query composition features. Fragments eliminate field duplication with fragment UserFields on User { id name role } and ...UserFields spreads. Directives use @include(if: $showEmail) and @skip(if: $skipRole) to let clients control response shape at query time — change the variables and re-run to see the response change.

Aliases & Meta Fields covers renaming response keys to query the same field twice, and the __typename meta field that client caches use to key entities. Filtering, Sorting & Pagination moves into real API design: filter and sort arguments, offset pagination with limit/offset, and the production-standard cursor pagination using Relay-style connections with edges, node, cursor, and pageInfo.

Enums & Interfaces constrains inputs with enum Role { ADMIN USER GUEST } and shares fields across types with interfaces, selected via inline fragments. Errors & Nullability shows how a thrown resolver lands in the top-level errors array (alongside partial data), and how ! non-null fields differ from nullable ones — including how a null bubbles up to nullify its parent.

Introspection & Tooling uses __schema to explore types at runtime, exactly as GraphiQL and Apollo Studio do. Auth & Context models how production servers authorize requests: a protected operation throws Unauthorized without a valid token, and field-level authorization hides sensitive fields like email unless an admin is calling.

Performance & Production is where the curriculum reaches pro level. The N+1 problem lesson shows how nested resolvers fire once per parent — 1 query for posts plus N for authors — and the DataLoader lesson demonstrates the batching-and-caching fix that turns 1 + N into 1 + 1. A schema design lesson covers naming, input types, nullable-by-default, connections, and evolving without versioning via @deprecated, and a final lesson gives an honest overview of subscriptions (real-time over a long-lived connection) and federation (composing many subgraphs into one supergraph), both of which need a live server beyond this sandbox.

Why Use GraphQL?

GraphQL lets the client ask for exactly the data it needs in one request, ending the over-fetching and under-fetching that plague REST. A single strongly-typed schema documents the entire API and drives editor autocomplete; one request can fetch deeply nested, related data that would take many REST round-trips; and the API evolves by adding fields and deprecating old ones, so versioned endpoints become rare. Those benefits are why GitHub, Shopify, and countless others expose GraphQL APIs — and this playground teaches not just the syntax but the production patterns (pagination, authorization, N+1/DataLoader) that separate a beginner from a professional. Pair it with the JavaScript Playground for language fundamentals and the REST API Builder to compare the request/response model with REST.

Step by step

How to Use

  1. 1
    Choose a lesson from the left sidebarThe sidebar lists all 28 lessons grouped into 12 chapters. Start with "Select fields with a query" in Your First Query if you are new to GraphQL, or jump to a pro chapter — Pagination, Auth & Context, or Performance & Production — that matches your level. Click any lesson to load its query, variables, and schema. Your last active lesson is restored when you return.
  2. 2
    Read the concept explanationEach lesson opens with a concept panel explaining what the GraphQL feature does and why it exists. Inline code markers highlight keywords and field names. The explanation connects the syntax to real-world use cases — for example, why variables are safer than string interpolation, or why input types are preferred over many separate arguments.
  3. 3
    Optionally expand the Schema SDL and Variables panelsThe Schema SDL panel (collapsible, below the concept) shows the type definitions for this lesson in GraphQL Schema Definition Language format. The Variables panel (below the query editor) shows the JSON variables the query will use. You can edit both the query and the variables before running. Try changing a variable value and re-running to see the response change.
  4. 4
    Click Run to execute the queryClick the pink Run button or press Ctrl+Enter. The query is tokenized, parsed into an AST, and executed against the lesson's in-memory resolver functions. The result appears in the Response panel below — a syntax-highlighted JSON object with a data key (or errors if something went wrong). The entire execution happens locally in your browser in milliseconds.
  5. 5
    Explore the Schema Explorer and advance to the next lessonThe Schema Explorer on the right panel shows all types and their fields from the lesson schema. Click any type to expand or collapse its field list. Use the Previous and Next buttons at the bottom to move between lessons. All 28 lessons together take you from basic field selection to production GraphQL — pagination, authorization, and the N+1/DataLoader performance pattern.

Real-world uses

Common Use Cases

Front-end developers learning the GraphQL query language
Many developers reach for GraphQL when they need to consume a GitHub, Shopify, or Contentful API — but the query language has unique concepts like selection sets, aliases, fragments, and variables that differ from REST. This playground provides hands-on practice with each concept, in a zero-setup environment, before you write queries against a real API.
{}
Back-end developers building their first GraphQL API
Understanding how resolvers work from the client side — seeing how field selections map to resolver calls, how arguments are passed, how nested types chain resolver calls with the parent object — helps you design schemas and resolvers more effectively. Run the nested objects lesson to see exactly how User.posts receives the user object.
Students following GraphQL courses and tutorials
GraphQL courses on Udemy, YouTube, or egghead.io often assume you have a server running. This playground provides a zero-configuration environment to follow along, test the query examples from any lesson, and experiment with variations — without pausing to configure a server, install packages, or set up a database.
Teams onboarding engineers to a GraphQL API
When a new team member joins a project that uses a GraphQL API, the playground provides a structured path through the query language. Complete all 12 lessons to understand queries, mutations, variables, fragments, directives, and introspection — the complete client-side GraphQL toolkit — before touching the production schema.
Developers reviewing GraphQL fundamentals
The playground doubles as an interactive reference. Forget the syntax for default variables? Not sure whether to use a fragment or an alias? Jump to the relevant lesson for a working, editable example. The schema explorer on the right shows all types and fields for the current lesson at a glance.
🔍
Anyone curious how GraphQL introspection works
The introspection lesson shows the real __schema query that tools like GraphiQL send to every GraphQL server to power their documentation and autocomplete. Run the lesson to see queryType, mutationType, and the full type list — the same metadata every GraphQL client discovers at runtime.

Got questions?

Frequently Asked Questions

No. Everything runs in your browser against an in-memory JavaScript executor. No server, no API key, and no network requests. All GraphQL operations run entirely in your browser — no data is sent to any server.

Beginner to pro across 28 lessons in 12 chapters: field selection, arguments, nested objects, aliases and __typename, filtering, sorting, offset and cursor pagination, mutations and input types, variables and defaults, fragments, @include/@skip directives, enums, interfaces and union types, errors and nullability, __schema introspection, operation- and field-level authorization, the N+1 problem and the DataLoader fix, schema design, and a subscriptions/federation overview.

GraphQL lets clients request exactly the data they need in one round-trip, ending REST over-fetching and under-fetching. A single typed schema documents the API and powers autocomplete, related data comes back in one request, and the API evolves by adding fields and deprecating old ones instead of versioning endpoints. The playground teaches both the query language and the production patterns — pagination, auth, and N+1/DataLoader.

Resolvers run per field, so posts { author } calls the author resolver once per post — 1 query plus N. DataLoader batches the author keys requested in one tick into a single load and caches per request, turning 1 + N into 1 + 1. The Performance & Production chapter demonstrates both, runnable.

Offset uses limit/offset (like SQL LIMIT/OFFSET) — simple but slow at large offsets and unstable when rows shift. Cursor pagination (Relay connections) gives each item an opaque cursor and you request first: N after: cursor, returning edges and pageInfo; it is stable and the production standard. Both are runnable lessons here.

Queries read data using the query keyword (or shorthand {}), mapping to the Query root type. Mutations write data using the mutation keyword, mapping to the Mutation type. Both return fields — you specify what you want back from either operation. Queries can run in parallel; mutations run sequentially.

Declare variables in the operation signature with $name: Type, then pass JSON values in the Variables panel. The executor replaces $var references with the provided values before resolving fields. Default values use = value in the declaration and are used when the variable is absent from the JSON.

Fragments define named, reusable field selections for a type: fragment UserFields on User { id name role }. Spread them with ...UserFields inside any matching selection set. The executor expands fragment spreads before resolving, so each field is resolved as if it were written inline.

Introspection lets you query the schema itself — not data, but the API structure. The __schema field returns queryType, mutationType, and all type names and kinds. GraphiQL and Apollo Studio use introspection to power their autocomplete and documentation panels. The playground supports the full __schema introspection query.

@include(if: true) includes the field; false omits it. @skip(if: true) omits the field; false includes it. Both accept a Boolean variable or literal. Try the directives lesson: change showEmail or skipRole in the variables JSON and re-run to see the response change.

GraphiQL and Apollo Sandbox connect to a real GraphQL server URL and send HTTP requests. This playground has no server — the execution engine runs entirely in JavaScript in your browser. It is a structured learning tool with concept explanations, not an API client. Use it to learn the query language, then apply that knowledge to real APIs with GraphiQL.