GraphQL Code Generator

Code generation tool for GraphQL schemas and operations. Given a GraphQL schema and .graphql operation files, generates TypeScript types, React hooks (Apollo, urql, React Query), Kotlin data classes, Java code, and more. Eliminates manual type maintenance for GraphQL APIs — types always match the schema. Used widely with Apollo Client, urql, and any GraphQL-first TypeScript frontend.

Evaluated Mar 06, 2026 (0d ago) v5.x
Homepage ↗ Repo ↗ Developer Tools graphql typescript codegen type-safe react operations schema the-guild
⚙ Agent Friendliness
65
/ 100
Can an agent use this?
🔒 Security
83
/ 100
Is it safe for agents?
⚡ Reliability
82
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
85
Error Messages
82
Auth Simplicity
88
Rate Limits
95

🔒 Security

TLS Enforcement
90
Auth Strength
82
Scope Granularity
78
Dep. Hygiene
85
Secret Handling
82

Build tool — minimal security surface. Schema introspection from authenticated endpoints needs secure headers handling in CI. The Guild maintains actively.

⚡ Reliability

Uptime/SLA
86
Version Stability
82
Breaking Changes
75
Error Recovery
85
AF Security Reliability

Best When

You're building a TypeScript frontend or backend that calls a GraphQL API and want compile-time type safety that matches the actual schema.

Avoid When

You're using REST APIs or don't have TypeScript — graphql-codegen's value is type generation for TypeScript consumers of GraphQL schemas.

Use Cases

  • Generate TypeScript types and React hooks automatically from GraphQL schema for type-safe agent frontend data fetching
  • Generate Kotlin data classes from GraphQL schema for Android agents using Kotlin codegen plugin
  • Run codegen in CI/CD to catch schema drift — if the API schema changes and agent queries are now invalid, codegen fails the build
  • Generate typed GraphQL operation hooks for agent dashboards with zero manually maintained types
  • Use the 'client-preset' to generate co-located .gql.ts files with typed document nodes and result types for each operation

Not For

  • REST APIs — graphql-codegen is GraphQL-only; use openapi-typescript for REST API type generation
  • Runtime code — graphql-codegen is a build-time tool; generated types are consumed at development time and compiled away
  • Simple GraphQL queries without TypeScript — the overhead of codegen is not worth it for JavaScript without type checking

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: api_key bearer_token
OAuth: No Scopes: No

Build tool — auth only needed to fetch remote schemas. Schema can be fetched via introspection from authenticated GraphQL endpoints with headers config.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

The Guild open source project. MIT license.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • graphql-codegen requires operations to be in .graphql files or tagged template literals — inline strings are not processed; queries must be extracted to files or use gql tag
  • The client-preset generates co-located types; other presets require different plugin combinations — mixing presets without understanding plugin interactions creates duplicate or conflicting types
  • Schema fetching from authenticated endpoints requires adding headers in codegen.ts schema config — forgetting headers causes introspection to fail with authentication errors
  • Codegen generates code on every build if run in watch mode — avoid running codegen in production builds; use --config flag to separate dev and prod codegen configs
  • Fragment co-location requires fragmentMasking enabled in client-preset — without it, fragments are merged into operation types and fragment reuse loses type narrowing benefits
  • TypeScript strict mode may produce errors in generated code from older plugin versions — pin plugin versions and check generated code compatibility when upgrading graphql-codegen

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for GraphQL Code Generator.

$99

Scores are editorial opinions as of 2026-03-06.

5208
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered