Update project structure documentation for services layer

This commit is contained in:
CPTProgrammer 2026-07-08 06:30:42 +08:00
parent d7317b4b04
commit 2651451b6d
No known key found for this signature in database

View File

@ -23,9 +23,10 @@
│ └── {config_name}.json # 各 mod 的配置 │ └── {config_name}.json # 各 mod 的配置
├── public/ # 静态资源(图标、图片等) ├── public/ # 静态资源(图标、图片等)
├── src/ ├── src/
│ ├── app/ # Next.js App Router页面、布局 │ ├── app/ # Next.js App Router页面、布局、tRPC Route Handler
│ ├── components/ # 可复用 UI 组件 │ ├── components/ # 可复用 UI 组件
│ ├── lib/ # 后端逻辑(与前端直接调用,不创建 API Route │ ├── lib/ # 纯后端逻辑,无 React 依赖
│ ├── services/ # 业务编排层Server Actions + tRPC Router
│ └── types/ # TypeScript 类型定义 │ └── types/ # TypeScript 类型定义
├── docs/ # 本文档 ├── docs/ # 本文档
├── package.json ├── package.json
@ -47,9 +48,10 @@
| 目录 | 职责 | | 目录 | 职责 |
|------|------| |------|------|
| `app/` | Next.js App Router 页面与布局 | | `app/` | Next.js App Router 页面与布局,以及唯一的 tRPC Route Handler |
| `components/` | 可复用的 Ant Design 组件 | | `components/` | 可复用的 Ant Design 组件 |
| `lib/` | 纯后端逻辑(读取配置、调用 API、模板解析等可供前端直接引用 | | `lib/` | 纯后端逻辑(平台 API 请求、模板解析、工具函数),无 React 依赖 |
| `services/` | 业务编排层,注入全局 client 单例,通过 Server Actions 暴露给前端或 tRPC Router 调用 |
| `types/` | TypeScript 类型/接口定义,使用 Zod schema 统一校验并导出类型 | | `types/` | TypeScript 类型/接口定义,使用 Zod schema 统一校验并导出类型 |
### 代码质量 ### 代码质量