How fastenhealth/fasten-onprem works
Fasten OnPrem is a self-hosted personal health record for viewing and managing health information, not a direct provider-import service. The main user journey is to sign in, enter records or upload an exported FHIR bundle, then explore records and dashboards. The frontend talks to a Go API whose documented routes cover authentication, FHIR resources, summaries, jobs, and settings; backend repositories provide persistence. The graph follows documented capabilities and indexed references. Several handlers and service implementations were not sampled, so uncertain internal call links are omitted.
Main entry points: server.go HTTP server and routes · fasten-api.service.ts Fasten API client · app-routing.module.ts Page routing · medical-sources.component.ts Medical sources
Components 29
Frontend experience
- Angular application
frontend/src/app/app.module.ts - Page routing
frontend/src/app/app-routing.module.ts - Sign-in page
frontend/src/app/pages/auth-signin/auth-signin.component.ts - Signup wizard
frontend/src/app/pages/auth-signup-wizard/auth-signup-wizard.component.ts - Authentication service
frontend/src/app/services/auth.service.ts - Medical sources
frontend/src/app/pages/medical-sources/medical-sources.component.ts - Health dashboard
frontend/src/app/pages/dashboard/dashboard.component.ts - Medical history views
frontend/src/app/pages/medical-history/medical-history.component.ts - FHIR record cards
frontend/src/app/components/fhir-card/fhir-card/fhir-card.component.ts - FHIR record tables
frontend/src/app/components/fhir-datatable/fhir-datatable/fhir-datatable.component.ts - Fasten API client
frontend/src/app/services/fasten-api.service.ts - Lighthouse client
frontend/src/app/services/lighthouse.service.ts
Backend API
- HTTP server and routes
backend/pkg/web/server.go - Auth handlers
backend/pkg/web/handler/auth.go - FHIR resource handlers
backend/pkg/web/handler/resource_fhir.go - Summary handlers
backend/pkg/web/handler/summary.go - Encryption key handler
backend/pkg/web/handler/encryption_key_handler.go
Health record domain
- FHIR query engine
backend/pkg/database/gorm_repository_query.go - Resource graph
backend/pkg/database/gorm_repository_graph.go - Record summaries
backend/pkg/database/gorm_repository_summary.go - FHIR resource models
backend/pkg/models/database
Persistence and security
- Database repository
backend/pkg/database/interface.go - GORM persistence
backend/pkg/database/gorm_common.go - PostgreSQL store
backend/pkg/database/postgres_repository.go - SQLite store
backend/pkg/database/sqlite_repository.go - Event bus
backend/pkg/event_bus/interface.go
External services
- NLM terminology service
frontend/src/app/services/nlm-clinical-table-search.service.ts - NLM LOINC forms
Other components
- Health record user
Connections 29
- Health record user → Angular application: uses
- Angular application → Page routing: loads routes
frontend/src/app/app.module.ts - Page routing → Sign-in page: routes to
frontend/src/app/app-routing.module.ts - Page routing → Signup wizard: routes to
frontend/src/app/app-routing.module.ts - Sign-in page → Authentication service: signs in via
frontend/src/app/pages/auth-signin/auth-signin.component.ts - Signup wizard → Authentication service: registers via
frontend/src/app/pages/auth-signup-wizard/auth-signup-wizard.component.ts - Authentication service → HTTP server and routes: posts auth requests
frontend/src/app/services/auth.service.ts - HTTP server and routes → Auth handlers: routes auth
backend/pkg/web/server.go - Health record user → Medical sources: uploads FHIR bundle
- Medical sources → Fasten API client: uses API client
frontend/src/app/pages/medical-sources/medical-sources.component.ts - Medical sources → Lighthouse client: requests source authorization
frontend/src/app/pages/medical-sources/medical-sources.component.ts - Health record user → Health dashboard: views records
- Health dashboard → Fasten API client: loads dashboard data
frontend/src/app/pages/dashboard/dashboard.component.ts - Health dashboard → Lighthouse client: loads source data
frontend/src/app/pages/dashboard/dashboard.component.ts - Medical history views → Fasten API client: uses API client
frontend/src/app/pages/medical-history/medical-history.component.ts - Fasten API client → HTTP server and routes: calls API
- HTTP server and routes → FHIR resource handlers: routes FHIR requests
backend/pkg/web/server.go - HTTP server and routes → Summary handlers: routes summary requests
- HTTP server and routes → Encryption key handler: routes key requests
backend/pkg/web/server.go - FHIR resource handlers → Database repository: uses repository
- Summary handlers → Record summaries: retrieves summaries
- FHIR query engine → FHIR resource models: validates resource types
backend/pkg/database/gorm_repository_query.go - Resource graph → FHIR resource models: reads resource models
backend/pkg/database/gorm_repository_graph.go - Record summaries → FHIR resource models: reads resource models
backend/pkg/database/gorm_repository_summary.go - Database repository → GORM persistence: implemented with
- GORM persistence → PostgreSQL store: persists to
- GORM persistence → SQLite store: persists to
- HTTP server and routes → Event bus: configures middleware
backend/pkg/web/server.go - NLM terminology service → NLM LOINC forms: fetches LOINC forms
frontend/src/app/services/nlm-clinical-table-search.service.ts