// the find
dotansimha/graphql-code-generator
A tool for generating code based on a GraphQL schema and GraphQL operations (query/mutation/subscription), with flexible support for custom plugins.
GraphQL Code Generator takes your GraphQL schema and operation documents and outputs typed code — TypeScript interfaces, React hooks, resolver types, MongoDB models, and more. It's been the standard tool for this problem in the JS/TS ecosystem for years, maintained by The Guild. If you're writing GraphQL and not using something like this, you're writing types by hand.
The plugin architecture is genuinely well-designed — you can chain plugins and presets, and writing a custom plugin is straightforward if the built-ins don't cover your use case. The client-preset with fragment masking is a real improvement over the older approach: it pushes you toward co-located fragments and prevents components from accidentally depending on data they don't own. TypedDocumentNode support means your queries carry their result type at the call site, which eliminates a whole class of cast mistakes. The project is actively maintained with a proper changeset-based release process and a test corpus large enough to catch regressions.
Configuration sprawl is a real problem — the codegen.yml or codegen.ts file grows teeth fast once you have multiple schemas, multiple outputs, and per-plugin options, and debugging why a particular option isn't taking effect is painful. The watch mode is fragile; on large projects it frequently either misses changes or triggers unnecessary regeneration. Non-TypeScript targets (Java, C#, Android) exist but feel like second-class citizens — the TypeScript plugins are well-tested and current, while the others lag. The generated output for complex schemas with lots of fragments and unions gets large enough to meaningfully slow TypeScript compilation, and there's no good mitigation story beyond 'generate less'.