主题
开发环境配置
本文档为希望参与 Vibe Kanban 开发或自定义构建的开发者提供环境配置指南。
开发环境要求
必需工具
| 工具 | 版本要求 | 用途 |
|---|---|---|
| Rust | 最新稳定版 | 后端开发 |
| Node.js | ≥18 | 前端开发 |
| pnpm | ≥8 | 包管理 |
| cargo-watch | 最新版 | 开发热重载 |
| sqlx-cli | 最新版 | 数据库管理 |
安装开发工具
bash
# 安装 Rust(使用 rustup)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# 安装 cargo-watch
cargo install cargo-watch
# 安装 sqlx-cli
cargo install sqlx-cli
# 安装 pnpm(如果尚未安装)
npm install -g pnpm项目设置
克隆仓库
bash
git clone https://github.com/BloopAI/vibe-kanban.git
cd vibe-kanban安装依赖
bash
# 安装所有依赖
pnpm install数据库初始化
Vibe Kanban 使用 SQLite 作为本地数据库:
bash
# 创建数据库并运行迁移
sqlx database create
sqlx migrate run启动开发服务器
后端开发服务器
bash
# 启动后端(带数据库初始化)
pnpm run dev这将启动一个带有预填充数据的后端开发服务器。
前端开发
bash
# 进入前端目录
cd frontend
# 安装前端依赖
pnpm install
# 启动前端开发服务器
pnpm run dev完整开发环境
在两个终端中分别运行:
bash
# 终端 1:后端
pnpm run dev
# 终端 2:前端
cd frontend && pnpm run dev构建项目
前端构建
bash
cd frontend
pnpm build后端构建
bash
cargo build --releasemacOS 本地构建
对于 macOS 用户,可以使用提供的构建脚本:
bash
./local-build.sh项目结构
vibe-kanban/
├── src/ # Rust 后端源码
│ ├── main.rs # 入口文件
│ ├── api/ # API 路由
│ ├── models/ # 数据模型
│ └── services/ # 业务逻辑
├── frontend/ # TypeScript 前端
│ ├── src/
│ │ ├── components/ # React 组件
│ │ ├── pages/ # 页面组件
│ │ └── styles/ # CSS 样式
│ ├── package.json
│ └── vite.config.ts
├── migrations/ # 数据库迁移
├── Cargo.toml # Rust 依赖配置
├── package.json # 项目脚本
└── local-build.sh # macOS 构建脚本开发工作流
代码热重载
后端使用 cargo-watch 实现热重载:
bash
cargo watch -x run前端使用 Vite 的 HMR(热模块替换):
bash
cd frontend && pnpm run dev运行测试
bash
# 后端测试
cargo test
# 前端测试
cd frontend && pnpm test代码格式化
bash
# Rust 代码格式化
cargo fmt
# 前端代码格式化
cd frontend && pnpm run format代码检查
bash
# Rust lint
cargo clippy
# 前端 lint
cd frontend && pnpm run lint调试技巧
后端调试
使用 RUST_LOG 环境变量控制日志级别:
bash
RUST_LOG=debug cargo run前端调试
使用浏览器开发者工具,或在代码中添加调试语句:
typescript
console.debug('Debug info:', data);贡献指南
- Fork 仓库:在 GitHub 上 Fork 项目
- 创建分支:
git checkout -b feature/your-feature - 提交更改:遵循 Conventional Commits 规范
- 推送分支:
git push origin feature/your-feature - 创建 PR:在 GitHub 上创建 Pull Request
提交规范
feat: 添加新功能
fix: 修复 bug
docs: 更新文档
style: 代码格式调整
refactor: 重构代码
test: 添加测试
chore: 构建/工具变更社区资源
- GitHub Discussions:功能请求和讨论
- GitHub Issues:Bug 报告
- Discord:社区交流