{"id":13432433,"url":"https://github.com/graphql/graphql-js","last_synced_at":"2025-05-12T15:10:59.145Z","repository":{"id":34380994,"uuid":"38307428","full_name":"graphql/graphql-js","owner":"graphql","description":"A reference implementation of GraphQL for JavaScript","archived":false,"fork":false,"pushed_at":"2025-05-04T08:49:03.000Z","size":28149,"stargazers_count":20195,"open_issues_count":163,"forks_count":2039,"subscribers_count":397,"default_branch":"16.x.x","last_synced_at":"2025-05-04T11:11:51.552Z","etag":null,"topics":["graphql","graphql-js"],"latest_commit_sha":null,"homepage":"http://graphql.org/graphql-js/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/graphql.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-06-30T12:16:50.000Z","updated_at":"2025-05-04T08:27:46.000Z","dependencies_parsed_at":"2023-01-16T22:45:55.475Z","dependency_job_id":"8dcf326a-e4a4-4357-8bc4-fcec65ce559a","html_url":"https://github.com/graphql/graphql-js","commit_stats":{"total_commits":2786,"total_committers":210,"mean_commits":"13.266666666666667","dds":0.507537688442211,"last_synced_commit":"273fc8446154e4e6ebf7fcf7e3eff5ff60dd9ec1"},"previous_names":[],"tags_count":170,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql%2Fgraphql-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql%2Fgraphql-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql%2Fgraphql-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql%2Fgraphql-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphql","download_url":"https://codeload.github.com/graphql/graphql-js/tar.gz/refs/heads/16.x.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252323740,"owners_count":21729573,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphql","graphql-js"],"created_at":"2024-07-31T02:01:11.544Z","updated_at":"2025-05-12T15:10:59.132Z","avatar_url":"https://github.com/graphql.png","language":"TypeScript","readme":"[![GraphQLConf 2025 Banner: September 08-10, Amsterdam. Hosted by the GraphQL Foundation](./assets/graphql-conf-2025.png)](https://graphql.org/conf/2025/?utm_source=github\u0026utm_medium=graphql_js\u0026utm_campaign=readme)\n\n# GraphQL.js\n\nThe JavaScript reference implementation for GraphQL, a query language for APIs created by Facebook.\n\n[![npm version](https://badge.fury.io/js/graphql.svg)](https://badge.fury.io/js/graphql)\n[![Build Status](https://github.com/graphql/graphql-js/workflows/CI/badge.svg?branch=main)](https://github.com/graphql/graphql-js/actions?query=branch%3Amain)\n[![Coverage Status](https://codecov.io/gh/graphql/graphql-js/branch/main/graph/badge.svg)](https://codecov.io/gh/graphql/graphql-js)\n\nSee more complete documentation at https://graphql.org/ and\nhttps://graphql.org/graphql-js/.\n\nLooking for help? Find resources [from the community](https://graphql.org/community/).\n\n## Getting Started\n\nA general overview of GraphQL is available in the\n[README](https://github.com/graphql/graphql-spec/blob/main/README.md) for the\n[Specification for GraphQL](https://github.com/graphql/graphql-spec). That overview\ndescribes a simple set of GraphQL examples that exist as [tests](src/__tests__)\nin this repository. A good way to get started with this repository is to walk\nthrough that README and the corresponding tests in parallel.\n\n### Using GraphQL.js\n\nInstall GraphQL.js from npm\n\nWith npm:\n\n```sh\nnpm install --save graphql\n```\n\nor using yarn:\n\n```sh\nyarn add graphql\n```\n\nGraphQL.js provides two important capabilities: building a type schema and\nserving queries against that type schema.\n\nFirst, build a GraphQL type schema which maps to your codebase.\n\n```js\nimport {\n  graphql,\n  GraphQLSchema,\n  GraphQLObjectType,\n  GraphQLString,\n} from 'graphql';\n\nvar schema = new GraphQLSchema({\n  query: new GraphQLObjectType({\n    name: 'RootQueryType',\n    fields: {\n      hello: {\n        type: GraphQLString,\n        resolve() {\n          return 'world';\n        },\n      },\n    },\n  }),\n});\n```\n\nThis defines a simple schema, with one type and one field, that resolves\nto a fixed value. The `resolve` function can return a value, a promise,\nor an array of promises. A more complex example is included in the top-level [tests](src/__tests__) directory.\n\nThen, serve the result of a query against that type schema.\n\n```js\nvar source = '{ hello }';\n\ngraphql({ schema, source }).then((result) =\u003e {\n  // Prints\n  // {\n  //   data: { hello: \"world\" }\n  // }\n  console.log(result);\n});\n```\n\nThis runs a query fetching the one field defined. The `graphql` function will\nfirst ensure the query is syntactically and semantically valid before executing\nit, reporting errors otherwise.\n\n```js\nvar source = '{ BoyHowdy }';\n\ngraphql({ schema, source }).then((result) =\u003e {\n  // Prints\n  // {\n  //   errors: [\n  //     { message: 'Cannot query field BoyHowdy on RootQueryType',\n  //       locations: [ { line: 1, column: 3 } ] }\n  //   ]\n  // }\n  console.log(result);\n});\n```\n\n**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.\n\n## Want to ride the bleeding edge?\n\nThe `npm` branch in this repository is automatically maintained to be the last\ncommit to `main` to pass all tests, in the same form found on npm. It is\nrecommended to use builds deployed to npm for many reasons, but if you want to use\nthe latest not-yet-released version of graphql-js, you can do so by depending\ndirectly on this branch:\n\n```\nnpm install graphql@git://github.com/graphql/graphql-js.git#npm\n```\n\n### Experimental features\n\nEach 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.\n\n```\n\"graphql\": \"experimental-stream-defer\"\n```\n\nCommunity feedback on this experimental release is much appreciated and can be provided on the [issue created for this purpose](https://github.com/graphql/graphql-js/issues/2848).\n\n## Using in a Browser\n\nGraphQL.js is a general-purpose library and can be used both in a Node server\nand in the browser. As an example, the [GraphiQL](https://github.com/graphql/graphiql/)\ntool is built with GraphQL.js!\n\nBuilding a project using GraphQL.js with [webpack](https://webpack.js.org) or\n[rollup](https://github.com/rollup/rollup) should just work and only include\nthe portions of the library you use. This works because GraphQL.js is distributed\nwith both CommonJS (`require()`) and ESModule (`import`) files. Ensure that any\ncustom build configurations look for `.mjs` files!\n\n## Contributing\n\nWe actively welcome pull requests. Learn how to [contribute](./.github/CONTRIBUTING.md).\n\nThis repository is managed by EasyCLA. Project participants must sign the free ([GraphQL Specification Membership agreement](https://preview-spec-membership.graphql.org) before making a contribution. You only need to do this one time, and it can be signed by [individual contributors](http://individual-spec-membership.graphql.org/) or their [employers](http://corporate-spec-membership.graphql.org/).\n\nTo 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.\n\nYou can find [detailed information here](https://github.com/graphql/graphql-wg/tree/main/membership). If you have issues, please email [operations@graphql.org](mailto:operations@graphql.org).\n\nIf 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](https://foundation.graphql.org/join).\n\n## Changelog\n\nChanges are tracked as [GitHub releases](https://github.com/graphql/graphql-js/releases).\n\n## License\n\nGraphQL.js is [MIT-licensed](./LICENSE).\n\n## Version Support\n\nGraphQL.JS follows Semantic Versioning (SemVer) for its releases. Our version support policy is as follows:\n\n- Latest Major Version: We provide full support, including bug fixes and security updates, for the latest major version of GraphQL.JS.\n- Previous Major Version: We offer feature support for the previous major version for 12 months after the release of the newest major version.\n  This means that for 12 months we can backport features for specification changes _if_ they don't cause any breaking changes. We'll continue\n  supporting the previous major version with bug and security fixes.\n- Older Versions: Versions older than the previous major release are considered unsupported. While the code remains available,\n  we do not actively maintain or provide updates for these versions.\n  One exception to this rule is when the older version has been released \u003c 1 year ago, in that case we\n  will treat it like the \"Previous Major Version\".\n\n### Long-Term Support (LTS)\n\nWe do not currently offer a Long-Term Support version of GraphQL.JS. Users are encouraged to upgrade to the latest stable version\nto receive the most up-to-date features, performance improvements, and security updates.\n\n### End-of-Life (EOL) Schedule\n\nWe will announce the EOL date for a major version at least 6 months in advance.\nAfter a version reaches its EOL, it will no longer receive updates, even for critical security issues.\n\n### Upgrade Assistance\n\nTo assist users in upgrading to newer versions:\n\n- We maintain detailed release notes for each version, highlighting new features, breaking changes, and deprecations.\n- [Our documentation](https://www.graphql-js.org/) includes migration guides for moving between major versions.\n- The [community forum (Discord channel #graphql-js)](https://discord.graphql.org) is available for users who need additional assistance with upgrades.\n\n### Security Updates\n\nWe prioritize the security of GraphQL.JS:\n\n- Critical security updates will be applied to both the current and previous major version.\n- For versions that have reached EOL, we strongly recommend upgrading to a supported version to receive security updates.\n\n### Community Contributions\n\nWe welcome community contributions for all versions of GraphQL.JS. However, our maintainers will primarily focus on reviewing\nand merging contributions for supported versions.\n","funding_links":[],"categories":["JavaScript","TypeScript","Libraries","Implementations","语言","Backend frameworks \u0026 libraries","Works in Progress","Back-End Development","Language Implementations","Uncategorized","GraphQL [🔝](#readme)","\u003e 10K ⭐️"],"sub_categories":["JavaScript Libraries","JavaScript/TypeScript","redux 扩展","macros","Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql%2Fgraphql-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphql%2Fgraphql-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql%2Fgraphql-js/lists"}