graphql-code-generator
11,267
Stars
1,408
Forks
72
Watchers
467
Open Issues
MIT
许可证
TypeScript
语言
2016-12-05
创建时间
2026-11-10
最近更新
项目能做什么
基于 GraphQL schema 与操作的代码生成工具,灵活支持自定义插件。
来源:AI 基于仓库事实生成
· 内容以仓库实际 README 为准
使用说明 查看原始 README 原仓库文档
中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
<div>
<img src="./logo.svg" width="150px" alt="GraphQL Code Generator logo"/>
<a href="https://the-guild.dev">
<img align="right" src="https://the-guild-org.github.io/press-kit/full-dark-logo.svg" alt="Created by The Guild" style="width: 100px;align:right;"/>
</a>
</div>
[](https://badge.fury.io/js/%40graphql-codegen%2Fcli)
[https://the-guild.dev/graphql/codegen](https://the-guild.dev/graphql/codegen)
GraphQL Code Generator is a tool that generates code out of your GraphQL schema. Whether you are
developing a frontend or backend, you can utilize GraphQL Code Generator to generate output from
your GraphQL Schema and GraphQL Documents (query/mutation/subscription/fragment).
By analyzing the schema and documents and parsing it, GraphQL Code Generator can output code at a
wide variety of formats, based on pre-defined templates or based on custom user-defined ones.
Regardless of the language that you're using, GraphQL Code Generator has you covered.
GraphQL Code Generator lets you choose the output that you need, based on _plugins_, which are very
flexible and customizable. You can also write your _plugins_ to generate custom outputs that match
your needs.
You can try this tool live on your browser and see some useful examples. Check out
[GraphQL Code Generator Live Examples](https://the-guild.dev/graphql/codegen/#live-demo).
We currently support and maintain [these plugins](https://the-guild.dev/graphql/codegen/plugins)
(TypeScript, Flow, React, Angular, MongoDB, Stencil, Reason, and some more), and there is an active
community that writes and maintains custom plugins.
## Quick Start
> You can find the complete instructions in
> [GraphQL Code Generator website](https://the-guild.dev/graphql/codegen/docs/getting-started/installation).
Start by installing the basic deps of GraphQL Codegen:
```bash
pnpm add graphql
pnpm add -D @graphql-codegen/cli
```
GraphQL Code Generator lets you setup everything by simply running the following command:
```bash
pnpm graphql-codegen init
```
Question by question, it will guide you through the whole process of setting up a schema, selecting
plugins, picking a destination of a generated file, and a lot more.
If you wish to
[manually setup codegen, follow these instructions](https://the-guild.dev/graphql/codegen/docs/getting-started/installation).
## Links
Besides our [docs page](https://the-guild.dev/graphql/codegen/docs/getting-started), feel free to go
through our published Medium articles to get a better grasp of what GraphQL Code Generator is all
about:
- [All available plugins & presets](https://the-guild.dev/graphql/codegen/plugins)
## Contributing
If this is your first time contributing to this project, please do read our
[Contributor Workflow Guide](https://github.com/the-guild-org/Stack/blob/master/CONTRIBUTING.md)
before you get started off.
Feel free to open issues and pull requests. We're always welc
阅读完整原文
商业机会分析 AI 生成
GraphQL Codegen CI 远程缓存与增量加速 SaaS
| 产品构想 | 针对超大型 Schema 或复杂 Monorepo 项目,构建云端远程哈希缓存与增量生成服务,显著降低 CI 构建与本地冷启动时间。 |
| 核心功能 | Schema 与 Operations 哈希指纹匹配、构建产物云端远程缓存、增量生成调度器、CI 性能消耗分析看板。 |
| 目标用户 | 大型 Monorepo 维护团队、CI/CD 耗时严重的研发组织。 |
| 难度/周期 | 中等 · 2-3 个月 · 成本:极低(主要是服务器与存储成本) |
| 收费模式 | 免费额度 + 按月按并发/构建时长阶梯订阅(SaaS)。 |
| 竞争风险 | 主流前端构建缓存方案(如 Turborepo/Nx)可能侵蚀该场景;技术护城河较浅。 |
| 依据 | 数据支持的判断 |
Schema 变更客户端代码断言与破损检测 CI Bot
| 产品构想 | 结合代码生成上下文,在后端 Schema 提交 PR 时,精准定位该变更破坏了前端哪些页面的 Query/Mutation,并自动评估影响范围与提出修复建议。 |
| 核心功能 | GitHub/GitLab PR 机器人、Breaking Change 代码级调用链分析、影响组件统计报告、自动代码重构建议 PR。 |
| 目标用户 | 全栈团队、跨部门前后端协作团队、技术架构师。 |
| 难度/周期 | 中等偏高 · 3-4 个月 · 成本:低(基础云资源及 GitHub App 基础设施) |
| 收费模式 | 按团队席位或受保护仓库数量收取月费/年费。 |
| 竞争风险 | 已有 Apollo GraphOS 或 GraphQL Hive 提供部分 Schema Registry 检查功能,需强化针对具体客户端代码行的差异化价值。 |
| 依据 | AI推测 |
企业级 GraphQL 插件中心与私有化代码规范工作台
| 产品构想 | 提供可视化的企业内部 Codegen 插件开发、调试、测试、版本分发平台,统一团队内部数据流规范(如统一生成 React Query/RTK Query 包装层)。 |
| 核心功能 | 在线 AST 与插件调试环境、私有插件注册表、多语言代码生成模板合规检查、跨项目统一配置下发。 |
| 目标用户 | 企业内部基础架构团队、技术平台部、大型系统维护者。 |
| 难度/周期 | 高 · 4-6 个月 · 成本:中等(需维护多环境沙箱与多语言执行容器) |
| 收费模式 | 企业私有化部署授权费、企业高级技术支持与定制订阅。 |
| 竞争风险 | 目标客群决策周期长;企业更倾向于在内部自建简单的 npm 包进行规范下发。 |
| 依据 | 尚需验证的假设 |
AI 基于仓库公开数据分析生成,含推测成分,不构成收益承诺。
报告会保存到 个人中心
竞品与相似项目 GitHub Search 真实检索
| 项目 | 中文简介 | Stars | 语言 |
|---|---|---|---|
| morluto/rea | 中文介绍暂未生成 Reverse engineer anything with agents, from app behavior dow |
449,569 | TypeScript |
| flutter/flutter | 中文介绍暂未生成 Flutter makes it easy and fast to build beautiful apps for m |
181,109 | Dart |
| Genymobile/scrcpy | 中文介绍暂未生成 Display and control your Android device |
154,505 | C |
| rustdesk/rustdesk | 中文介绍暂未生成 An open-source remote desktop application designed for self- |
128,915 | Rust |
| react/react-native | 中文介绍暂未生成 A framework for building native applications using React |
126,896 | C++ |
| Hack-with-Github/Awesome-Hacking | 中文介绍暂未生成 A collection of various awesome lists for hackers, pentester |
125,179 | - |
以上为通过 GitHub 官方 Search API 检索的相似项目,功能差异与优劣势需进一步人工确认,配置 AI 后可生成对比分析。
项目优势与风险
| 技术成熟度 | 创建于 2016-12-05,近 30 天仍在推送,发布过 100 个 Release |
| 社区活跃 | Star 11,267 / Fork 1,408 / Issue 467(数据支持,可自行核实) |
| 许可证 | MIT |
| 主要风险 | 上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价 |
安装与使用
快速开始(以仓库 README 为准)
git clone https://github.com/dotansimha/graphql-code-generator.git cd graphql-code-generator # 请阅读仓库 README 获取确切安装步骤(依赖、配置、启动命令)
术语说明:Docker=应用容器(把程序和依赖打包运行);API Key=调用外部服务的密钥;Git Clone=把仓库代码下载到本地。常见错误:API Key 未配置 / 端口占用 / 数据库连接失败,多数项目在 README 的 Troubleshooting 章节有说明。