# ob-project **Repository Path**: dou-zilong/ob-project ## Basic Information - **Project Name**: ob-project - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-03-20 - **Last Updated**: 2026-03-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: solid ## README # OB 项目文档 ## 项目概述 这是一个前后端分离的图书管理系统,包含: - **前端 (ob-client)**: 基于 SolidStart 框架的企业级前端应用 - **后端 (ob-server)**: 基于 NestJS 的 RESTful API 服务 --- ## 技术栈 ### 前端 (ob-client) - **框架**: SolidStart (Solid.js 服务端渲染框架) - **语言**: TypeScript - **样式**: TailwindCSS v4 + DaisyUI v5 - **图标**: Lucide-Solid - **HTTP客户端**: Axios - **构建工具**: Vinxi ### 后端 (ob-server) - **框架**: NestJS - **语言**: TypeScript - **数据库**: MySQL (TypeORM) - **缓存**: Redis - **认证**: JWT + Passport - **邮件服务**: NodeMailer - **WebSocket**: Socket.io --- ## 环境要求 - **Node.js**: >= 22 - **MySQL**: 需要本地或远程 MySQL 服务 - **Redis**: 需要本地或远程 Redis 服务 --- ## 项目目录结构 ``` d:\Users\ceshi/ ├── ob-client/ # 前端项目 │ ├── public/ # 静态资源 │ ├── src/ │ │ ├── actions/ # RPC 服务端 Action │ │ │ ├── (auth)/ # 认证相关 Action │ │ │ │ ├── login/ │ │ │ │ ├── register/ │ │ │ │ └── updata/ │ │ │ └── (domain)/ # 业务相关 Action │ │ │ └── profile/ │ │ ├── components/ # 公共组件 │ │ │ ├── (domain)/ # 业务组件 │ │ │ ├── left-menus.tsx │ │ │ ├── loading.tsx │ │ │ └── navbar.tsx │ │ ├── contexts/ # 全局上下文 │ │ │ └── user-context.tsx │ │ ├── icons/ # 图标组件 │ │ ├── lib/ # 公共扩展功能 │ │ │ └── session.ts │ │ ├── routes/ # 路由层 │ │ │ ├── (auth)/ # 认证路由 │ │ │ ├── (domain)/ # 业务路由 │ │ │ └── api/ # API 路由 │ │ ├── types/ # 类型定义 │ │ ├── utils/ # 公共工具 │ │ ├── app.tsx # 应用根组件 │ │ ├── app.css # 全局样式 │ │ ├── entry-client.tsx # 客户端入口 │ │ └── entry-server.tsx # 服务端入口 │ ├── config.toml # 前端配置文件 │ ├── package.json │ └── tsconfig.json │ └── ob-server/ # 后端项目 ├── src/ │ ├── auth/ # 认证模块 │ │ ├── decorators/ │ │ ├── guards/ │ │ └── strategies/ │ ├── config/ # 配置模块 │ ├── email/ # 邮件服务模块 │ ├── logger/ # 日志模块 │ ├── redis/ # Redis 模块 │ ├── system/ # 系统模块 │ ├── user/ # 用户模块 │ ├── app.module.ts # 根模块 │ └── main.ts # 应用入口 ├── database/ # 数据库 JSON 文件 ├── config.toml # 后端配置文件 ├── package.json └── tsconfig.json ``` --- ## 如何打开项目 ### 方式一:命令行启动 #### 1. 启动后端服务 (ob-server) ```bash # 进入后端目录 cd ob-server # 安装依赖(如果还没有 node_modules) npm install # 开发模式启动(带热重载) npm run start:dev # 生产模式启动 npm run start:prod ``` 后端服务默认运行在 **http://localhost:3000** #### 2. 启动前端服务 (ob-client) ```bash # 进入前端目录 cd ob-client # 安装依赖(如果还没有 node_modules) npm install # 开发模式启动 npm run dev # 构建生产版本 npm run build # 启动生产服务 npm run start ``` 前端服务默认运行在 **http://localhost:5174** ### 方式二:IDE 打开 1. 使用 VS Code、WebStorm 或 Trae 等 IDE 2. 打开项目根目录 `d:\Users\ceshi` 3. 分别在前端和后端目录打开终端执行上述命令 --- ## 配置文件说明 ### 后端配置 (ob-server/config.toml) ```toml # 数据库配置 [database] type = "mysql" host = "127.0.0.1" port = 3309 username = "root" password = "123456" database = "nest_project" synchronize = true logging = true poolSize = 10 connectorPackage = "mysql2" # 邮件服务配置 [email] host = "smtp.qq.com" port = 587 secure = false user = "q84652123@qq.com" pass = "bqedgmfrkqxzdjba" from = "御码 " # 静态文件配置 [static] rootPath = "uploads" serveRoot = "/uploads" # Redis 配置 [redis] host = "127.0.0.1" ``` ### 前端配置 (ob-client/config.toml) ```toml # API 请求地址 [request] base_url="http://127.0.0.1:3000" # Session 配置 [session] httpOnly = true path = "/" secure = false sameSite = "lax" maxAge = 2592000 session_key = "session_id" ``` --- ## 常用命令 ### 后端命令 | 命令 | 说明 | |------|------| | `npm run start:dev` | 开发模式启动(热重载) | | `npm run start:debug` | 调试模式启动 | | `npm run start:prod` | 生产模式启动 | | `npm run build` | 构建项目 | | `npm run lint` | 运行 ESLint 检查 | | `npm run test` | 运行单元测试 | | `npm run format` | 格式化代码 | ### 前端命令 | 命令 | 说明 | |------|------| | `npm run dev` | 开发服务器(端口 5174) | | `npm run build` | 构建生产版本 | | `npm run start` | 启动生产服务器 | --- ## 功能模块 ### 已实现功能 - ✅ 用户注册/登录/登出 - ✅ 邮箱验证码 - ✅ 忘记密码/修改密码 - ✅ 用户头像上传 - ✅ JWT 认证 - ✅ 文件上传(大文件分片上传) - ✅ 系统监控 ### 路由结构 **认证路由** (`/auth/*`): - `/login` - 登录页面 - `/register` - 注册页面 - `/updata` - 密码修改 **业务路由** (`/*`): - `/` - 首页 - `/files` - 文件管理 - `/buckets` - 存储桶管理 - `/access` - 权限管理 - `/profile` - 个人中心 - `/settings` - 系统设置 - `/monitor` - 系统监控 --- ## 开发注意事项 1. **后端依赖**: 确保 MySQL 和 Redis 服务已启动 2. **端口占用**: 后端默认 3000 端口,前端默认 5174 端口 3. **CORS**: 后端已配置跨域,确保 `config.toml` 中的地址正确 4. **数据库**: 设置 `synchronize: true` 会自动同步表结构(开发环境) 5. **Node 版本**: 确保 Node.js 版本 >= 22 --- ## 项目启动流程图 ``` ┌─────────────────┐ │ 启动 MySQL │ └────────┬────────┘ │ ┌────────▼────────┐ │ 启动 Redis │ └────────┬────────┘ │ ┌────────▼────────┐ │ 启动后端服务 │ npm run start:dev (ob-server) │ localhost:3000 │ └────────┬────────┘ │ ┌────────▼────────┐ │ 启动前端服务 │ npm run dev (ob-client) │ localhost:5174 │ └─────────────────┘ ```