Files
dashboard/.qoder/repowiki/knowledge/zh/音频设备管理仪表盘(前后端单体仓库)/架构设计.md
T
2026-07-10 11:25:45 +08:00

5 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
仓库采用前后端分离的单体结构:
- `backend/src` 为 Express API 服务,入口 `app.js` 统一挂载 CORS、JSON 解析、`bodyLimit` 中间件,并通过 `routes/index.js` 聚合 auth/brands/models/ota/blacklist/otaTargetDevice/shareCodeLogs/users/dashboard 等路由;数据层使用 Sequelize + mysql2,模型集中在 `models/` 并导出到 `models/index.js`;外部依赖通过 `services/` 抽象(curveClient 调用第三方曲线服务、eqCacheStorage/squiglink 处理 EQ 缓存、measurementStorage/otaStorage 对接 S3、userBootstrap 负责超级管理员初始化);鉴权由 `middleware/auth.js` + `utils/jwt.js` 实现。
- `frontend/src` 为 Vite + Vue3 + Element Plus SPA`router/index.js` 集中声明所有页面路由并在 `beforeEach` 中做 token 校验与超级管理员权限拦截;`api/` 下每个文件对应一个后端模块的 axios 封装;`views/` 按功能域分目录组织页面,`components/` 存放全局复用组件(ChangePasswordDialog、SidebarLogo、TabsView),`layout/index.vue` 提供侧边栏+标签页布局。
- 顶层 `docker-compose.yml` 编排 backendNode)与 frontendnginx:alpine 静态托管 dist),共享 `audio-network` 网络;`.env.example` 提供环境变量模板。
- 依赖方向单向:前端 → 后端 REST API,后端 → MySQL/S3/Redis/第三方 curve 服务,无跨包反向引用。