Skip to main content

Architecture Overview

The AJ Smart FHIR Platform is a modular five-layer architecture. Each layer is independently deployable and replaceable.

The five layersโ€‹

Layer 5 โ€” Applications
SMART Client ยท Patient Portal ยท Clinician Portal ยท Third-party Apps

Layer 4 โ€” Auth & Identity
Auth Server ยท PKCE tokens ยท IdP Federation ยท Consent Manager

Layer 3 โ€” FHIR Data Layer
HAPI FHIR JPA ยท SMART Plugin ยท Scope Enforcement ยท Referral Module

Layer 2 โ€” Compliance & Audit
ATNA Audit ยท FHIR AuditEvent ยท GDPR ยท HIPAA ยท TEFCA ยท DISHA

Layer 1 โ€” Infrastructure
PostgreSQL ยท Docker Compose ยท AWS Lightsail ยท nginx + TLS

EHR launch flowโ€‹

  1. Clinician logs in โ†’ portal (Auth Server :9000/portal)
  2. Portal fetches patients from HAPI FHIR :8080/fhir
  3. Clinician selects patient โ†’ launch token created (atomic, 5-min expiry)
  4. Browser redirects to SMART Client /launch?iss=...&launch=token
  5. Client fetches /.well-known/smart-configuration (proxied to auth server)
  6. Client builds PKCE authorize URL (S256, 96-byte verifier) โ†’ redirects
  7. Auth server validates login, resolves launch token โ†’ patient + encounter
  8. Token response: access_token + patient + encounter + id_token (top-level JSON)
  9. Client calls HAPI FHIR with Bearer token
  10. SmartScopeInterceptor verifies RS256 signature + SMART scopes on every request
  11. AuditService writes FHIR AuditEvent for every access

Component interactionโ€‹

SMART Client โ†โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Auth Server
โ”‚ OAuth2 + PKCE โ”‚
โ”‚ access_token โ”‚
โ”‚ + patient โ”‚
โ–ผ โ–ผ
HAPI FHIR JPA โ—„โ”€โ”€โ”€ SmartScopeInterceptor (RS256 JWT)
โ”‚ SmartDiscoveryProxy
โ–ผ
PostgreSQL (HAPI data) PostgreSQL (auth data)