refactor(backend-core): split monolithic index.ts into 15 focused modules

Extract config, context, logger, types, db, http, overview, performance,
provider-registry, scheduler, task-dispatcher, microservice-proxy,
ssh-bridge, and egress-tcp into separate files. index.ts now only handles
server setup, HTTP/WebSocket routing, and startup orchestration.

No behavioral changes — all existing tests and health checks pass.
This commit is contained in:
UniDesk
2026-05-15 18:16:23 +00:00
parent a65711b900
commit 8b636e2c11
19 changed files with 3848 additions and 3576 deletions
+15 -1
View File
@@ -46,7 +46,21 @@
- package.json
- tsconfig.json
- Dockerfile
- src/index.ts (Internal REST API, public provider ingress WebSocket, scheduler, database access, system/Docker status storage API)
- src/index.ts (Server setup, HTTP/WebSocket routing, startup orchestration)
- src/types.ts (All interfaces and type aliases)
- src/config.ts (Environment variable reading and config validation)
- src/context.ts (Shared mutable state container: db client, config ref, dbReady flag)
- src/logger.ts (Structured logger factory)
- src/http.ts (HTTP/JSON utilities, ISO formatting, nested value extraction)
- src/db.ts (Database init, schema creation, all CRUD queries)
- src/performance.ts (Request/operation performance sampling and database size reporting)
- src/provider-registry.ts (Provider WebSocket lifecycle: register, heartbeat, status, disconnect)
- src/task-dispatcher.ts (Task creation, dispatch to providers, wait-for-result)
- src/ssh-bridge.ts (SSH session bridging over provider WebSocket)
- src/egress-tcp.ts (Egress TCP proxy for provider outbound connections)
- src/scheduler.ts (Scheduled task system: cron-like recurring tasks)
- src/microservice-proxy.ts (Microservice routing, HTTP proxy, health aggregation)
- src/overview.ts (Overview endpoint, node/task/service summary, load test)
- frontend/ (Frontend web application container)
- package.json
- tsconfig.json