@bestcodetools/graphql-playground
v1.1.2
Published
A standalone GraphQL Playground package with a custom dark UI, schema explorer, smart editors, workspace import/export, and Docker support.
Downloads
566
Readme
GraphQL Playground
A standalone GraphQL Playground package with a custom dark UI, schema explorer, smart editors, workspace import/export, and Docker support.
What This Package Is For
This package serves a browser-based GraphQL playground that helps developers:
- write and run GraphQL queries, mutations, and subscriptions
- inspect the schema in a side panel
- edit variables and headers with guided autocomplete
- view formatted JSON responses with syntax highlighting
- save, import, and export full workspaces with multiple tabs
It is designed to be embedded into an Express application or run as a standalone local server.
Features
- standalone Express server for quick local usage
- custom schema viewer with search and hover details
- query editor with GraphQL autocomplete and inline tooltips
- variables editor with schema-aware suggestions
- headers editor with common header suggestions
- response viewer with JSON syntax highlighting and visible selection states
- collapsible blocks in the query editor, variables editor, headers editor, and response viewer
- cURL import support for shell-style multiline commands
- multi-tab workspace with import/export support
- Docker image support for a compiled runtime
Installation
npm install @bestcodetools/graphql-playgroundStandalone Usage
For development:
npm run standaloneThe playground will be available at:
http://localhost:3000/playgroundYou can change the port with:
PLAYGROUND_PORT=4000 npm run standaloneCompiled Runtime
To run the compiled standalone server without ts-node-dev:
npm run build
npm startDocker Usage
Build the image:
docker build -t graphql-playground .Run the container:
docker run -p 3000:3000 graphql-playgroundThen open:
http://localhost:3000/playgroundAvailable Scripts
npm run standalone: starts the standalone server withts-node-devnpm run build: transpiles TypeScript intodistnpm start: runs the transpiled standalone servernpm test: runs the Jest test suitenpm run transpile:sass:watch: watches and transpiles Sass files
Testing
This package includes a basic integration test for the standalone server.
Run:
npm testThe test verifies that the standalone server starts on an automatically assigned port and responds with 200 on the configured playground path.
Notes
- The standalone runtime disables live reload in production mode.
- Workspace export sanitizes sensitive header values such as authorization, token, and key headers by replacing them with placeholders.
License
ISC
