HMS Runtime Architecture

HMS Runtime Architecture An architecture diagram generated by Archify. Clinician · Browser / Mobile · Client device (untrusted) · Untrusted client Clinician Browser / Mobile Untrusted client Next.js PWA · React 19 + TS :3000 · Edge + presentation (untrusted input) · Service worker Next.js PWA React 19 + TS :3000 Service worker Go API · backend-api/cmd/api :8080 · Trusted compute perimeter · 60+ modules Go API backend-api/cmd/api :8080 60+ modules PostgreSQL · primary :5544 · Data layer (private network) · pgx/v5 PostgreSQL primary :5544 pgx/v5 IndexedDB · Dexie outbox + cache · Client device (untrusted) · Offline-first IndexedDB Dexie outbox + cache Offline-first Sync Engine · Rust + axum · Trusted compute perimeter · <2s batch budget Sync Engine Rust + axum <2s batch budget Redis · cache :6390 · Data layer (private network) · Session + cache Redis cache :6390 Session + cache Meilisearch · search :7700 · Data layer (private network) · Full-text index Meilisearch search :7700 Full-text index Audit + RBAC · internal/audit, internal/rbac · Trusted compute perimeter · Hash-chained Audit + RBAC internal/audit, internal/rbac Hash-chained Data Generator · Rust service · Trusted compute perimeter · Seed + load test Data Generator Rust service Seed + load test HTTPS enqueue REST + JWT outbox drain apply delta log every action SQL (pgx) read-through index + query seed Client device (untrusted) Edge + presentation (untrusted input) Trusted compute perimeter Data layer (private network)

Frontend stack

  • • Next.js 16.3 + React 19 + TypeScript
  • • Offline-first via Dexie 4.4 IndexedDB outbox
  • • Playwright covers E2E test suite

Backend services

  • • Go 1.25 API in backend-api (pgx/v5, golang-jwt/v5)
  • • 60+ modules under internal/modules (auth, emr, lab, billing, …)
  • • Rust sync engine drains outbox within <2s batch budget

Data layer

  • • PostgreSQL 16 is the system of record (port 5544)
  • • Redis 7 serves session + cache (port 6390)
  • • Meilisearch 1.8 backs full-text search (port 7700)

Cross-cutting

  • • Audit log is hash-chained; every user action logged
  • • RBAC + middleware enforce permission boundaries
  • • Licensing + telemetry live inside the trusted compute perimeter

Trust boundaries

  • • Browser + IndexedDB treated as untrusted input
  • • Only the Go API and Rust services hold production secrets
  • • Postgres, Redis, and Meilisearch live on a private data network