GraphQL.js is the official JavaScript implementation of the GraphQL Specification. It provides the core building blocks for constructing GraphQL servers, clients, tools, and utilities in JavaScript and TypeScript.
This documentation site is for developers who want to:
- Understand how GraphQL works
- Build a GraphQL API using GraphQL.js
- Extend, customize, or introspect GraphQL systems
- Learn best practices for using GraphQL.js in production
Whether you’re writing your own server, building a GraphQL clients, or creating tools that work with GraphQL, this site guides you through core concepts, APIs, and advanced use cases of GraphQL.js.
How to use this documentation
To follow along with the code examples in this documentation, make sure your environment meets the following requirements.
Environment
Most code examples use modern JavaScript with ES module (ESM) syntax. We recommend:
- Node.js 22.7 or later, which supports automatic module type detection
- Enable ESM by either:
- Adding
"type": "module"
to yourpackage.json
, or - Using the
.mjs
file extension
- Adding
If you’re using an older version of Node.js or prefer CommonJS, you may need to adjust the code examples accordingly.
Installation
Before running any code examples, install the GraphQL.js package:
npm install graphql
You’ll see reminders about environment setup throughout the documentation, but this setup is assumed by default.