Skip to main content

Laboratory Service — Deployment Topology

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


1. Runtime

AttributeValue
RuntimeNode 22 / NestJS 11
LanguageTypeScript 5.x
ProcessSingle NestJS process per replica
Port3000 (HTTP)
Package name@ghasi/laboratory-service

2. Replicas and Scaling

EnvironmentMin replicasMax replicasScaling trigger
Production (hub)26CPU > 70% or p95 latency > 1.5 s
Production (facility node)12CPU > 80%
Staging12Manual
Development11N/A

3. Regions / Nodes

Deployment typeWhereNotes
Hub deploymentNational data center (AFG primary)Serves multi-tenant API and FHIR endpoints
Facility nodeEdge deployment at hospital levelOffline-capable; syncs to hub when connected
DR siteAFG secondaryActive-passive; failover < 15 min

4. Dependencies

DependencyTypeNotes
PostgreSQL 16HardPer-service isolated schema
NATS JetStreamHardEvent publishing and order inbox
interop-service FHIR gatewayHard (for release)FHIR publish on result release
terminology-serviceSoftLOINC validation; degraded mode if unavailable
Redis 7SoftResult trending cache; optional
KeycloakHardJWT validation
KongHardAPI routing

5. Kong Routes

RouteUpstream
/v1/laboratory/*laboratory-service:3000
/fhir/R4/Observation (category=laboratory)Routed by interop-service → laboratory-service
/fhir/R4/DiagnosticReport (category=LAB)Routed by interop-service → laboratory-service
/fhir/R4/SpecimenRouted by interop-service → laboratory-service

6. Environment Variables

VariableRequiredDescription
DATABASE_URLYesPostgreSQL connection string
NATS_URLYesNATS JetStream connection
KEYCLOAK_JWKS_URIYesJWT validation endpoint
FHIR_GATEWAY_URLYesinterop-service FHIR base URL
TERMINOLOGY_SERVICE_URLYesTerminology service base URL
REDIS_URLNoTrending result cache
MODULE_LICENSE_KEYYesdiag.laboratory entitlement key
OUTBOX_RELAY_INTERVAL_MSNoDefault 5000