DevTools Logo

GraphQL Query Playground

GraphQL Query Playground

Run queries and mutations against an editable in-memory schema — no server, no network.

Runs in your browser
Try an example

Pick a bundled demo schema (library, shop or starships) or paste your own SDL, write a query or mutation with variables and aliases, then run it entirely in the browser. Results appear as formatted JSON with field-level errors and source locations, and mutations update an in-memory store that persists across runs until you reset it. The resolver-info tab lists the root fields available for the selected demo. No endpoint, account or network request is involved.

Worked examples
  • Nested book query — Runs against the library demo schema and returns two books, each with its author's name, in about a millisecond.
  • Mutation with persistent state — Adds a book to the in-memory store. Re-running the books query afterwards shows the new record until Reset store is pressed.
  • Schema introspection — Lists every type parsed from the current SDL — a quick way to confirm a schema edit took effect.

Schema & query

4 lines · 259 chars

4 types parsed

Result

not run yet

Run a query to see its result

Try the nested query or mutation example.

Examples

Books with authors

Input
{ books { title author { name } } }
Output
{"data":{"books":[{"title":"A Wizard of Earthsea","author":{"name":"Ursula K. Le Guin"}},…]}}

Nested selection sets resolve from plain objects in the seed store; aliases can rename any field in the response.

Persisted mutation

Input
mutation { addBook(title: "The Dispossessed", authorId: "a1") { id title } }
Output
{"data":{"addBook":{"id":"b3","title":"The Dispossessed"}}}

The mutation appends to the in-memory books array; a subsequent query sees three books until Reset store is pressed.

Error with location

Input
{
  books {
    nope
  }
}
Output
Line 3: Cannot query field "nope" on type "Book".

Validation runs against the parsed SDL, so unknown fields are reported with the exact source position.

About this tool

The GraphQL Query Playground executes queries and mutations against an editable schema entirely in your browser. Start with one of three bundled schemas — a library with books and authors, a shop with products and orders, or a lightweight starship catalogue — or paste your own SDL. The executor supports nested selections, aliases, arguments, variables, fragments, skip/include directives, __typename and a practical __schema introspection subset, and reports mistakes with line and column positions.

Mutations are backed by an in-memory store seeded from demo data. A mutation such as addBook actually inserts a record, so re-running a query afterwards reflects the change; Reset store restores the seed. This makes the tool useful for learning how mutation payloads shape the response and how non-null fields propagate errors, without spinning up a server or configuring resolvers.

The result pane shows formatted JSON, a timing measurement, an errors tab with source locations, and a resolver-info tab listing the root fields available for the selected schema. The tool is intentionally dependency-free: its SDL and query parsing are a teaching subset rather than a full graphql-js implementation, which keeps it small and completely local. Pasted schemas and queries never leave the tab.

What this tool does not do

  • This is a zero-dependency teaching subset, not graphql-js: exotic SDL constructs and full directive/spec validation are out of scope.
  • Subscriptions have no transport and are not executed; only queries and mutations run.
  • Introspection covers __typename and the common __schema type/queryType fields rather than the complete introspection schema.
  • The in-memory store resets on page reload; nothing is persisted to disk or sent anywhere.

How to use this tool

  1. Choose or paste a schema

    Select Library, Shop or Starships from the demo menu, or replace the SDL text with your own type definitions. The type count updates as you edit.

  2. Write a query or mutation

    Use the query editor for nested selections, aliases and arguments; enter variables as a JSON object. Press Run query or Cmd/Ctrl+Enter.

  3. Inspect the result

    Read the JSON in the Result tab, switch to Errors for line/column diagnostics, or open Resolver info to see which root fields the current schema exposes.

  4. Reset the in-memory store

    After mutations, press Reset store to restore the demo data. Changing schema also reseeds the store for the new demo.

Use cases

Learn GraphQL execution

Experiment with nullability, aliases, fragments and mutation payloads immediately, without installing a server.

Prototype a query shape

Paste a schema snippet and try different selection sets before wiring a client to a real endpoint.

Debug schema edits

Change the SDL, re-run introspection and see which types and fields the parser now exposes.

Teaching and demos

Show a class how a mutation changes subsequent query results using the resettable in-memory store.

What the executor supports

FeatureSupport
Queries and mutationsYes — one executable operation per run, selected by name when provided
Nested selections and aliasesYes
Variables and defaultsYes — variables JSON object; required-variable checks
Fragments and @skip/@includeYes
__typename and __schema__typename on any type; __schema { types { name } } subset
Subscriptions and custom scalar validationNo — static teaching subset, not graphql-js

Errors carry the source line and column of the offending selection, so a broken query is actionable rather than a flat message.

Common mistakes

Mistake:Expecting a real network endpoint or authentication headers.

Fix:This is an in-memory teaching executor: no URL, headers or cookies are involved. Use a server playground for live APIs.

Mistake:Running several operations in one document.

Fix:The first operation runs; use the operation name field of a real client or run one operation at a time here.

Mistake:Assuming custom scalar validation and directive semantics match graphql-js exactly.

Fix:The parser is a documented subset. Use graphql-js or a server for spec-complete validation.

Mistake:Forgetting to reset the store after mutations.

Fix:Mutations persist across runs in the session. Press Reset store before expecting the original seed data.

Frequently asked questions

Does it need a GraphQL server?

No. Queries are executed in your browser against a schema parsed from the SDL editor and an in-memory store seeded from demo data. Nothing is fetched, so you can work offline and pasted schemas never leave the tab. This is different from hosted IDEs that require an endpoint URL and auth headers.

How do mutations work without a backend?

Each bundled demo schema has plain root resolver functions: addBook pushes a record into an in-memory books array, addProduct does the same for products, and those changes persist across subsequent runs in the same session. The Mutation tab of the result shows the mutation payload, and a later query reflects the new state. Press Reset store to restore the seed data.

Which GraphQL features are supported?

Queries and mutations with nested selections, aliases, arguments, variables, fragments, @skip/@include directives, __typename and a practical __schema introspection subset. Field and argument validation reports the source line and column. Subscriptions, full directive semantics and exhaustive graphql-js validation are intentionally outside this dependency-free teaching subset.

Can I paste my own schema?

Yes. Replace the SDL editor content with your type definitions and the parser rebuilds the type map on the fly. Root query fields without bundled resolvers get deterministic sample values based on their declared types, so a query still returns a useful shape. If the SDL is malformed, the schema status line reports the error count and execution stops with the offending position.

Why does a field return null?

A field can be null because the store has no matching record (for example, an unknown book id), because a resolver returned no value, or because you queried a nullable field whose data is absent. Non-null fields (!) produce an additional error when they resolve to null. Check the Errors tab for the path and source location of the field that failed.

Is query history or data stored anywhere?

No. The store lives in component memory and resets on page reload; nothing is written to localStorage or sent over the network. Result downloads and copies are generated locally from the JSON in the result pane.

References & standards