GraphQL Code Generator is a CLI tool that can generate TypeScript typings out of a GraphQL schema. When we develop a GraphQL backend, there would be many instances where we would find ourselves writing the same things which are already described by the GraphQL schema, only in a different format; for example: resolver signatures, MongoDB models, Angular services etc.
GraphQL Code Generator was built to address exactly that. By analyzing the schema and parsing it, GraphQL Code Generator can output code at a wide variety of formats, based on pre-defined plugins or based on custom user-defined ones. Regardless of the language that you're using, GraphQL Code Generator got you covered.
For example, given the following schema:
GraphQL Code Generator can generate the following TypeScript typings (this example is using
Start by installing GraphQL Code Generator in your project, and use the basic plugins to generate some code.
You can go over the list of available plugins and find more plugins that matches your needs.
If you are having issues, you can reach us this the following:
- Found a bug? report it in your GitHub repo
- Need help or have a question? You can use the live chat box in the corner of the screen, ask it in our GitHub Discussions page or reach us directly in our Discord.
- We have more awesome open source tools!
- You can visit our website for more information about us and what we do