About this project
GraphQL.js is the JavaScript reference implementation of GraphQL, the query language for APIs originally created at Facebook. The README points to the GraphQL specification repository for a general overview of the language, and notes that the examples described there appear as tests inside this repository — a suggested path for newcomers is to read that overview alongside the corresponding tests.
Main capabilities
The library exposes two central capabilities: building a type schema and serving queries against that schema. A schema is defined with GraphQLSchema and GraphQLObjectType, with fields whose type is one of the built-in scalars such as GraphQLString; each field can supply a resolve function. The README states that a resolver may return a value, a promise, or an array of promises. Queries are run through the graphql function, which accepts a schema and a source string and returns a promise of the result. Before executing, the function verifies that the query is syntactically and semantically valid and otherwise reports errors, illustrated by an example that returns a "Cannot query field" error with location information.
Installation
GraphQL.js is installed from npm as the package `graphql`, using npm, yarn, or bun. The README also mentions an automatically maintained `npm` branch of the repository that tracks the last commit of the 17.x.x line passing all tests; depending directly on that branch is offered as a way to use not-yet-released code, while the README recommends using published npm builds.
Browser and bundler usage
The README notes the library is general-purpose and can be used both in a Node server and in the browser, citing GraphiQL as an example project built with it. Projects using webpack or rollup should work without special configuration and include only the parts of the library they use, because GraphQL.js is distributed with both CommonJS (`require()`) and ESModule (`import`) files. An `exports` map in `package.json` directs runtimes and bundlers to the appropriate files; tooling without `exports` support finds CommonJS builds in `.js` files and the ESModule build in `.mjs` files.
Project governance and support
Contributions are welcomed via pull requests, and the repository is managed by EasyCLA: participants must sign a GraphQL Specification Membership agreement, either individually or through an employer, before contributing. The README also mentions GraphQL Foundation membership as a way to financially support the community.
Changes are tracked as GitHub releases. The project is MIT-licensed. It follows Semantic Versioning, with full support (bug fixes and security updates) for the latest major version, feature support for the previous major version for 12 months after a new major release (backporting specification changes only when they are not breaking), and no active maintenance for older versions — except that a version released less than a year ago is treated as the previous major version. There is currently no Long-Term Support release; users are encouraged to upgrade to the latest stable version. End-of-life dates for a major version are announced at least six months in advance, after which that version receives no updates even for critical security issues. Critical security updates apply to both the current and previous major versions. Upgrade assistance is offered through per-version release notes, migration guides in the documentation site, and a community Discord channel.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.