Care Plan Service — Deployment Topology
Status: populated Owner: TBD Last updated: 2026-04-18 Companion: Service Template · 03 platform-services · 02 DDD
Runtime
| Attribute | Value |
|---|---|
| Runtime | Node.js 22 LTS, NestJS 11 |
| Language | TypeScript 5.x |
| Package | @ghasi/service-care-plan |
| Container | Docker; base image node:22-alpine |
| Port | 3000 (HTTP) |
Replicas and Scaling
| Environment | Min replicas | Max replicas | Scale trigger |
|---|---|---|---|
| Production | 2 | 8 | CPU > 70% or request queue > 50 |
| Staging | 1 | 3 | Manual or CPU > 80% |
| Development | 1 | 1 | — |
Horizontal pod autoscaling (HPA) via Kubernetes. Graceful shutdown: 30 s drain window.
Dependencies (runtime)
| Dependency | Type | Notes |
|---|---|---|
| Postgres 16 | Primary store | Per-tenant RLS; connection pool via pg / Drizzle |
| NATS JetStream | Event bus | Outbox relay; stream CARE_PLAN_EVENTS |
| Keycloak | AuthN/AuthZ | JWT validation via JWKS endpoint |
| Kong | API gateway | Routes /api/v1/care-plans → service |
| terminology-service | Coding validation | HTTP call; graceful degradation if unavailable |
| audit-service | Audit pipeline | Fire-and-forget; no blocking |
| provider-directory-service | Practitioner validation | HTTP call on care team updates |
Regions and Data Residency
- Deployed per-region matching tenant data residency declaration.
- Reference region: Afghanistan (AFG), UAE (UAE).
- No cross-region data replication for care plan records.
- Postgres primary in region; read replica for FHIR read surface (optional).
Resource Limits (per pod)
| Resource | Request | Limit |
|---|---|---|
| CPU | 250m | 1000m |
| Memory | 256 Mi | 512 Mi |
Environment Variables
| Variable | Purpose |
|---|---|
DATABASE_URL | Postgres connection string |
NATS_URL | NATS JetStream URL |
KEYCLOAK_JWKS_URI | JWKS endpoint for JWT validation |
TERMINOLOGY_SERVICE_URL | Terminology service base URL |
AUDIT_SERVICE_URL | Audit service base URL |
PROVIDER_DIRECTORY_SERVICE_URL | Provider directory base URL |
CARE_PLAN_MODULE_ENTITLEMENT | Feature flag key (default: ehr.care_plans) |
OTEL_EXPORTER_OTLP_ENDPOINT | OpenTelemetry collector endpoint |