# macOS / Linux
tar -xzf docspace-source.tar.gz -C docspace && cd docspace
# Windows(PowerShell)——使用 7-Zip 或右键解压 tar.gz需要 Node.js 20+ 和 Bun(推荐)或 npm/pnpm:
# 推荐:使用 Bun(与开发环境一致)
curl -fsSL https://bun.sh/install | bash
bun install
# 或使用 npm
npm install
# 或使用 pnpm
pnpm install项目已带 .env:
DATABASE_URL=file:/home/z/my-project/db/custom.db
本地使用时改为相对路径即可:
# .env
DATABASE_URL=file:./db/custom.dbbun run db:push # 创建 SQLite 数据库 + 8 张表
# 或
npx prisma db pushbun run dev # http://localhost:3000
# 或
npm run dev打开 http://localhost:3000 后,在登录页点击 「一键载入演示数据并登录」 按钮,或调用:
curl -X POST http://localhost:3000/api/seed演示账号:docspace / docspace123
docspace/
├── prisma/schema.prisma # 8 张 3NF 表 (User/Workspace/FileNode/...)
├── src/
│ ├── app/
│ │ ├── api/ # 21 个 API 路由文件
│ │ │ ├── auth/ # register/login/logout/me
│ │ │ ├── workspaces/[id]/ # 文件/问题/里程碑/成员/统计
│ │ │ └── seed/ # 一键演示数据
│ │ ├── layout.tsx
│ │ └── page.tsx # 单页应用入口
│ ├── components/
│ │ ├── app/ # 业务组件 (auth/dashboard/workspace-view)
│ │ │ ├── tabs/ # 5个标签页 (概览/文件/问题/时间线/成员)
│ │ │ └── files/ # 版本历史对话框
│ │ └── ui/ # shadcn/ui 组件库
│ └── lib/
│ ├── auth.ts # JWT cookie 会话 + RBAC
│ ├── storage.ts # 本地对象存储 (MD5+UUID 路径)
│ ├── db.ts # Prisma Client
│ ├── store.ts # Zustand 状态
│ ├── api-client.ts # fetch 封装
│ └── types.ts # 类型定义
├── package.json
└── tailwind.config.ts
- Next.js 16 (App Router) + TypeScript 5
- Prisma + SQLite -Tailwind CSS 4 + shadcn/ui -TanStack Query + Zustand -bcryptjs + jose (JWT)
| 命令 | 作用 |
|---|---|
bun run dev |
启动开发服务器 (端口 3000) |
bun run lint |
ESLint 代码检查 |
bun run db:push |
同步 Prisma schema 到数据库 |
bun run db:generate |
重新生成 Prisma Client |
bun run db:reset |
重置数据库 (慎用) |