← ClaudeAtlas

server-architecturelisted

ShipIt server/orchestrator architecture: buildApp(), HTTP API routes, services layer, WebSocket handler dispatch, SSE broadcasts, dependency injection, state scopes, manager initialization, type system. Load when working on orchestrator code, routes, services, or WebSocket handlers.
nikzlabs/shipit · ★ 5 · API & Backend · score 73
Install: claude install-skill nikzlabs/shipit
# Server Architecture The server is a single Fastify process (the orchestrator) that handles HTTP, WebSocket, and SSE connections from the browser. It delegates session-scoped work to Docker containers running session workers. ## Entry Point: `buildApp()` `src/server/orchestrator/index.ts` exports `buildApp(deps: AppDeps)`, which: 1. Instantiates all managers (or accepts injected stubs from `deps`) 2. Initializes global git config and agent detection 3. Sets up Docker container manager (production) or skips it (tests) 4. Creates the session runner registry with a factory 5. Registers HTTP routes via `registerApiRoutes()` 6. Registers WebSocket handler at `/ws/sessions/:id` 7. Registers SSE endpoint at `/api/events` 8. Registers preview proxy routes 9. Sets up startup tasks (warm pool validation, orphan cleanup) 10. Returns the Fastify instance without starting it The function returns the app without calling `listen()`, so integration tests can use `app.inject()` without binding a port. ## Dependency Injection `buildApp()` accepts an `AppDeps` object where every field is optional. Production uses real implementations; tests supply mocks/stubs. This is the foundation of testability — integration tests never spawn real Docker containers, Claude CLI processes, or Vite servers. Key injectable dependencies: | Dependency | Type | Purpose | |------------|------|---------| | `createGitManager` | `(dir) => GitManager` | Per-session git operations | | `createRepoGit` | `(dir) =