Gathering detailed insights and metrics for graphql
Gathering detailed insights and metrics for graphql
Gathering detailed insights and metrics for graphql
Gathering detailed insights and metrics for graphql
npm install graphql
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (85.59%)
MDX (11.67%)
JavaScript (2.29%)
CSS (0.39%)
Shell (0.07%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
20,217 Stars
3,242 Commits
2,049 Forks
395 Watchers
42 Branches
204 Contributors
Updated on Jul 13, 2025
Latest Version
16.11.0
Package Id
graphql@16.11.0
Unpacked Size
1.30 MB
Size
278.19 kB
File Count
391
NPM Version
10.5.2
Node Version
20.13.0
Published on
Apr 26, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
No dependencies detected.
The JavaScript reference implementation for GraphQL, a query language for APIs created by Facebook.
See more complete documentation at https://graphql.org/ and https://graphql.org/graphql-js/.
Looking for help? Find resources from the community.
A general overview of GraphQL is available in the README for the Specification for GraphQL. That overview describes a simple set of GraphQL examples that exist as tests in this repository. A good way to get started with this repository is to walk through that README and the corresponding tests in parallel.
Install GraphQL.js from npm
With npm:
1npm install --save graphql
or using yarn:
1yarn add graphql
GraphQL.js provides two important capabilities: building a type schema and serving queries against that type schema.
First, build a GraphQL type schema which maps to your codebase.
1import { 2 graphql, 3 GraphQLSchema, 4 GraphQLObjectType, 5 GraphQLString, 6} from 'graphql'; 7 8var schema = new GraphQLSchema({ 9 query: new GraphQLObjectType({ 10 name: 'RootQueryType', 11 fields: { 12 hello: { 13 type: GraphQLString, 14 resolve() { 15 return 'world'; 16 }, 17 }, 18 }, 19 }), 20});
This defines a simple schema, with one type and one field, that resolves
to a fixed value. The resolve
function can return a value, a promise,
or an array of promises. A more complex example is included in the top-level tests directory.
Then, serve the result of a query against that type schema.
1var source = '{ hello }'; 2 3graphql({ schema, source }).then((result) => { 4 // Prints 5 // { 6 // data: { hello: "world" } 7 // } 8 console.log(result); 9});
This runs a query fetching the one field defined. The graphql
function will
first ensure the query is syntactically and semantically valid before executing
it, reporting errors otherwise.
1var source = '{ BoyHowdy }'; 2 3graphql({ schema, source }).then((result) => { 4 // Prints 5 // { 6 // errors: [ 7 // { message: 'Cannot query field BoyHowdy on RootQueryType', 8 // locations: [ { line: 1, column: 3 } ] } 9 // ] 10 // } 11 console.log(result); 12});
Note: Please don't forget to set NODE_ENV=production
if you are running a production server. It will disable some checks that can be useful during development but will significantly improve performance.
The npm
branch in this repository is automatically maintained to be the last
commit to main
to pass all tests, in the same form found on npm. It is
recommended to use builds deployed to npm for many reasons, but if you want to use
the latest not-yet-released version of graphql-js, you can do so by depending
directly on this branch:
npm install graphql@git://github.com/graphql/graphql-js.git#npm
Each release of GraphQL.js will be accompanied by an experimental release containing support for the @defer
and @stream
directive proposal. We are hoping to get community feedback on these releases before the proposal is accepted into the GraphQL specification. You can use this experimental release of GraphQL.js by adding the following to your project's package.json
file.
"graphql": "experimental-stream-defer"
Community feedback on this experimental release is much appreciated and can be provided on the issue created for this purpose.
GraphQL.js is a general-purpose library and can be used both in a Node server and in the browser. As an example, the GraphiQL tool is built with GraphQL.js!
Building a project using GraphQL.js with webpack or
rollup should just work and only include
the portions of the library you use. This works because GraphQL.js is distributed
with both CommonJS (require()
) and ESModule (import
) files. Ensure that any
custom build configurations look for .mjs
files!
We actively welcome pull requests. Learn how to contribute.
This repository is managed by EasyCLA. Project participants must sign the free (GraphQL Specification Membership agreement before making a contribution. You only need to do this one time, and it can be signed by individual contributors or their employers.
To initiate the signature process please open a PR against this repo. The EasyCLA bot will block the merge if we still need a membership agreement from you.
You can find detailed information here. If you have issues, please email operations@graphql.org.
If your company benefits from GraphQL and you would like to provide essential financial support for the systems and people that power our community, please also consider membership in the GraphQL Foundation.
Changes are tracked as GitHub releases.
GraphQL.js is MIT-licensed.
5.3/10
Summary
graphql Uncontrolled Resource Consumption vulnerability
Affected Versions
>= 16.3.0, < 16.8.1
Patched Versions
16.8.1
Reason
all changesets reviewed
Reason
30 commit(s) and 5 issue activity found in the last 90 days -- score normalized to 10
Reason
license file detected
Details
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
no binaries found in the repo
Reason
GitHub workflow tokens follow principle of least privilege
Details
Reason
SAST tool is run on all commits
Details
Reason
dependency not pinned by hash detected -- score normalized to 5
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
19 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More