Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

graphql-code-generator

> 前端框架
Open source

A tool for generating code based on a GraphQL schema and GraphQL operations (query/mutation/subscription), with flexible support for custom plugins.

11.3K stars0 likes2 views
WebsiteGitHub

About

A tool for generating code based on a GraphQL schema and GraphQL operations (query/mutation/subscription), with flexible support for custom plugins.

https://the-guild.dev/graphql/codegen

GraphQL Code Generator is a tool that generates code out of your GraphQL schema. Whether you are developing a frontend or backend, you can utilize GraphQL Code Generator to generate output from your GraphQL Schema and GraphQL Documents (query/mutation/subscription/fragment).

By analyzing the schema and documents and parsing it, GraphQL Code Generator can output code at a wide variety of formats, based on pre-defined templates or based on custom user-defined ones. Regardless of the language that you're using, GraphQL Code Generator has you covered.

GraphQL Code Generator lets you choose the output that you need, based on plugins, which are very flexible and customizable. You can also write your plugins to generate custom outputs that match your needs.

You can try this tool live on your browser and see some useful examples. Check out GraphQL Code Generator Live Examples.

We currently support and maintain these plugins (TypeScript, Flow, React, Angular, MongoDB, Stencil, Reason, and some more), and there is an active community that writes and maintains custom plugins.

Quick Start

You can find the complete instructions in GraphQL Code Generator website.

Start by installing the basic deps of GraphQL Codegen:

bash
pnpm add graphql
pnpm add -D @graphql-codegen/cli

GraphQL Code Generator lets you setup everything by simply running the following command:

bash
pnpm graphql-codegen init

Question by question, it will guide you through the whole process of setting up a schema, selecting plugins, picking a destination of a generated file, and a lot more.

If you wish to manually setup codegen, follow these instructions.

Links

Besides our docs page, feel free to go through our published Medium articles to get a better grasp of what GraphQL Code Generator is all about:

  • All available plugins & presets

Contributing

If this is your first time contributing to this project, please do read our Contributor Workflow Guide before you get started off.

Feel free to open issues and pull requests. We're always welcome support from the community.

For a contribution guide specific to this project, please refer to: http://the-guild.dev/graphql/codegen/docs/custom-codegen/contributing.

Code of Conduct

Help us keep GraphQL Code Generator open and inclusive. Please read and follow our Code of Conduct as adopted from Contributor Covenant

License

MIT

Issues· 469 open

View all issuesOpen on GitHub
  • #7295

    Support allowEnumStringTypes in typescript-operations

    coreUpdated Sep 25, 2026
  • #6803

    Codegen watch skip first run

    coreUpdated Sep 25, 2026
  • #6565

    Dependency Dashboard

    coreUpdated Sep 24, 2026
  • #10873

    Enable pure string creation with documentMode:string in v7

    Updated Sep 24, 2026
  • #10292

    [typescript-operations] generate additional type that contains all operations

    Updated Sep 20, 2026
  • #9446

    Introduce `omitFields` option for typescript plugin

    Updated Sep 20, 2026
  • #10922

    `typescript-operations` emits an unused schema-types import when fragment types are referenced

    Updated Sep 17, 2026
  • #10940

    Out of memory generating types with `near-operation-file` + `typescript-operations`

    Updated Sep 16, 2026
  • #10943

    RFC: Sequential Execution & Output Hand-off Between GraphQL Codegen Plugins/Presets

    Updated Sep 12, 2026
  • #10933

    build_runner can't compile its build script because Amplify pulls in native-asset/"build hooks" packages (sqlite3/jni)

    Updated Sep 6, 2026

> Tags

TypeScriptandroidangularcode-generatorcodegen

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 28, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架