Skip to main content

Ghasi e-Prescribing Gateway 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-eprescribing-gateway
ContainerDocker; base node:22-alpine
Port3000 (HTTP)
Kong route (direct)/v1/ghasi-e-prescribing-gateway
Via fhir-gateway/fhir/R4/interop/ghasi-eprescribing/* (preferred for first-party)

Replicas and Scaling

EnvironmentMin replicasMax replicasScale trigger
Production312CPU > 65% or request queue > 100
Staging24Manual or CPU > 80%
Development11

Higher minimum replicas than typical services due to HIPAA-equivalent criticality. Rolling update strategy; zero-downtime deployments required.

Runtime Dependencies

DependencyTypeNotes
Postgres 16 (gepgw_* schema)Primary storeRLS; connection pool via Drizzle
NATS JetStreamEvent busOutbox relay; stream EPRESCRIBING_EVENTS
KeycloakAuthN/AuthZJWT + JWKS; B2B client credentials
KongAPI gatewayTwo routes: direct + interop proxy
fhir-gatewayProxy inboundForwards first-party service calls
provider-directory-servicePharmacy routingOrg/Endpoint resolution
terminology-serviceCoding validationATC, RxNorm, SNOMED
audit-serviceAudit pipelineFire-and-forget
Redis (Phase 2)Idempotency + rate limitPhase 1: Postgres only

Regions and Data Residency

  • Deployed per-region per tenant data residency.
  • Reference regions: Afghanistan (AFG), UAE.
  • Cross-region prescription routing requires explicit tenant configuration and legal/data-placement ADR (Phase 4 gated).
  • gepgw_* Postgres stays in declared region.
  • NATS: per-region cluster; events do not cross regional boundary without ADR.

Resource Limits (per pod)

ResourceRequestLimit
CPU500m2000m
Memory512 Mi1 Gi

Higher than typical services: IG validation and FHIR JSON processing are CPU-intensive.

Environment Variables

VariablePurpose
DATABASE_URLgepgw_* Postgres connection
NATS_URLJetStream URL
KEYCLOAK_JWKS_URIJWKS endpoint
PROVIDER_DIRECTORY_SERVICE_URLRouting resolution
TERMINOLOGY_SERVICE_URLCoding validation
AUDIT_SERVICE_URLAudit pipeline
REDIS_URLPhase 2: idempotency/rate-limit store
IG_VALIDATION_MODEzod (Phase 1) or hapi (Phase 2)
HAPI_VALIDATOR_URLPhase 2: external HAPI FHIR validator URL
EPRESCRIBING_MODULE_ENTITLEMENTFeature flag key (ehr.ghasi_eprescribing_gateway)
SUBSCRIPTION_SIGNING_KEY_ARNKMS key for HMAC subscription signing
OTEL_EXPORTER_OTLP_ENDPOINTOTel collector