Pārlūkot izejas kodu

Add architecture diagram and project configuration documentation for TG Live Game Web frontend, detailing project structure, technology stack, routing, and API dependencies.

yb 3 nedēļas atpakaļ
vecāks
revīzija
b3dee5f2aa
2 mainītis faili ar 133 papildinājumiem un 0 dzēšanām
  1. 110 0
      CLAUDE.md
  2. 23 0
      architecture.canvas

+ 110 - 0
CLAUDE.md

@@ -0,0 +1,110 @@
+# TG Live Game Web 前端 - Claude Code 配置
+
+> 2级子项目配置 | 继承自 tg-live-game (1级)
+
+## 项目信息
+
+| 属性 | 值 |
+|------|-----|
+| 项目名称 | tg-live-game-web |
+| 所属项目 | tg-live-game |
+| 项目类型 | frontend (前端应用) |
+| 框架 | Vue 3 |
+| 构建工具 | Vite 7.x |
+| UI 组件库 | Element Plus |
+
+## 技术栈
+
+| 类别 | 技术 | 版本 |
+|------|------|------|
+| 框架 | Vue | 3.5.x |
+| 构建 | Vite | 7.2.x |
+| 语言 | TypeScript | 5.9.x |
+| UI | Element Plus | 2.13.x |
+| 状态 | Pinia | 3.0.x |
+| 路由 | Vue Router | 4.6.x |
+| HTTP | Axios | 1.13.x |
+| 播放器 | HLS.js | 1.6.x |
+| 样式 | Sass | 1.97.x |
+
+## 项目结构
+
+```
+src/
+├── main.ts              # 应用入口
+├── App.vue              # 根组件
+├── api/                 # API 接口
+│   ├── login.ts        # 登录接口
+│   ├── user.ts         # 用户管理
+│   ├── camera.ts       # 摄像头管理
+│   ├── stream.ts       # Stream 管理
+│   └── cloudflare-stream.ts
+├── components/          # 公共组件
+│   └── VideoPlayer.vue # 视频播放器
+├── layout/              # 布局组件
+│   └── index.vue       # 主布局
+├── router/              # 路由配置
+│   └── index.ts
+├── store/               # Pinia 状态
+│   ├── index.ts
+│   ├── app.ts
+│   ├── user.ts
+│   └── stream.ts
+├── types/               # TypeScript 类型
+│   ├── index.ts
+│   └── cloudflare.ts
+├── utils/               # 工具函数
+│   ├── request.ts      # Axios 封装
+│   └── auth.ts         # Token 管理
+└── views/               # 页面视图
+    ├── login/          # 登录页
+    ├── camera/         # 摄像头管理
+    ├── stream/         # 直播/视频管理
+    └── user/           # 用户管理
+```
+
+## 页面路由
+
+| 路由 | 页面 | 描述 |
+|------|------|------|
+| `/login` | 登录页 | 用户登录 |
+| `/camera` | 摄像头管理 | 摄像头列表 |
+| `/stream-test` | Stream 测试 | 播放测试 |
+| `/stream/videos` | 视频管理 | 视频列表 |
+| `/stream/live` | 直播管理 | 直播列表 |
+| `/stream/config` | Stream 配置 | 配置管理 |
+| `/user` | 用户管理 | 用户列表 (admin) |
+
+## API 依赖
+
+后端服务: `tg-live-game-hono`
+
+| 接口分组 | 路径 | 描述 |
+|----------|------|------|
+| 认证 | `/api/auth/*` | 登录/登出/刷新 |
+| 用户 | `/api/users/*` | 用户管理 |
+| 摄像头 | `/api/cameras/*` | 摄像头 CRUD |
+| Stream | `/api/stream/*` | 视频/直播管理 |
+
+## 开发命令
+
+```bash
+pnpm install          # 安装依赖
+pnpm dev              # 本地开发 (localhost:3001)
+pnpm build            # 构建生产版本
+pnpm preview          # 预览生产版本
+```
+
+## 环境变量
+
+| 变量 | 开发环境 | 生产环境 |
+|------|----------|----------|
+| VITE_API_BASE_URL | http://localhost:8787 | https://tg-live-game-api.ifoodme.com |
+
+## 核心文档
+
+| 文档 | 位置 | 内容 |
+|------|------|------|
+| 子系统架构 | `architecture.canvas` | 前端架构图 |
+| 整体架构 | `../architecture.canvas` | 系统架构图 |
+| 后端架构 | `../tg-live-game-hono/architecture.canvas` | API 架构 |

+ 23 - 0
architecture.canvas

@@ -0,0 +1,23 @@
+{
+	"nodes":[
+		{"id":"title","type":"text","text":"# tg-live-game-web 架构\n\n**版本**: v1.0.0\n**技术栈**: Vue 3 + TypeScript + Vite\n**状态**: ✅ 已实现\n\n功能:\n- 登录认证\n- 摄像头管理\n- 视频/直播管理\n- 用户管理 (RBAC)","x":-400,"y":-600,"width":400,"height":280,"color":"1"},
+		{"id":"entry","type":"text","text":"**入口文件**\n`src/main.ts`\n\n功能:\n- Vue 应用初始化\n- Element Plus 注册\n- Pinia 状态管理\n- Vue Router 路由\n\n端口: localhost:3001","x":-400,"y":-240,"width":280,"height":260,"color":"6"},
+		{"id":"router","type":"text","text":"**路由配置**\n`src/router/index.ts`\n\n页面:\n- /login (登录)\n- /camera (摄像头)\n- /stream/* (视频/直播)\n- /user (用户管理)\n\n守卫: Token 验证","x":-400,"y":80,"width":280,"height":300,"color":"3"},
+		{"id":"store","type":"text","text":"**状态管理**\n`src/store/`\n\nPinia Stores:\n- app.ts (应用状态)\n- user.ts (用户信息)\n- stream.ts (流媒体)","x":-40,"y":-240,"width":260,"height":260,"color":"3"},
+		{"id":"api","type":"text","text":"**API 层**\n`src/api/`\n\n接口模块:\n- login.ts (认证)\n- user.ts (用户)\n- camera.ts (摄像头)\n- stream.ts (流媒体)\n\n基于 Axios 封装","x":-40,"y":80,"width":260,"height":300,"color":"3"},
+		{"id":"views","type":"text","text":"**页面视图**\n`src/views/`\n\n模块:\n- login/ (登录页)\n- camera/ (摄像头管理)\n- stream/ (视频/直播)\n- user/ (用户管理)","x":300,"y":-240,"width":280,"height":260,"color":"3"},
+		{"id":"components","type":"text","text":"**公共组件**\n`src/components/`\n\n- VideoPlayer.vue\n  HLS.js 播放器\n- Layout 布局组件","x":300,"y":80,"width":280,"height":200,"color":"3"},
+		{"id":"backend","type":"text","text":"**后端 API**\n\ntg-live-game-hono\n\n接口:\n- /api/auth/*\n- /api/users/*\n- /api/cameras/*\n- /api/stream/*\n\n认证: JWT","x":-40,"y":460,"width":260,"height":260,"color":"2"},
+		{"id":"utils","type":"text","text":"**工具函数**\n`src/utils/`\n\n- request.ts (Axios)\n- auth.ts (Token)","x":300,"y":340,"width":280,"height":180,"color":"2"}
+	],
+	"edges":[
+		{"id":"edge_entry_router","fromNode":"entry","fromSide":"bottom","toNode":"router","toSide":"top","label":"use()"},
+		{"id":"edge_entry_store","fromNode":"entry","fromSide":"right","toNode":"store","toSide":"left","label":"use()"},
+		{"id":"edge_router_views","fromNode":"router","fromSide":"right","toNode":"views","toSide":"left","label":"component"},
+		{"id":"edge_store_api","fromNode":"store","fromSide":"bottom","toNode":"api","toSide":"top","label":"actions"},
+		{"id":"edge_views_components","fromNode":"views","fromSide":"bottom","toNode":"components","toSide":"top","label":"import"},
+		{"id":"edge_api_backend","fromNode":"api","fromSide":"bottom","toNode":"backend","toSide":"top","label":"HTTP"},
+		{"id":"edge_api_utils","fromNode":"api","fromSide":"right","toNode":"utils","toSide":"left","label":"request"},
+		{"id":"edge_components_utils","fromNode":"components","fromSide":"bottom","toNode":"utils","toSide":"top"}
+	]
+}