# Feature Context: Service Integrations ## Configuration - **Development mode:** Automated - **Execution mode:** Orchestrator - **Strategy:** Big Bang - **Build:** `npm run build` - **Test:** `npm test` - **Lint:** `npm run lint` - **Check:** `npm run check` - **Dev server:** `npm run dev` (port: 5173) ## Current State Feature not yet started. Codebase is stable on master with 14 widget types, full app CRUD, healthcheck system, and notification infrastructure. ## Existing Patterns to Follow - **Service pattern**: See `appService.ts`, `metricService.ts`, `systemStatsService.ts` for adapter/client/transform pattern - **Caching**: `metricService.ts` has TTL-based cache — reuse for integration data - **API envelope**: All routes use `success()`, `error()`, `paginated()` from response helpers - **Zod validation**: All inputs validated via Zod schemas in `validators.ts` - **Widget rendering**: `WidgetRenderer.svelte` dispatches to type-specific components - **Config storage**: Widget configs stored as stringified JSON in `Widget.config` - **Encrypted JSON**: `SystemSettings.oauthConfig` pattern for storing credentials ## Temporary Workarounds (none yet) ## Cross-Phase Dependencies - Phase 1 (architecture) must complete before all other phases - Phase 2 (UI) must complete before Phase 10 (polish) - Phases 3-9 (individual integrations) depend only on Phase 1 - Phase 10 depends on all prior phases ## Deferred Work (none yet) ## Failed Approaches (none yet) ## Review Findings Log (none yet) ## Phase Execution Log | Phase | Agent Used | Test Writer | Parallel | Notes | |-------|-----------|-------------|----------|-------| | (not started) | | | | | ## Environment & Runtime Notes - Platform: Windows 10, Git Bash shell - Database: SQLite via Prisma - NUT integration requires raw TCP socket (Node `net` module) - Deluge uses JSON-RPC, NPM uses session-based auth ## Implementation Notes - Integration credentials stored encrypted in `integrationConfig` (JSON string on App model) - NUT is the only non-HTTP integration — uses direct TCP protocol - Alert banners (NUT on-battery, Authentik brute-force) need layout-level rendering, not just widget-level