Skip to content

toheart/go-react-openspec-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

create-go-react-app

Go + React 全栈项目脚手架 CLI,集成 DDD 分层架构、OpenSpec 规范驱动和 AI Pipeline 编排。

使用方式

首次使用前,配置 GitHub Packages registry(一次性操作):

npm config set @toheart:registry https://npm.pkg.github.com

然后创建项目:

npx @toheart/create-go-react-app my-project
cd my-project
make dev

交互式 CLI 会引导你完成:

  1. 项目名称 + Go module 路径(2 个必填项)
  2. AI IDE 选择(Cursor / Claude Code / Codex)
  3. 流水线模板(全栈 / 纯后端 / 热修复)

其余配置自动推导,一步到位。

生成的项目包含

  • Go 后端:Cobra CLI + Gin HTTP + Viper 配置 + log/slog 日志,DDD 四层分层
  • React 前端:TypeScript + Vite,共享 API Service 层
  • OpenSpec:4 套工程规范(Go Style / TS Style / API Conventions / Testing),context 自动注入
  • AI Pipeline:YAML 流水线模板 + IDE 编排文件自动生成
  • CI/CD:GitHub Actions 流水线
  • 容器化:Dockerfile + docker-compose

生成的项目结构

my-project/
├── Makefile                          # make dev / check
├── docker-compose.yml
├── backend/
│   ├── Dockerfile
│   ├── Makefile
│   ├── cmd/                          # Cobra 入口
│   ├── conf/                         # Viper 配置
│   ├── etc/                          # YAML 配置文件
│   └── internal/
│       ├── domain/sample/            # 领域层
│       ├── application/sample/       # 应用层
│       ├── infrastructure/storage/   # 基础设施层
│       ├── interfaces/http/          # 接口层
│       ├── logging/
│       └── wire/                     # 依赖注入
├── frontend/
│   ├── Dockerfile
│   ├── src/
│   │   ├── components/
│   │   ├── hooks/
│   │   ├── services/                 # API 调用层
│   │   └── types/
│   └── vite.config.ts
├── openspec/
│   ├── config.yaml                   # 项目上下文(init 自动注入)
│   ├── specs/                        # 工程规范
│   └── changes/_example/             # 格式示例
└── .github/workflows/ci.yml

Pipeline Templates

Template Stages
go-react-fullstack propose → test-design → review → Gate → implement(BE∥FE) → code-review → Gate → test → Gate → archive
backend-only propose → review → Gate → implement → code-review → Gate → test → archive
hotfix implement → code-review → Gate → test → archive

开发此 CLI

# 克隆仓库
git clone https://github.com/toheart/go-react-openspec-starter.git
cd go-react-openspec-starter

# 安装依赖
cd create-app && npm install && cd ..

# 本地测试
make dev          # 创建 test-project/ 进行测试

# 发布(打 tag 后 GitHub Actions 自动发布到 GitHub Packages)
git tag v1.0.0
git push origin v1.0.0

License

MIT

About

AI全栈开发模板仓库。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors