Skip to content

开发环境配置

本文档为希望参与 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 --release

macOS 本地构建

对于 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);

贡献指南

  1. Fork 仓库:在 GitHub 上 Fork 项目
  2. 创建分支git checkout -b feature/your-feature
  3. 提交更改:遵循 Conventional Commits 规范
  4. 推送分支git push origin feature/your-feature
  5. 创建 PR:在 GitHub 上创建 Pull Request

提交规范

feat: 添加新功能
fix: 修复 bug
docs: 更新文档
style: 代码格式调整
refactor: 重构代码
test: 添加测试
chore: 构建/工具变更

社区资源

  • GitHub Discussions:功能请求和讨论
  • GitHub Issues:Bug 报告
  • Discord:社区交流

下一步

aicodex 文档网站