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โ
- Clinician logs in โ portal (Auth Server
:9000/portal) - Portal fetches patients from HAPI FHIR
:8080/fhir - Clinician selects patient โ launch token created (atomic, 5-min expiry)
- Browser redirects to SMART Client
/launch?iss=...&launch=token - Client fetches
/.well-known/smart-configuration(proxied to auth server) - Client builds PKCE authorize URL (S256, 96-byte verifier) โ redirects
- Auth server validates login, resolves launch token โ patient + encounter
- Token response:
access_token+patient+encounter+id_token(top-level JSON) - Client calls HAPI FHIR with Bearer token
SmartScopeInterceptorverifies RS256 signature + SMART scopes on every requestAuditServicewrites FHIRAuditEventfor 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)