Open-source, self-hosted headless CMS in TypeScript that generates REST and GraphQL content APIs from your content models.
graphql/graphql-js
The JavaScript reference implementation of GraphQL, for building typed schemas and executing queries in Node.js and browsers.
- Stars
- 20,340
- Forks
- 2,089
- Open issues
- 102
- Last commit
- 9 hours ago
What is it?
GraphQL.js is the reference implementation of GraphQL, the query language for APIs originally created at Facebook, written for JavaScript. It lets you define a type schema that maps to your code, then serve queries against that schema. Before execution, queries are checked for syntax and semantic validity, and invalid queries return structured errors.
The library is published on npm as `graphql` and works in both Node.js servers and the browser. It ships with both CommonJS and ES module builds, so bundlers such as webpack and rollup can include only the parts you use. The GraphiQL in-browser IDE is built on top of it.
The package is MIT-licensed and maintained under the graphql organization, with a published version support policy covering major releases.
Key features
- 01Build a typed GraphQL schema from JavaScript objects and resolver functions.
- 02Validate query syntax and semantics before execution, returning clear errors.
- 03Run queries with the `graphql` function, with resolvers that can return values or promises.
- 04Works in Node.js and browsers, with CommonJS and ES module builds.
Use cases
- Building a GraphQL API server in Node.js.
- Adding a GraphQL layer on top of existing JavaScript data sources.
- Using GraphQL tooling in the browser, such as building an IDE like GraphiQL.
- Tree-shaken client or server bundles that include only the features you use.
Quick start
- 1
Install GraphQL.js from npm
npm install --save graphql - 2
Build a schema and run a query with graphql({ schema, source })
Topics
FAQ
- What is graphql-js?
- The JavaScript reference implementation of GraphQL, for building typed schemas and executing queries in Node.js and browsers. GraphQL.js is the reference implementation of GraphQL, the query language for APIs originally created at Facebook, written for JavaScript. It lets you define a type schema that maps to your code, then serve queries against that schema. Before execution, queries are checked for syntax and semantic validity, and invalid queries return structured errors.
- Is graphql-js free to use? What license does it have?
- graphql-js is open source under the MIT license. Check the license terms before using it in commercial products.
- Is graphql-js still maintained?
- Actively maintained. The last commit to graphql-js was on Oct 20, 2026.
- What can I use graphql-js for?
- Building a GraphQL API server in Node.js. Adding a GraphQL layer on top of existing JavaScript data sources. Using GraphQL tooling in the browser, such as building an IDE like GraphiQL. Tree-shaken client or server bundles that include only the features you use.
- How do I install graphql-js?
- Install GraphQL.js from npm: npm install --save graphql Build a schema and run a query with graphql({ schema, source })
- Where can I get graphql-js?
- The source code and installation instructions are on GitHub: https://github.com/graphql/graphql-js
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A GraphQL client for TypeScript and JavaScript with normalized caching, React hooks, and framework support for Vue, Angular and Svelte.
GraphQL-native, API-only commerce platform in Python for building headless online stores with composable backends.
RedwoodJS's GraphQL package, the optional GraphQL API layer of the Redwood full-stack React framework, built on GraphQL Yoga and Envelop.
A zero-configuration build tool for the web that bundles HTML, CSS, JavaScript and assets without a config file.
A headless, framework-agnostic rich text editor built on ProseMirror, extensible through a large set of extensions.