
GraphQL Code Generator
Generates code from your GraphQL schema and queries, using plugins you choose.
- Stars
- 11.3k
- Forks
- 1.4k
- Licence
- MIT
- Language
- TypeScript
- Last update
- 4 days ago
- Type
- Dev tool
What it is
GraphQL Code Generator reads your GraphQL schema and the GraphQL queries, mutations, and subscriptions your app uses, then writes code from them in the format you pick. Output is controlled by plugins, and you can write your own plugins for custom output. It is aimed at both frontend and backend developers.
- Generate TypeScript types from a GraphQL schema
- Generate typed code for queries and mutations used by your frontend
- Run the interactive init command to set up a config file step by step
- Write a custom plugin to generate output your project needs
Great for
- Frontend developers who want typed code for GraphQL queries
- Backend teams who want code generated from their schema
- Teams using TypeScript, React, or Angular with GraphQL
- Developers who need custom output formats via their own plugins
Not ideal for
- People who do not use GraphQL, since the tool only works from a GraphQL schema
- Projects that need a fully turnkey app, because it only generates code and does not build the app for you
How to get it
- 1
Install with a package manager
You'll need: Node.js · pnpm
Install GraphQL peer dependency
pnpm add graphqlInstall the CLI as a dev dependency
pnpm add -D @graphql-codegen/cliRun the interactive setup
pnpm graphql-codegen init - 2
Run it
- Install graphql and @graphql-codegen/cli with pnpm
- Run pnpm graphql-codegen init and answer the questions about schema, plugins, and output file
- Run the generator using the config created by init
- 3
Get the most out of it
- Use the interactive init command to create a starting config
- Browse the official plugins list to pick output formats for your stack
- Try the live demo in the browser to see example output before installing
Downloads
Strengths
- Flexible plugin system, with both maintained plugins and community ones
- Works with many languages and frameworks, as listed in the README
- Has an interactive setup command (init) that guides you through configuration
Trade-offs
- Setup involves choosing plugins and config, which can take some learning
- The README is truncated here, so detailed plugin options are not covered in this entry
- Release has no downloadable binaries; it is installed as an npm package
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| graphql-code-generator (this) | 11.3k | Dev tool | intermediate | 4 days ago | Frontend developers who want typed code for GraphQL queries |
| 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 |
| NativeScript | 25.7k | Framework | intermediate | 4 days ago | JavaScript or TypeScript developers who want to build native iOS or Android apps |
| gqlgen | 10.8k | Library | intermediate | 8 days ago | Go developers building a new GraphQL API |
| storybook | 91.4k | Dev tool | intermediate | 4 days ago | Frontend teams building a shared component library or design system |
| mitosis | 14.5k | Dev tool | intermediate | 8 days ago | Teams maintaining the same UI components across more than one framework |
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.