Skip to main content

Care Plan Service — Deployment Topology

Status: populated Owner: TBD Last updated: 2026-04-18 Companion: Service Template · 03 platform-services · 02 DDD

Runtime

AttributeValue
RuntimeNode.js 22 LTS, NestJS 11
LanguageTypeScript 5.x
Package@ghasi/service-care-plan
ContainerDocker; base image node:22-alpine
Port3000 (HTTP)

Replicas and Scaling

EnvironmentMin replicasMax replicasScale trigger
Production28CPU > 70% or request queue > 50
Staging13Manual or CPU > 80%
Development11

Horizontal pod autoscaling (HPA) via Kubernetes. Graceful shutdown: 30 s drain window.

Dependencies (runtime)

DependencyTypeNotes
Postgres 16Primary storePer-tenant RLS; connection pool via pg / Drizzle
NATS JetStreamEvent busOutbox relay; stream CARE_PLAN_EVENTS
KeycloakAuthN/AuthZJWT validation via JWKS endpoint
KongAPI gatewayRoutes /api/v1/care-plans → service
terminology-serviceCoding validationHTTP call; graceful degradation if unavailable
audit-serviceAudit pipelineFire-and-forget; no blocking
provider-directory-servicePractitioner validationHTTP 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)

ResourceRequestLimit
CPU250m1000m
Memory256 Mi512 Mi

Environment Variables

VariablePurpose
DATABASE_URLPostgres connection string
NATS_URLNATS JetStream URL
KEYCLOAK_JWKS_URIJWKS endpoint for JWT validation
TERMINOLOGY_SERVICE_URLTerminology service base URL
AUDIT_SERVICE_URLAudit service base URL
PROVIDER_DIRECTORY_SERVICE_URLProvider directory base URL
CARE_PLAN_MODULE_ENTITLEMENTFeature flag key (default: ehr.care_plans)
OTEL_EXPORTER_OTLP_ENDPOINTOpenTelemetry collector endpoint