[verified] refactor: establish service and frontend boundaries

This commit is contained in:
chick
2026-07-15 02:43:41 +08:00
parent 0ac6faa6a3
commit e04a16e817
29 changed files with 917 additions and 598 deletions
+22 -1
View File
@@ -29,7 +29,7 @@ npm start
```json
{
"server": { "host": "0.0.0.0", "port": 8788 },
"server": { "host": "127.0.0.1", "port": 8788 },
"instances": [
{
"id": "simadmin-open",
@@ -70,6 +70,27 @@ npm test
npm start
```
## 架构与阶段边界
第一阶段采用无构建链的可组合架构:
- `server/index.js` 是唯一 bootstrap,负责路径、监听和优雅关闭;`server/app.js``buildApp()` 无导入副作用,可通过 Fastify `inject()` 测试。
- `server/config/` 提供 immutable snapshot、串行事务和 temp + atomic rename;模板只用于首次加载,提交始终写实际 `config.json`
- `server/clients/` 在配置成功提交后 reconcile;`server/status/``server/proxy/` 是独立边界。
- `public/domain``infrastructure``state``router` 放置 Node 可测试模块,`app.js` 暂作 DOM composition/controller。
- `styles.css` 依次导入 tokens、base、components、responsive。
验证命令:
```bash
npm test
find server public test -name '*.js' -exec node --check {} \;
npm audit --omit=dev --audit-level=high
git diff --check
```
第一阶段只提供架构端口和基础安全不变量。控制面完整鉴权、CSRF、完整 SSRF(DNS 解析/重绑定与私网 CIDR policy)、审计/权限,以及前端 CRUD 可达性和整体 UI 重构留到第二阶段。默认监听 `127.0.0.1`;显式配置 `0.0.0.0` 会保持,但这会暴露当前尚未鉴权的控制面。
## 注意
- 当前项目是本地管理面板,不修改 SimAdmin 本体。