# mbombeck/healthlog architecture

> Architecture diagram of the GitHub repository mbombeck/healthlog, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mbombeck/healthlog
- Repository: https://github.com/mbombeck/healthlog

## Overview

HealthLog is a self-hosted health-record web app and companion-app ecosystem. Its central workflow is to collect or import health data, store it on the user's server, and present it as a longitudinal record with dashboards and insights. The graph preserves major README capabilities, including medication tracking, document handling, sharing, integrations, and AI coaching. Relationships are cited to the README where documented; sampled source confirms client API access and the coach/insights processing layers, but does not establish most route-to-storage calls.

Main entry points: [`src/app/api`](https://github.com/mbombeck/healthlog/tree/main/src/app/api) (Application API), [`src/app/api/mood-entries`](https://github.com/mbombeck/healthlog/tree/main/src/app/api/mood-entries) (Diaries and cycle), [`src/app/api/integrations`](https://github.com/mbombeck/healthlog/tree/main/src/app/api/integrations) (Device connections), [`src/app/api/import`](https://github.com/mbombeck/healthlog/tree/main/src/app/api/import) (File imports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and sync"]
  node_integrations["Device connections"]
  node_imports["File imports"]
end

subgraph group_record["Health record"]
  node_api_routes["Application API"]
  node_measurements["Vitals and activity"]
  node_medications["Medication tracking"]
  node_diaries["Diaries and cycle"]
  node_clinical_record["Clinical record"]
  node_documents["Document vault"]
  node_cycle_engine["Cycle analysis<br/>[engine-adapter.ts]"]
end

subgraph group_experience["Review and insights"]
  node_web["Web experience"]
  node_client_api["Client API access<br/>[api-fetch.ts]"]
  node_dashboard["Dashboard and timeline<br/>[page-client.tsx]"]
  node_insights["Health insights<br/>[status-pipeline.ts]"]
  node_coach["AI health coach<br/>[pipeline.ts]"]
end

subgraph group_access["Access and sharing"]
  node_pdf_reports["Doctor reports<br/>[pdf-engine.mjs]"]
  node_sharing["Sharing and FHIR"]
  node_emergency_card["Emergency card"]
  node_households["Managed profiles"]
end

subgraph group_operations["Server operations"]
  node_admin["Administration"]
end

node_person(("Health tracker"))
node_postgres[("Postgres database")]

node_person -->|"uses"| node_web
node_person -->|"connects devices"| node_integrations
node_person -->|"imports records"| node_imports
node_web -->|"requests data"| node_client_api
node_client_api -->|"calls API"| node_api_routes
node_integrations -->|"syncs records"| node_api_routes
node_imports -->|"submits records"| node_api_routes
node_api_routes -.->|"records vitals"| node_measurements
node_api_routes -.->|"records doses"| node_medications
node_api_routes -.->|"records diaries"| node_diaries
node_api_routes -.->|"records clinical data"| node_clinical_record
node_api_routes -.->|"manages documents"| node_documents
node_measurements -->|"stores record"| node_postgres
node_medications -->|"stores record"| node_postgres
node_diaries -->|"stores record"| node_postgres
node_clinical_record -->|"stores record"| node_postgres
node_documents -->|"stores encrypted data"| node_postgres
node_postgres -->|"feeds timeline"| node_dashboard
node_postgres -->|"grounds analysis"| node_insights
node_insights -->|"grounds conversation"| node_coach
node_cycle_engine -.->|"analyzes cycle"| node_diaries
node_postgres -->|"supplies report data"| node_pdf_reports
node_postgres -->|"serves shared records"| node_sharing
node_postgres -->|"provides emergency details"| node_emergency_card
node_person -->|"manages profiles"| node_households
node_admin -.->|"administers data"| node_postgres

click node_web "https://github.com/mbombeck/healthlog/tree/main/src/app"
click node_client_api "https://github.com/mbombeck/healthlog/blob/main/src/lib/api/api-fetch.ts"
click node_api_routes "https://github.com/mbombeck/healthlog/tree/main/src/app/api"
click node_integrations "https://github.com/mbombeck/healthlog/tree/main/src/app/api/integrations"
click node_imports "https://github.com/mbombeck/healthlog/tree/main/src/app/api/import"
click node_measurements "https://github.com/mbombeck/healthlog/tree/main/src/app/api/measurements"
click node_medications "https://github.com/mbombeck/healthlog/tree/main/src/app/api/medications"
click node_diaries "https://github.com/mbombeck/healthlog/tree/main/src/app/api/mood-entries"
click node_clinical_record "https://github.com/mbombeck/healthlog/tree/main/src/app/api/labs"
click node_documents "https://github.com/mbombeck/healthlog/tree/main/src/app/api/documents"
click node_dashboard "https://github.com/mbombeck/healthlog/blob/main/src/app/page-client.tsx"
click node_insights "https://github.com/mbombeck/healthlog/blob/main/src/lib/insights/status-pipeline.ts"
click node_coach "https://github.com/mbombeck/healthlog/blob/main/src/lib/ai/coach/turn/pipeline.ts"
click node_cycle_engine "https://github.com/mbombeck/healthlog/blob/main/src/lib/cycle/engine-adapter.ts"
click node_pdf_reports "https://github.com/mbombeck/healthlog/blob/main/src/lib/documents/pdf-engine.mjs"
click node_sharing "https://github.com/mbombeck/healthlog/tree/main/src/app/api/fhir"
click node_emergency_card "https://github.com/mbombeck/healthlog/tree/main/src/app/api/emergency-card"
click node_households "https://github.com/mbombeck/healthlog/tree/main/src/app/api/managed-profiles"
click node_admin "https://github.com/mbombeck/healthlog/tree/main/src/app/api/admin"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_integrations,node_imports toneBlue
class node_api_routes,node_measurements,node_medications,node_diaries,node_clinical_record,node_documents,node_cycle_engine,node_postgres toneAmber
class node_web,node_client_api,node_dashboard,node_insights,node_coach toneMint
class node_pdf_reports,node_sharing,node_emergency_card,node_households toneRose
class node_admin,node_person toneIndigo
```

## Components

### Capture and sync

- [Device connections](https://github.com/mbombeck/healthlog/tree/main/src/app/api/integrations): `src/app/api/integrations`
- [File imports](https://github.com/mbombeck/healthlog/tree/main/src/app/api/import): `src/app/api/import`

### Health record

- [Application API](https://github.com/mbombeck/healthlog/tree/main/src/app/api): `src/app/api`
- [Vitals and activity](https://github.com/mbombeck/healthlog/tree/main/src/app/api/measurements): `src/app/api/measurements`
- [Medication tracking](https://github.com/mbombeck/healthlog/tree/main/src/app/api/medications): `src/app/api/medications`
- [Diaries and cycle](https://github.com/mbombeck/healthlog/tree/main/src/app/api/mood-entries): `src/app/api/mood-entries`
- [Clinical record](https://github.com/mbombeck/healthlog/tree/main/src/app/api/labs): `src/app/api/labs`
- [Document vault](https://github.com/mbombeck/healthlog/tree/main/src/app/api/documents): `src/app/api/documents`
- [Cycle analysis](https://github.com/mbombeck/healthlog/blob/main/src/lib/cycle/engine-adapter.ts): `src/lib/cycle/engine-adapter.ts`

### Review and insights

- [Web experience](https://github.com/mbombeck/healthlog/tree/main/src/app): `src/app`
- [Client API access](https://github.com/mbombeck/healthlog/blob/main/src/lib/api/api-fetch.ts): `src/lib/api/api-fetch.ts`
- [Dashboard and timeline](https://github.com/mbombeck/healthlog/blob/main/src/app/page-client.tsx): `src/app/page-client.tsx`
- [Health insights](https://github.com/mbombeck/healthlog/blob/main/src/lib/insights/status-pipeline.ts): `src/lib/insights/status-pipeline.ts`
- [AI health coach](https://github.com/mbombeck/healthlog/blob/main/src/lib/ai/coach/turn/pipeline.ts): `src/lib/ai/coach/turn/pipeline.ts`

### Access and sharing

- [Doctor reports](https://github.com/mbombeck/healthlog/blob/main/src/lib/documents/pdf-engine.mjs): `src/lib/documents/pdf-engine.mjs`
- [Sharing and FHIR](https://github.com/mbombeck/healthlog/tree/main/src/app/api/fhir): `src/app/api/fhir`
- [Emergency card](https://github.com/mbombeck/healthlog/tree/main/src/app/api/emergency-card): `src/app/api/emergency-card`
- [Managed profiles](https://github.com/mbombeck/healthlog/tree/main/src/app/api/managed-profiles): `src/app/api/managed-profiles`

### Server operations

- [Administration](https://github.com/mbombeck/healthlog/tree/main/src/app/api/admin): `src/app/api/admin`

### Other components

- **Health tracker**
- **Postgres database**

## Connections

- Health tracker → Web experience: uses (evidence: `README.md`)
- Health tracker → Device connections: connects devices (evidence: `README.md`)
- Health tracker → File imports: imports records (evidence: `README.md`)
- Web experience → Client API access: requests data (evidence: `src/app/page-client.tsx`)
- Client API access → Application API: calls API (evidence: `src/lib/api/api-fetch.ts`)
- Device connections → Application API: syncs records (evidence: `README.md`)
- File imports → Application API: submits records (evidence: `README.md`)
- Application API → Vitals and activity: records vitals
- Application API → Medication tracking: records doses
- Application API → Diaries and cycle: records diaries
- Application API → Clinical record: records clinical data
- Application API → Document vault: manages documents
- Vitals and activity → Postgres database: stores record (evidence: `README.md`)
- Medication tracking → Postgres database: stores record (evidence: `README.md`)
- Diaries and cycle → Postgres database: stores record (evidence: `README.md`)
- Clinical record → Postgres database: stores record (evidence: `README.md`)
- Document vault → Postgres database: stores encrypted data (evidence: `README.md`)
- Postgres database → Dashboard and timeline: feeds timeline (evidence: `README.md`)
- Postgres database → Health insights: grounds analysis (evidence: `README.md`)
- Health insights → AI health coach: grounds conversation (evidence: `README.md`)
- Cycle analysis → Diaries and cycle: analyzes cycle
- Postgres database → Doctor reports: supplies report data (evidence: `README.md`)
- Postgres database → Sharing and FHIR: serves shared records (evidence: `README.md`)
- Postgres database → Emergency card: provides emergency details (evidence: `README.md`)
- Health tracker → Managed profiles: manages profiles (evidence: `README.md`)
- Administration → Postgres database: administers data
