GraphiQL
GraphiQL is a graphical, in-browser IDE for exploring and testing GraphQL APIs. It allows developers to construct queries, inspect schemas, view documentation, and run operations — all from an intuitive UI.
Key Features
- Query editor with syntax highlighting and autocomplete
- Real-time results from your GraphQL API
- Documentation explorer (auto-generated from your schema)
- Variable and header panels
- Easily test queries, mutations, and subscriptions
Getting Started
1. Install GraphiQL (Locally)
If you're building a GraphQL server, you can embed GraphiQL in your app:
With Express + Apollo Server
Then add:
Visit
http://localhost:4000/graphql
to use GraphiQL.
2. Use Hosted GraphiQL Tools
You can use GraphiQL without installing anything:
Just enter your GraphQL endpoint and start exploring.
Using GraphiQL
Write a Query
Use Variables
Use Headers
Click the "Headers" tab to send custom headers like auth tokens:
Schema Explorer
Click on the Docs sidebar to:
- Browse types, fields, enums, and descriptions
- Understand arguments and return types
- Auto-complete based on the schema
This is automatically generated from your schema’s introspection.
Subscriptions
GraphiQL supports subscriptions via WebSockets if properly configured.
Not all versions of GraphiQL support subscriptions out of the box — consider using GraphQL Playground or Apollo Sandbox for better support.
Alternatives to GraphiQL
Tool | Features |
---|---|
GraphQL Playground | Modern UI, supports subscriptions |
Apollo Sandbox | Fully hosted, works with Apollo Server |
Insomnia/Postman | Good for GraphQL over HTTP |
Altair | Cross-platform GraphQL IDE |
Summary
- GraphiQL is a powerful tool for exploring and testing GraphQL APIs.
- It helps with learning, debugging, and documenting your API.
- You can self-host it, or use it via various web-based interfaces.