GraphQL Code Generator

A plugin-based CLI that generates typed code from a GraphQL schema and operations

Tool
npm
v7.4.6
11,262 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
93 /100 Excellent
Development Activity 100
Maintenance 96
Community 76
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
76 /100 Good
Architecture 80
Code Quality 82
Innovation 75
Learning Curve 65

GraphQL Code Generator is a CLI tool, maintained by The Guild, that parses a GraphQL schema and your queries/mutations/subscriptions and emits generated code — TypeScript types, typed React hooks, resolver signatures, and more — through a large ecosystem of official and community plugins. Rather than hand-writing types that drift out of sync with the schema, teams run graphql-codegen (via a config file or the interactive init wizard) as part of their build or watch loop to keep frontend and backend code type-safe against the actual GraphQL contract.

What You Get

  • A graphql-codegen CLI with an interactive init wizard that scaffolds a working codegen config for your stack
  • A large official plugin catalog (TypeScript, TypeScript Operations, React Apollo, urql, Vue Apollo, resolvers, and more) plus support for custom plugins
  • Watch mode that regenerates output automatically as your schema or documents change
  • Presets (e.g. near-operation-file, client) for organizing generated output alongside source files

Common Use Cases

  • Generating TypeScript types for a GraphQL schema and operations so frontend code fails to compile on schema drift
  • Producing typed React/Vue/Angular hooks bound directly to specific GraphQL queries and mutations
  • Generating typed resolver signatures for a GraphQL server to keep backend implementations in sync with the schema
  • Running codegen as a watch-mode step in local development so generated types stay current with every schema edit

Under The Hood

Architecture - The CLI’s src/bin.ts entry point delegates to cli.ts, which parses flags and hands off to codegen.ts (598 lines) — the orchestration core that loads config via config.ts (568 lines, using cosmiconfig and graphql-config.ts), loads the schema/documents through @graphql-tools loaders (file, git, GitHub, URL), resolves the requested plugins via plugins.ts/presets.ts, and hands the assembled context to @graphql-codegen/core for the actual generation pass, with generate-and-save.ts and hooks.ts handling output writing and lifecycle hooks (beforeAllFileWrite, etc.); documentTransforms.ts applies pre-generation transforms like @babel/generator-based document rewriting. Tech Stack - A pnpm-workspace TypeScript monorepo built with modern tooling (Vitest, ESLint flat config, Prettier), where the CLI package itself depends on @graphql-codegen/core, @graphql-codegen/client-preset, @graphql-codegen/plugin-helpers, the @graphql-tools loader family, @inquirer/prompts for the init wizard, cosmiconfig for config discovery, and chalk for terminal output. Code Quality - The CLI package has a dedicated tests/ directory with Vitest specs covering config loading, CLI flags, the init wizard, watch-mode behavior, and end-to-end generate-and-save flows, reflecting the broader monorepo’s very active development and maintenance-consistency scores from GitHub activity data. API Design - The graphql-codegen init wizard walks new users through schema location, target plugins, and output paths in one interactive flow, while advanced users configure everything declaratively via a codegen.yml/codegen.ts config file discovered through cosmiconfig, giving both a low-friction onboarding path and a fully scriptable, CI-friendly configuration surface.

Used by 48 apps in this directory

TypeScript
40%
AGPL 3.0

BrowserOS

AI Assistants · Browser

14,082

The open-source agentic Chromium browser with native AI agents, MCP server, and visual workflow automation — your data never leaves your machine.

View details
87
Repo Health
82
Technical
67
Dependency
Built with
TypeScript 40%
Rust 34%
Python 16%
Updated 5 days ago
Java
70%
Other

ByteChef

AI Agents · Automation

1,045

Unified open-source platform for AI agent orchestration and workflow automation with 180+ connectors, MCP support, and durable execution.

View details
86
Repo Health
82
Technical
66
Dependency
Built with
Java 70%
TypeScript 29%
Updated 6 days ago
Java
70%
Other

ByteChef

AI Agents · Automation

1,045

Unified open-source platform for AI agent orchestration and workflow automation with 180+ connectors, MCP support, and durable execution.

View details
86
Repo Health
82
Technical
66
Dependency
Built with
Java 70%
TypeScript 29%
Updated 6 days ago
Java
70%
Other

ByteChef

AI Agents · Automation

1,045

Unified open-source platform for AI agent orchestration and workflow automation with 180+ connectors, MCP support, and durable execution.

View details
86
Repo Health
82
Technical
66
Dependency
Built with
Java 70%
TypeScript 29%
Updated 6 days ago
TypeScript
96%
Other

Cal.diy

Scheduling

49,266

The 100% MIT-licensed, community-driven scheduling platform — self-host your own booking infrastructure with no enterprise strings attached.

View details
88
Repo Health
86
Technical
64
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago
JavaScript
90%
Other

CodeSandbox

Code Editors · Developer Tools

13,652

Instantly ready browser-based IDE that runs full npm dependency resolution and transpilation entirely client-side, with no server needed.

View details
67
Repo Health
76
Technical
63
Dependency
Built with
JavaScript 90%
Updated 1 weeks ago
JavaScript
90%
Other

CodeSandbox

Code Editors · Developer Tools

13,652

Instantly ready browser-based IDE that runs full npm dependency resolution and transpilation entirely client-side, with no server needed.

View details
67
Repo Health
76
Technical
63
Dependency
Built with
JavaScript 90%
Updated 1 weeks ago
JavaScript
90%
Other

CodeSandbox

Code Editors · Developer Tools

13,652

Instantly ready browser-based IDE that runs full npm dependency resolution and transpilation entirely client-side, with no server needed.

View details
67
Repo Health
76
Technical
63
Dependency
Built with
JavaScript 90%
Updated 1 weeks ago
TypeScript
71%
Other

highlight.io

Analytics · Developer Tools · Monitoring

9,384

Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.

View details
76
Repo Health
78
Technical
65
Dependency
Built with
TypeScript 71%
Go 16%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers