graphql-playground
GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).
Last updated 7 years ago by schickling .
SEE LICENSE IN LICENSE · Repository · Original npm · Tarball · package.json
$ npm install graphql-playground 
SYNC missed versions from official npm registry.

GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).
You can download the desktop app or use the web version at graphqlbin.com: Demo

Features

  • ✨ Context-aware autocompletion & error highlighting
  • 📚 Interactive, multi-column docs (keyboard support)
  • ⚡️ Supports real-time GraphQL Subscriptions

FAQ

How is this different from GraphiQL?

GraphQL Playground uses components of GraphiQL under the hood but is meant as a more powerful GraphQL IDE enabling better (local) development workflows. Compared to GraphiQL, the GraphQL Playground ships with the following additional features:

  • Interactive, multi-column schema documentation
  • Automatic schema reloading
  • Support for GraphQL Subscriptions
  • Query history
  • Configuration of HTTP headers
  • Tabs

See the following question for more additonal features.

What's the difference between the desktop app and the web version?

The desktop app is the same as the web version but includes these additional features:

  • Support for graphql-config enabling features like multi-environment setups.
  • Double click on *.graphql files.

How does GraphQL Bin work?

You can easily share your Playgrounds with others by clicking on the "Share" button and sharing the generated link. You can think about GraphQL Bin like Pastebin for your GraphQL queries including the context (endpoint, HTTP headers, open tabs etc).

You can also find the announcement blog post here.

Usage

Properties

All interfaces, the React component <Playground /> and all middlewares expose the same set of options:

  • properties
    • endpoint [string] - the GraphQL endpoint url.
    • subscriptionEndpoint [string] - the GraphQL subscriptions endpoint url.
    • setTitle [boolean] - reflect the current endpoint in the page title

As React Component

Install

yarn add graphql-playground

Use

GraphQL Playground provides a React component responsible for rendering the UI and Session management. There are 3 dependencies needed in order to run the graphql-playground React component.

  1. Open Sans and Source Code Pro fonts
  2. Including graphql-playground/playground.css
  3. Rendering the <Playground /> component

The GraphQL Playground requires React 16.

Including Fonts (1.)

<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700|Source+Code+Pro:400,700" rel="stylesheet">

Including stylesheet and the component (2., 3.)

import React from 'react'
import ReactDOM from 'react-dom'
import Playground from 'graphql-playground'
import 'graphql-playground/playground.css'

ReactDOM.render(<Playground endpoint="https://api.graph.cool/simple/v1/swapi" />, document.body)

As Server Middleware

Install

# Pick the one that matches your server framework
yarn add graphql-playground-middleware-express  # for Express or Connect
yarn add graphql-playground-middleware-hapi
yarn add graphql-playground-middleware-koa
yarn add graphql-playground-middleware-lambda

Usage with example

We have a full example for each of the frameworks below:

As serverless handler

Install

yarn add graphql-playground-middleware-lambda

Usage

handler.js

import lambdaPlayground from 'graphql-playground-middleware-lambda'
// or using require()
// const lambdaPlayground = require('graphql-playground-middleware-lambda').default

exports.graphqlHandler = function graphqlHandler(event, context, callback) {
  function callbackFilter(error, output) {
    // eslint-disable-next-line no-param-reassign
    output.headers['Access-Control-Allow-Origin'] = '*';
    callback(error, output);
  }

  const handler = graphqlLambda({ schema: myGraphQLSchema });
  return handler(event, context, callbackFilter);
};

exports.playgroundHandler = lambdaPlayground({
  endpoint: '/dev/graphql',
});

serverless.yml

functions:
  graphql:
    handler: handler.graphqlHandler
    events:
    - http:
        path: graphql
        method: post
        cors: true
  playground:
    handler: handler.playgroundHandler
    events:
    - http:
        path: playground
        method: get
        cors: true

Development npm version

This is a mono-repo setup containing packages for the graphql-playground and graphql-playground-electron.

$ cd packages/graphql-playground
$ yarn
$ yarn start

Open localhost:3000/middleware.html?endpoint=https://api.graph.cool/simple/v1/swapi for local development!

Help & Community Slack Status

Join our Slack community if you run into issues or have questions. We love talking to you!

Current Tags

  • 1.3.7-alpha.2                                ...           alpha (7 years ago)
  • 1.3.11-beta1                                ...           beta (7 years ago)
  • 1.3.17                                ...           latest (7 years ago)

121 Versions

  • 1.3.17                                ...           7 years ago
  • 1.3.14                                ...           7 years ago
  • 1.3.13                                ...           7 years ago
  • 1.3.12                                ...           7 years ago
  • 1.3.11-beta1                                ...           7 years ago
  • 1.3.10                                ...           7 years ago
  • 1.3.10-beta.1                                ...           7 years ago
  • 1.3.8                                ...           7 years ago
  • 1.3.8-beta.2                                ...           7 years ago
  • 1.3.8-beta.1                                ...           7 years ago
  • 1.3.7                                ...           7 years ago
  • 1.3.7-alpha.2                                ...           7 years ago
  • 1.3.7-alpha.1                                ...           7 years ago
  • 1.3.6                                ...           7 years ago
  • 1.3.5                                ...           7 years ago
  • 1.3.5-alpha.1                                ...           7 years ago
  • 1.3.4                                ...           7 years ago
  • 1.3.3                                ...           7 years ago
  • 1.3.2                                ...           7 years ago
  • 1.3.1                                ...           7 years ago
  • 1.3.1-beta.1                                ...           7 years ago
  • 1.3.0                                ...           7 years ago
  • 1.3.0-beta.4                                ...           7 years ago
  • 1.3.0-beta.3                                ...           7 years ago
  • 1.3.0-beta.2                                ...           7 years ago
  • 1.3.0-beta.1                                ...           7 years ago
  • 1.2.1-beta.11                                ...           7 years ago
  • 1.2.1-beta.10                                ...           7 years ago
  • 1.2.1-beta.9                                ...           7 years ago
  • 1.2.1-beta.8                                ...           7 years ago
  • 1.2.1-beta.7                                ...           7 years ago
  • 1.2.1-beta.6                                ...           7 years ago
  • 1.2.1-beta.5                                ...           7 years ago
  • 1.2.1-beta.4                                ...           7 years ago
  • 1.2.1-beta.3                                ...           7 years ago
  • 1.2.1-beta.2                                ...           7 years ago
  • 1.2.1-beta.1                                ...           7 years ago
  • 1.2.0                                ...           7 years ago
  • 1.1.7-beta.3                                ...           7 years ago
  • 1.1.7-beta.2                                ...           7 years ago
  • 1.1.7-beta.1                                ...           7 years ago
  • 1.1.6                                ...           7 years ago
  • 1.1.5                                ...           7 years ago
  • 1.1.4                                ...           7 years ago
  • 1.1.3                                ...           7 years ago
  • 1.1.2                                ...           7 years ago
  • 1.1.1                                ...           7 years ago
  • 1.1.0                                ...           7 years ago
  • 1.0.36-alpha.12                                ...           7 years ago
  • 1.0.36-alpha.11                                ...           7 years ago
  • 1.0.36-alpha.10                                ...           7 years ago
  • 1.0.36-alpha.9                                ...           7 years ago
  • 1.0.36-alpha.8                                ...           7 years ago
  • 1.0.36-alpha.7                                ...           7 years ago
  • 1.0.36-alpha.6                                ...           7 years ago
  • 1.0.36-alpha.5                                ...           7 years ago
  • 1.0.36-alpha.4                                ...           7 years ago
  • 1.0.36-alpha.3                                ...           7 years ago
  • 1.0.36-alpha.2                                ...           7 years ago
  • 1.0.36-alpha.1                                ...           7 years ago
  • 1.0.34                                ...           7 years ago
  • 1.0.33                                ...           7 years ago
  • 1.0.32                                ...           7 years ago
  • 1.0.31                                ...           7 years ago
  • 1.0.29                                ...           7 years ago
  • 1.0.27                                ...           7 years ago
  • 1.0.25                                ...           7 years ago
  • 1.0.24                                ...           7 years ago
  • 1.0.23                                ...           7 years ago
  • 1.0.22                                ...           7 years ago
  • 1.0.21                                ...           7 years ago
  • 1.0.20                                ...           7 years ago
  • 1.0.19                                ...           7 years ago
  • 1.0.18                                ...           7 years ago
  • 1.0.17                                ...           7 years ago
  • 1.0.16                                ...           7 years ago
  • 1.0.15                                ...           7 years ago
  • 1.0.14                                ...           7 years ago
  • 1.0.13                                ...           7 years ago
  • 1.0.12                                ...           7 years ago
  • 1.0.11                                ...           7 years ago
  • 1.0.9                                ...           7 years ago
  • 1.0.8                                ...           7 years ago
  • 1.0.7                                ...           7 years ago
  • 1.0.6                                ...           7 years ago
  • 1.0.5                                ...           7 years ago
  • 1.0.4                                ...           7 years ago
  • 1.0.3                                ...           7 years ago
  • 1.0.2                                ...           7 years ago
  • 1.0.1                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
  • 0.1.21                                ...           7 years ago
  • 0.1.20                                ...           7 years ago
  • 0.1.19                                ...           7 years ago
  • 0.1.18                                ...           7 years ago
  • 0.1.17                                ...           7 years ago
  • 0.1.16                                ...           7 years ago
  • 0.1.15                                ...           7 years ago
  • 0.1.14                                ...           7 years ago
  • 0.1.13                                ...           7 years ago
  • 0.1.12                                ...           7 years ago
  • 0.1.11                                ...           7 years ago
  • 0.1.10                                ...           7 years ago
  • 0.1.9                                ...           7 years ago
  • 0.1.8                                ...           7 years ago
  • 0.1.7                                ...           7 years ago
  • 0.1.6                                ...           7 years ago
  • 0.1.5                                ...           7 years ago
  • 0.1.4                                ...           7 years ago
  • 0.1.3                                ...           7 years ago
  • 0.1.2                                ...           7 years ago
  • 0.1.1                                ...           7 years ago
  • 0.1.0                                ...           7 years ago
  • 0.0.8                                ...           7 years ago
  • 0.0.7                                ...           7 years ago
  • 0.0.6                                ...           7 years ago
  • 0.0.5                                ...           7 years ago
  • 0.0.4                                ...           7 years ago
  • 0.0.3                                ...           7 years ago
  • 0.0.2                                ...           7 years ago
  • 0.0.1                                ...           7 years ago
Downloads
Total 1
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (39)
Dev Dependencies (69)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE