Skip to main content

Communication Service — Deployment Topology

Status: populated Owner: TBD Last updated: 2026-04-17 Companion: Service Template · 17 Tech Stack

1. Runtime

  • Language / runtime: TypeScript 5.x on Node 22 LTS
  • Framework: NestJS 11
  • Container: distroless Node image, non-root user
  • Process types: api (HTTP), worker-dispatch (notification dispatch), worker-dlr (DLR ingestion), outbox-relay (NATS publisher)

2. Replicas & scaling

ProcessBaselineMinMaxHPA signal
api3230CPU + RPS
worker-dispatch2120queue depth
worker-dlr2110callback RPS
outbox-relay222(fixed leader-election)

3. Dependencies

DependencyPurpose
PostgreSQL 16communication schema
NATS JetStreamstreams COMMUNICATION, ENGAGE_MESSAGING (legacy)
Redis 7idempotency cache, rate limits
Object storage (S3/MinIO)attachments, recording blobs
KMSjoin-token signing, column encryption, DLR HMAC
Jitsi Meetvirtual room provider
Ghasi-SMS-GatewaySMS in-country
FCM / APNs / WebPushpush
SES / SendGridemail
Kongedge gateway
identity-serviceJWKS
interop-serviceFHIR Communication writes
config-servicetemplates, channel policies
ai-gateway-serviceoptional AI features

4. Regions

  • Primary: co-located with tenant's primary region
  • SMS carrier path: Afghanistan tenants use Ghasi-SMS-Gateway (in-country); other tenants per policy
  • Push / email: regional endpoints preferred
  • DR: async replica in secondary region; RPO ≤ 15 min, RTO ≤ 60 min

5. Config (env)

VarDefaultPurpose
DATABASE_URLrequiredPostgres
NATS_URLrequiredJetStream
REDIS_URLrequiredCache
KMS_KEY_ARNrequiredSigning
KEYCLOAK_JWKS_URLrequiredJWT validation
OBJECT_STORE_URLrequiredS3 endpoint
OBJECT_STORE_BUCKETrequiredcomms-<tenant-bucket-suffix>
SMS_DEFAULT_PROVIDERghasi-sms-gatewayghasi-sms-gateway | twilio | vonage
GHASI_SMS_GATEWAY_URLrequiredBase URL
GHASI_SMS_GATEWAY_API_KEYrequiredKMS-sealed
EMAIL_DEFAULT_PROVIDERses
PUSH_FCM_KEY_REFrequiredKMS ref
JITSI_BASE_URLrequiredVirtual care provider
JITSI_APP_SECRETrequiredToken signing
OTEL_EXPORTER_OTLP_ENDPOINTrequiredTelemetry

6. Health checks

  • /healthz — process up
  • /readyz — DB + NATS + Redis + adapter self-check
  • Per-adapter probe surfaces in /v1/communication/notifications/health

7. Canary & rollout

  • 5% traffic for 30 min with SLO gates (send latency, dispatch success).
  • Automatic rollback on failed/dispatched > 0.2 sustained 5 min.