Skip to main content

GraphQL Playground

Prism ships with a built-in GraphQL playground — an interactive browser UI where you can write queries, explore your schema, and test mutations in real time.

Quick Setup

1

Define your schema

Create your PrismGraphQLSchema with query and mutation types.
2

Add the middleware

Mount PrismGraphQLMiddleware on your server.
3

Add the playground

Mount PrismGraphQLPlayground for the interactive UI.
4

Open in browser

Navigate to http://localhost:8080/graphql/playground.
Complete Setup
Now visit http://localhost:8080/graphql/playground to start exploring.

How It Works

The playground provides:
  • Query editor with syntax highlighting
  • Variables panel for parameterized queries
  • Response viewer with formatted JSON
  • Keyboard shortcut — Cmd+Enter (or Ctrl+Enter) to execute
The playground is a self-contained HTML page embedded in the binary — no external CDN or network requests needed. It works completely offline.

Passing Context

Pass application context (like a database connection) to your resolvers via the middleware:
Context Setup

API Endpoints

The middleware handles both GET and POST requests:

Introspection

The playground uses introspection to discover your schema. Try this query to see all available types:
Schema Introspection

Production Considerations

The GraphQL playground should typically be disabled in production to prevent unauthorized schema exploration. Consider mounting it conditionally:
Conditional Playground

What’s Next

Schema

Define more complex schemas with nested types

MCP Server

Build AI tool servers with MCP