
GraphQL.js
JavaScript reference implementation of GraphQL, a query language for APIs.
- Stars
- 20.3k
- Forks
- 2.1k
- Licence
- MIT
- Language
- TypeScript
- Last update
- 4 days ago
- Type
- Library
What it is
GraphQL.js is the official JavaScript implementation of GraphQL, a query language for APIs originally created by Facebook. It lets developers define a typed schema that maps to their code, then run queries against that schema, with validation of queries before they execute. It works in both Node.js servers and browsers.
- Define a GraphQL schema with object types and fields in JavaScript
- Serve a query against a schema and get a structured result or validation errors
- Bundle only the parts of the library you use with webpack or rollup
Great for
- JavaScript or TypeScript developers building a GraphQL API on Node.js
- Developers who want the reference implementation that other GraphQL tools are built on
- Teams building browser-side tools that work with GraphQL schemas
Not ideal for
- People who only want to call an existing GraphQL API and do not write server code; a client library would fit better
- Non-developers, since the README assumes familiarity with JavaScript and schemas
How to get it
- 1
Install with a package manager
You'll need: Node.js
Install with npm
npm install --save graphqlInstall with yarn
yarn add graphqlInstall with bun
bun add graphql - 2
Run it
- Install the graphql package with npm, yarn, or bun
- Create a GraphQLSchema with a query type and at least one field
- Call graphql({ schema, source }) with a query string like '{ hello }'
- Check the returned result for data or errors
- 3
Get the most out of it
- Read the tests in src/__tests__ alongside the GraphQL specification overview, as the README suggests
- Use the browser support described in the README with webpack or rollup to include only needed code
- Follow the migration guides on the project documentation site when moving between major versions
- Use the npm branch if you want the latest unreleased build, with the caveat that the README recommends npm releases
Downloads
Strengths
- Maintained as the reference implementation of the GraphQL specification for JavaScript
- Ships both CommonJS and ES module builds, so it works with most bundlers
- Released under the permissive MIT license
Trade-offs
- The README's getting-started material is brief; fuller documentation is on external sites
- Building a full API typically needs additional libraries not covered in this README
- Contributions require signing a GraphQL Specification Membership agreement
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| graphql-js (this) | 20.3k | Library | intermediate | 4 days ago | JavaScript or TypeScript developers building a GraphQL API on Node.js |
| apollo-server | 14k | Library | intermediate | 5 days ago | Node.js developers who want to add a GraphQL API to an existing Express, Koa or Hapi app |
| yoga | 18.9k | Library | advanced | 4 days ago | Developers embedding flexbox-style layout into a native or cross-platform app |
| crystal | 12.9k | Framework | advanced | 4 days ago | Developers who have a PostgreSQL database and want an auto-generated GraphQL API |
| query | 50.5k | Library | intermediate | 4 days ago | Frontend developers building apps that load data from a server |
| apollo-client | 19.8k | Library | intermediate | 5 days ago | Developers building React apps that query a GraphQL API |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.