-
Notifications
You must be signed in to change notification settings - Fork 9
Development
ZZzzswszzZZ edited this page Apr 16, 2026
·
1 revision
- Node.js >= 18
- npm
# 安装依赖
npm install
cd frontend && npm install && cd ..
# 配置环境
cp .env.example .envnpm run dev # 开发模式(热重载)
npm run build # TypeScript 编译
npm test # 全部测试
npm run test:watch # 监听模式
npx vitest run tests/auth.test.ts # 单个测试文件cd frontend
npm run dev # 开发模式,自动代理 /admin/api → :3000
npm run build # 生产构建前后端需分别启动,开发时 Vite 自动将 /admin/api 请求代理到后端 :3000。
src/
index.ts # 入口,buildApp()
proxy/ # 代理插件(openai.ts / anthropic.ts)
middleware/ # 认证中间件
admin/ # 管理 API(routes / services / mappings / logs / stats)
db/ # 数据库(better-sqlite3 + 迁移)
utils/ # 工具函数(加密等)
frontend/
src/
api/ # API 客户端
views/ # 页面组件
components/ # UI 组件(shadcn-vue)
router/ # 路由配置
使用 Vitest,通过 buildApp({ db: inMemoryDb }) 注入内存数据库,无需 mock 外部依赖。