You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 26, 2026. It is now read-only.
The host should assemble independently testable adapters and lifecycle components. Instead, route behavior, infrastructure orchestration, startup side effects, and shutdown are interleaved in one module.
Reviewed against master at 7f9e26400a474aa5a706d261f24fa2bf3d98ce8c.
Architectural impact
Changes in unrelated features create frequent merge conflicts in the entrypoint.
Route-level tests require importing a module that performs migrations and starts runtime services.
Startup ordering is implicit in top-level execution and import side effects.
Partial startup failure and cleanup ownership are difficult to reason about.
Feature adapters cannot be mounted independently for testing or alternate hosts.
Security middleware and request-scope conventions can diverge between manually declared routes.
The Bun listener configuration, application construction, and process lifecycle cannot be tested separately.
Proposed direction
Introduce a pure createServerApp(dependencies) function that builds and returns the Hono app without starting workers, migrations, or listeners.
Split route adapters into feature modules, for example:
routes/auth;
routes/terminals;
routes/uploads;
routes/deployment-webhooks;
routes/git-provider-oauth;
routes/scim;
routes/upgal;
routes/health.
Give each module typed dependencies and mount it through a common adapter interface.
Introduce a ServerRuntime/lifecycle coordinator whose components implement start, ready, stop, and optional diagnostics.
Move database migration, Caddy initialization, deployment workers, backup/notification workers, schedulers, monitoring, auto-update, and Docker cleanup into explicit lifecycle components.
Start components in dependency order and stop them in reverse order, with rollback when startup fails halfway.
Keep signal handling and process.exit in a minimal executable entrypoint.
Add route registration tests that detect duplicate paths and verify standard middleware coverage.
Acceptance criteria
Importing the app factory does not run migrations, start timers, open Redis/Docker/SSH connections, or register process signals.
Each major HTTP/protocol feature is mounted from its own module.
Summary
apps/server/src/index.tsis a roughly 2,400-line host module that currently owns all of the following:The host should assemble independently testable adapters and lifecycle components. Instead, route behavior, infrastructure orchestration, startup side effects, and shutdown are interleaved in one module.
Reviewed against
masterat7f9e26400a474aa5a706d261f24fa2bf3d98ce8c.Architectural impact
Proposed direction
createServerApp(dependencies)function that builds and returns the Hono app without starting workers, migrations, or listeners.routes/auth;routes/terminals;routes/uploads;routes/deployment-webhooks;routes/git-provider-oauth;routes/scim;routes/upgal;routes/health.ServerRuntime/lifecycle coordinator whose components implementstart,ready,stop, and optionaldiagnostics.process.exitin a minimal executable entrypoint.Acceptance criteria
index.tsis reduced to composition, startup, listener export, and signal handling.Suggested migration order