Skip to main content

Immunizations Service — Deployment Topology

Status: populated Owner: TBD Last updated: 2026-04-18 Companion: Service Template

1. Runtime Specification

PropertyValue
RuntimeNode.js 22 LTS
FrameworkNestJS 11
Container base imagenode:22-alpine
Port3007
Liveness probeGET /health/live
Readiness probeGET /health/ready
Startup probeGET /health/startup

2. Replicas

EnvironmentMin replicasMax replicasHPA trigger
Development11
Staging12CPU > 60%
Production26CPU > 65% or RPS > 200

3. Kubernetes Resource Requests/Limits

ResourceRequestLimit
CPU100m500m
Memory256Mi512Mi

4. Dependencies

DependencyTypePurposeStartup-required
PostgreSQL 16DatabasePrimary data store; RLS tenant isolationYes
NATS JetStreamMessage brokerEvent publish + consumeYes
Redis 7Cache / queueBullMQ forecast queue; idempotency cacheYes
KeycloakAuthJWT validationYes
terminology-serviceInternal serviceEPI schedule definitionsOn startup (cached)
registration-serviceInternal servicePatient active status checkNo (fault-tolerant)
interop-serviceInternal serviceRegistry sync dispatchNo (async)
ai-gateway-serviceInternal serviceAI risk-score (S3, future)No

5. Deployment Diagram

6. Background Workers

WorkerTriggerPurpose
ForecastRefreshWorkerBullMQ job (enqueued on record create)Recompute patient forecast
OutboxRelayWorkerPolling (500ms interval)Publish pending outbox events to NATS
RegistrySyncCronWorkerCron (configurable, default 0 2 * * *)Batch sync modified records to national registry
CoverageMaterializedViewWorkerCron (hourly) or event-drivenRefresh coverage_by_antigen materialized view

7. Regional Considerations

  • Primary deployment: Afghanistan MoPH data centre.
  • All data must remain within jurisdiction; no cross-region replication of PII.
  • If multi-region is added in future, use active-passive with async replication (not multi-active) for immunization records.