GraphQL Code Generator
A plugin-based CLI that generates typed code from a GraphQL schema and operations
Repository Health
Technical Analysis
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-codegenCLI with an interactiveinitwizard 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 19 apps in this directory
AFFiNE
Productivity · Project Management · Note Taking
Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.
Amplication
Developer Tools · AI Code Assistants · Automation
Create production-ready backend services with your organization's standards baked in — generating NestJS, Prisma, and GraphQL code that you own and control.
Authgear
Authentication
Open-source, self-hostable authentication platform with passkeys, biometric login, SSO, MFA, and GraphQL admin API — a full Auth0/Clerk/Firebase alternative for SaaS and mobile apps.
BrowserOS
Browser · AI Assistants
The open-source agentic Chromium browser with native AI agents, MCP server, and visual workflow automation — your data never leaves your machine.
ByteChef
Automation · AI Agents
Unified open-source platform for AI agent orchestration and workflow automation with 180+ connectors, MCP support, and durable execution.
Cal.diy
Scheduling
The 100% MIT-licensed, community-driven scheduling platform — self-host your own booking infrastructure with no enterprise strings attached.
CodeSandbox
Code Editors · Developer Tools
Instantly ready browser-based IDE that runs full npm dependency resolution and transpilation entirely client-side, with no server needed.
highlight.io
Developer Tools · Analytics · Monitoring
Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.
GraphQL Hive
Developer Tools · Devops · Monitoring
Open-source GraphQL schema registry and observability platform with breaking change detection, federation support, and CI/CD integration for teams of any size.