Graphiql Install May 2026
;
To install GraphQL Playground as an alternative: graphiql install
app.get('/graphiql', (req, res) => res.send( <!DOCTYPE html> <html> <head> <title>GraphiQL Demo</title> <link href="https://unpkg.com/graphiql/graphiql.min.css" rel="stylesheet" /> </head> <body style="margin: 0; height: 100vh;"> <div id="graphiql" style="height: 100vh;"></div> <script crossorigin src="https://unpkg.com/react/umd/react.development.js"></script> <script crossorigin src="https://unpkg.com/react-dom/umd/react-dom.development.js"></script> <script crossorigin src="https://unpkg.com/graphiql/graphiql.min.js"></script> <script> const fetcher = GraphiQL.createFetcher( url: '/graphql' ); ReactDOM.render( React.createElement(GraphiQL, fetcher: fetcher ), document.getElementById('graphiql') ); </script> </body> </html> ); ); ; To install GraphQL Playground as an alternative: app
| Requirement | Version | Notes | |-------------|---------|-------| | Node.js | 16.x or higher | Required for npm/yarn installations | | npm | 8.x or higher | or yarn, pnpm | | GraphQL Server | Any | Express, Apollo, Yoga, etc. | | Modern Browser | Latest | Chrome, Firefox, Edge | 3.1 Method 1: Express Middleware (Most Common) Target: Adding GraphiQL to an existing Express.js GraphQL server. Step-by-step: # Create project directory mkdir my-graphql-app && cd my-graphql-app Initialize npm project npm init -y Install required packages npm install express graphql graphql-http npm install graphql-express Server Setup ( server.js ): const express = require('express'); const createHandler = require('graphql-http/lib/use/express'); const buildSchema = require('graphql'); // Build schema const schema = buildSchema( type Query hello: String ); Dockerfile: FROM node:18-alpine WORKDIR /app
Apollo Server v4 automatically serves GraphiQL when you visit the endpoint URL in a browser (no separate route needed). 3.3 Method 3: Standalone Desktop Application Target: Developers who want GraphiQL without a server. Installation Steps: | OS | Command / Action | |----|------------------| | macOS | brew install --cask graphiql | | Windows | Download .exe from GraphiQL Releases | | Linux (AppImage) | Download .AppImage , chmod +x , and run | Alternative: Run via npx (temporary) npx graphiql This opens a temporary GraphiQL instance at http://localhost:3000 that can connect to any GraphQL endpoint. 3.4 Method 4: Docker Deployment Target: Team environments or CI/CD pipelines. Dockerfile: FROM node:18-alpine WORKDIR /app