Files
web-app-launcher/plans/service-integrations/phase-7-npm.md
T
alexei.dolgolyov 50e8519220 feat(service-integrations): phase 2 — integration widget & app form UI
- Add 6 renderer components: StatCard, Gauge, List, Progress, AlertBanner, Chart
- Add IntegrationWidget container with auto-refresh, loading, error states
- Add IntegrationAlertOverlay for layout-level critical alerts
- Add IntegrationConfigFields for dynamic form generation from Zod schemas
- Register integration type in WidgetRenderer
- Extend WidgetCreationForm with integration app/endpoint pickers
- Extend AppForm with integration config section and test connection button
- Add /api/integrations/alerts endpoint
2026-03-25 22:07:51 +03:00

46 lines
2.5 KiB
Markdown

# Phase 7: Nginx Proxy Manager Integration
**Status:** ⬜ Not Started
**Parent plan:** [PLAN.md](./PLAN.md)
**Domain:** backend
## Objective
Implement Nginx Proxy Manager integration to display proxy hosts, SSL certificate expiry warnings, and upstream reachability status.
## Tasks
- [ ] Task 1: Create `src/lib/server/integrations/npm/schema.ts` — Zod schemas for auth config (`{ email: string, password: string }`) and endpoint responses.
- [ ] Task 2: Create `src/lib/server/integrations/npm/client.ts` — HTTP client for NPM API. Session-based auth: POST `/api/tokens` with email+password → get JWT → use for subsequent requests. Endpoints: `/api/nginx/proxy-hosts`, `/api/nginx/certificates`, `/api/nginx/proxy-hosts/{id}`. Cache session token.
- [ ] Task 3: Create `src/lib/server/integrations/npm/transform.ts` — Transform: proxy hosts → list with domain/status/SSL info, certificates → list with expiry countdown (red <7d, yellow <14d, green >14d), upstream → list with reachable/unreachable indicator.
- [ ] Task 4: Create `src/lib/server/integrations/npm/index.ts` — Integration implementation. Endpoints: `proxy-hosts` (list), `ssl-certificates` (list), `upstream-status` (list). testConnection: authenticate and fetch proxy hosts.
- [ ] Task 5: Register NPM integration in registry.
## Files to Modify/Create
- `src/lib/server/integrations/npm/schema.ts` — new
- `src/lib/server/integrations/npm/client.ts` — new
- `src/lib/server/integrations/npm/transform.ts` — new
- `src/lib/server/integrations/npm/index.ts` — new
- `src/lib/server/integrations/registry.ts` — modify: register NPM
## Acceptance Criteria
- Proxy hosts list with domain name, enabled/disabled status
- SSL certificates with expiry date and color-coded countdown
- Upstream status shows reachable/unreachable per host
- Session-based auth works (login → token → API calls)
- Handles expired session token (re-authenticate automatically)
- Test connection validates email/password credentials
## Notes
- NPM uses session-based auth, not API keys — need to login first, cache the JWT
- SSL expiry is the highest-value feature here — highlight expiring certs prominently
- The session token has a limited lifetime — handle re-authentication on 401 responses
- NPM API is relatively simple and well-documented
## Review Checklist
- [ ] All tasks completed
- [ ] Session token caching and re-auth implemented
- [ ] Code follows project conventions
## Handoff to Next Phase
<!-- Filled in after completion -->