# jnaurot/pillreminder architecture

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

- Interactive diagram: https://gitdiagram.com/jnaurot/pillreminder
- Repository: https://github.com/jnaurot/pillreminder

## Overview

This is a caregiver-focused medication management app. Its main workflow is to maintain people and medication schedules, calculate daily doses, record doses taken or skipped, and schedule reminders. Separate workflows support medication history, refills and drug information, plus caregiver shifts and secure medication handoffs. The sampled sources show an encrypted SQLite store and the main scheduling and messaging layers; some route capabilities are represented by tree paths and source-index references rather than inspected implementations.

Main entry points: [`app/entities/[id]/index.tsx`](https://github.com/jnaurot/pillreminder/blob/master/app/entities/%5Bid%5D/index.tsx) (Person overview), [`app/entities/[id]/medications/[medId]/index.tsx`](https://github.com/jnaurot/pillreminder/blob/master/app/entities/%5Bid%5D/medications/%5BmedId%5D/index.tsx) (Medication details), [`src/db/medications.ts`](https://github.com/jnaurot/pillreminder/blob/master/src/db/medications.ts) (Medication records), [`app/today.tsx`](https://github.com/jnaurot/pillreminder/blob/master/app/today.tsx) (Today’s doses)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_care["People and care"]
  node_people["People and records<br/>[index.tsx]"]
  node_person_detail["Person overview<br/>[index.tsx]"]
  node_compliance["Compliance history<br/>[compliance.tsx]"]
  node_history["Person history<br/>[history.tsx]"]
end

subgraph group_meds["Medication management"]
  node_med_editor["Medication editor<br/>[MedicationForm.tsx]"]
  node_med_detail["Medication details<br/>[index.tsx]"]
  node_med_history["Medication history<br/>[history.tsx]"]
  node_refill["Refill workflow<br/>[refill.tsx]"]
  node_rxnorm["Drug information lookup<br/>[rxnorm.ts]"]
end

subgraph group_runtime["Daily medication runtime"]
  node_home["App entry<br/>[index.tsx]"]
  node_today["Today’s doses<br/>[today.tsx]"]
  node_dose_card["Dose actions<br/>[DoseCard.tsx]"]
  node_dose_engine[("Dose schedule and logs<br/>[doseLogs.ts]")]
  node_notifications["Reminder scheduler<br/>[scheduler.ts]"]
end

subgraph group_sharing["Caregiver sharing"]
  node_caregiver_routes["Caregiver shifts<br/>[index.tsx]"]
  node_shift_create["Create shift<br/>[new.tsx]"]
  node_incoming["Incoming invitations<br/>[incoming.tsx]"]
  node_secure_protocol["Secure handoff protocol<br/>[secureProtocol.ts]"]
  node_transport["Message transport<br/>[transport.ts]"]
end

subgraph group_platform["Storage and settings"]
  node_med_db[("Medication records<br/>[medications.ts]")]
  node_prescriptions[("Prescription records<br/>[prescriptions.ts]")]
  node_caregiver_db[("Caregiver records<br/>[caregivers.ts]")]
  node_settings["App settings<br/>[settings.tsx]"]
  node_settings_store[("Settings records<br/>[settings.ts]")]
  node_backup["Data backup<br/>[backup.ts]"]
  node_database[("Encrypted local database<br/>[database.ts]")]
end

node_user(("Caregiver"))
node_drug_service["Drug information services"]

node_user -->|"opens"| node_home
node_home -->|"routes to"| node_today
node_user -->|"manages"| node_people
node_people -.->|"opens"| node_person_detail
node_person_detail -.->|"opens"| node_compliance
node_person_detail -.->|"opens"| node_history
node_person_detail -.->|"opens"| node_med_detail
node_people -->|"reads records"| node_med_db
node_people -->|"reads shifts"| node_caregiver_db
node_person_detail -->|"reads records"| node_med_db
node_person_detail -->|"reads supply"| node_prescriptions
node_person_detail -->|"updates reminders"| node_notifications
node_user -->|"edits schedule"| node_med_editor
node_med_editor -->|"writes medication"| node_med_db
node_med_detail -->|"reads medication"| node_med_db
node_med_detail -->|"reads supply"| node_prescriptions
node_med_detail -->|"updates reminders"| node_notifications
node_med_detail -->|"requests enrichment"| node_rxnorm
node_rxnorm -->|"queries"| node_drug_service
node_rxnorm -->|"updates drug info"| node_med_db
node_med_detail -.->|"opens history"| node_med_history
node_med_detail -.->|"opens refill"| node_refill
node_refill -.->|"records refill"| node_prescriptions
node_user -->|"reviews doses"| node_today
node_today -->|"loads daily doses"| node_dose_engine
node_today -->|"renders actions"| node_dose_card
node_dose_card -->|"records dose"| node_dose_engine
node_today -->|"refreshes reminders"| node_notifications
node_dose_engine -->|"loads schedules"| node_med_db
node_dose_engine -->|"checks active shift"| node_caregiver_db
node_user -->|"manages shifts"| node_caregiver_routes
node_user -->|"creates shift"| node_shift_create
node_user -->|"reviews invitations"| node_incoming
node_caregiver_routes -->|"creates envelopes"| node_secure_protocol
node_caregiver_routes -->|"sends envelopes"| node_transport
node_shift_create -->|"creates handoff"| node_secure_protocol
node_shift_create -->|"sends messages"| node_transport
node_incoming -->|"handles protocol"| node_secure_protocol
node_incoming -->|"receives messages"| node_transport
node_incoming -->|"updates shifts"| node_caregiver_db
node_secure_protocol -->|"reads and writes"| node_database
node_caregiver_db -->|"loads medications"| node_med_db
node_user -->|"configures app"| node_settings
node_settings -->|"reads and writes"| node_settings_store
node_settings -->|"backs up data"| node_backup
node_settings -->|"configures alerts"| node_notifications
node_settings_store -->|"uses store"| node_database
node_med_db -->|"uses store"| node_database

click node_home "https://github.com/jnaurot/pillreminder/blob/master/app/index.tsx"
click node_people "https://github.com/jnaurot/pillreminder/blob/master/app/entities/index.tsx"
click node_person_detail "https://github.com/jnaurot/pillreminder/blob/master/app/entities/%5Bid%5D/index.tsx"
click node_compliance "https://github.com/jnaurot/pillreminder/blob/master/app/entities/%5Bid%5D/compliance.tsx"
click node_history "https://github.com/jnaurot/pillreminder/blob/master/app/entities/%5Bid%5D/history.tsx"
click node_med_editor "https://github.com/jnaurot/pillreminder/blob/master/src/components/MedicationForm.tsx"
click node_med_detail "https://github.com/jnaurot/pillreminder/blob/master/app/entities/%5Bid%5D/medications/%5BmedId%5D/index.tsx"
click node_med_history "https://github.com/jnaurot/pillreminder/blob/master/app/entities/%5Bid%5D/medications/%5BmedId%5D/history.tsx"
click node_refill "https://github.com/jnaurot/pillreminder/blob/master/app/entities/%5Bid%5D/medications/%5BmedId%5D/refill.tsx"
click node_med_db "https://github.com/jnaurot/pillreminder/blob/master/src/db/medications.ts"
click node_prescriptions "https://github.com/jnaurot/pillreminder/blob/master/src/db/prescriptions.ts"
click node_rxnorm "https://github.com/jnaurot/pillreminder/blob/master/src/services/rxnorm.ts"
click node_today "https://github.com/jnaurot/pillreminder/blob/master/app/today.tsx"
click node_dose_card "https://github.com/jnaurot/pillreminder/blob/master/src/components/DoseCard.tsx"
click node_dose_engine "https://github.com/jnaurot/pillreminder/blob/master/src/db/doseLogs.ts"
click node_notifications "https://github.com/jnaurot/pillreminder/blob/master/src/notifications/scheduler.ts"
click node_caregiver_routes "https://github.com/jnaurot/pillreminder/blob/master/app/caregivers/index.tsx"
click node_shift_create "https://github.com/jnaurot/pillreminder/blob/master/app/caregivers/shift/new.tsx"
click node_incoming "https://github.com/jnaurot/pillreminder/blob/master/app/caregivers/incoming.tsx"
click node_caregiver_db "https://github.com/jnaurot/pillreminder/blob/master/src/db/caregivers.ts"
click node_secure_protocol "https://github.com/jnaurot/pillreminder/blob/master/src/messaging/secureProtocol.ts"
click node_transport "https://github.com/jnaurot/pillreminder/blob/master/src/messaging/transport.ts"
click node_settings "https://github.com/jnaurot/pillreminder/blob/master/app/settings.tsx"
click node_settings_store "https://github.com/jnaurot/pillreminder/blob/master/src/db/settings.ts"
click node_backup "https://github.com/jnaurot/pillreminder/blob/master/src/db/backup.ts"
click node_database "https://github.com/jnaurot/pillreminder/blob/master/src/db/database.ts"

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_people,node_person_detail,node_compliance,node_history toneBlue
class node_med_editor,node_med_detail,node_med_history,node_refill,node_rxnorm toneAmber
class node_home,node_today,node_dose_card,node_dose_engine,node_notifications toneMint
class node_caregiver_routes,node_shift_create,node_incoming,node_secure_protocol,node_transport toneRose
class node_med_db,node_prescriptions,node_caregiver_db,node_settings,node_settings_store,node_backup,node_database,node_user,node_drug_service toneIndigo
```

## Components

### People and care

- [People and records](https://github.com/jnaurot/pillreminder/blob/master/app/entities/index.tsx): `app/entities/index.tsx`
- [Person overview](https://github.com/jnaurot/pillreminder/blob/master/app/entities/%5Bid%5D/index.tsx): `app/entities/[id]/index.tsx`
- [Compliance history](https://github.com/jnaurot/pillreminder/blob/master/app/entities/%5Bid%5D/compliance.tsx): `app/entities/[id]/compliance.tsx`
- [Person history](https://github.com/jnaurot/pillreminder/blob/master/app/entities/%5Bid%5D/history.tsx): `app/entities/[id]/history.tsx`

### Medication management

- [Medication editor](https://github.com/jnaurot/pillreminder/blob/master/src/components/MedicationForm.tsx): `src/components/MedicationForm.tsx`
- [Medication details](https://github.com/jnaurot/pillreminder/blob/master/app/entities/%5Bid%5D/medications/%5BmedId%5D/index.tsx): `app/entities/[id]/medications/[medId]/index.tsx`
- [Medication history](https://github.com/jnaurot/pillreminder/blob/master/app/entities/%5Bid%5D/medications/%5BmedId%5D/history.tsx): `app/entities/[id]/medications/[medId]/history.tsx`
- [Refill workflow](https://github.com/jnaurot/pillreminder/blob/master/app/entities/%5Bid%5D/medications/%5BmedId%5D/refill.tsx): `app/entities/[id]/medications/[medId]/refill.tsx`
- [Drug information lookup](https://github.com/jnaurot/pillreminder/blob/master/src/services/rxnorm.ts): `src/services/rxnorm.ts`

### Daily medication runtime

- [App entry](https://github.com/jnaurot/pillreminder/blob/master/app/index.tsx): `app/index.tsx`
- [Today’s doses](https://github.com/jnaurot/pillreminder/blob/master/app/today.tsx): `app/today.tsx`
- [Dose actions](https://github.com/jnaurot/pillreminder/blob/master/src/components/DoseCard.tsx): `src/components/DoseCard.tsx`
- [Dose schedule and logs](https://github.com/jnaurot/pillreminder/blob/master/src/db/doseLogs.ts): `src/db/doseLogs.ts`
- [Reminder scheduler](https://github.com/jnaurot/pillreminder/blob/master/src/notifications/scheduler.ts): `src/notifications/scheduler.ts`

### Caregiver sharing

- [Caregiver shifts](https://github.com/jnaurot/pillreminder/blob/master/app/caregivers/index.tsx): `app/caregivers/index.tsx`
- [Create shift](https://github.com/jnaurot/pillreminder/blob/master/app/caregivers/shift/new.tsx): `app/caregivers/shift/new.tsx`
- [Incoming invitations](https://github.com/jnaurot/pillreminder/blob/master/app/caregivers/incoming.tsx): `app/caregivers/incoming.tsx`
- [Secure handoff protocol](https://github.com/jnaurot/pillreminder/blob/master/src/messaging/secureProtocol.ts): `src/messaging/secureProtocol.ts`
- [Message transport](https://github.com/jnaurot/pillreminder/blob/master/src/messaging/transport.ts): `src/messaging/transport.ts`

### Storage and settings

- [Medication records](https://github.com/jnaurot/pillreminder/blob/master/src/db/medications.ts): `src/db/medications.ts`
- [Prescription records](https://github.com/jnaurot/pillreminder/blob/master/src/db/prescriptions.ts): `src/db/prescriptions.ts`
- [Caregiver records](https://github.com/jnaurot/pillreminder/blob/master/src/db/caregivers.ts): `src/db/caregivers.ts`
- [App settings](https://github.com/jnaurot/pillreminder/blob/master/app/settings.tsx): `app/settings.tsx`
- [Settings records](https://github.com/jnaurot/pillreminder/blob/master/src/db/settings.ts): `src/db/settings.ts`
- [Data backup](https://github.com/jnaurot/pillreminder/blob/master/src/db/backup.ts): `src/db/backup.ts`
- [Encrypted local database](https://github.com/jnaurot/pillreminder/blob/master/src/db/database.ts): `src/db/database.ts`

### Other components

- **Caregiver**
- **Drug information services**

## Connections

- Caregiver → App entry: opens (evidence: `app/index.tsx`)
- App entry → Today’s doses: routes to (evidence: `app/index.tsx`)
- Caregiver → People and records: manages (evidence: `app/entities/index.tsx`)
- People and records → Person overview: opens
- Person overview → Compliance history: opens
- Person overview → Person history: opens
- Person overview → Medication details: opens
- People and records → Medication records: reads records (evidence: `app/entities/index.tsx`)
- People and records → Caregiver records: reads shifts (evidence: `app/entities/index.tsx`)
- Person overview → Medication records: reads records (evidence: `app/entities/[id]/index.tsx`)
- Person overview → Prescription records: reads supply (evidence: `app/entities/[id]/index.tsx`)
- Person overview → Reminder scheduler: updates reminders (evidence: `app/entities/[id]/index.tsx`)
- Caregiver → Medication editor: edits schedule
- Medication editor → Medication records: writes medication (evidence: `src/components/MedicationForm.tsx`)
- Medication details → Medication records: reads medication (evidence: `app/entities/[id]/medications/[medId]/index.tsx`)
- Medication details → Prescription records: reads supply (evidence: `app/entities/[id]/medications/[medId]/index.tsx`)
- Medication details → Reminder scheduler: updates reminders (evidence: `app/entities/[id]/medications/[medId]/index.tsx`)
- Medication details → Drug information lookup: requests enrichment (evidence: `app/entities/[id]/medications/[medId]/index.tsx`)
- Drug information lookup → Drug information services: queries (evidence: `src/services/rxnorm.ts`)
- Drug information lookup → Medication records: updates drug info (evidence: `src/services/rxnorm.ts`)
- Medication details → Medication history: opens history
- Medication details → Refill workflow: opens refill
- Refill workflow → Prescription records: records refill
- Caregiver → Today’s doses: reviews doses (evidence: `app/today.tsx`)
- Today’s doses → Dose schedule and logs: loads daily doses (evidence: `app/today.tsx`)
- Today’s doses → Dose actions: renders actions (evidence: `app/today.tsx`)
- Dose actions → Dose schedule and logs: records dose (evidence: `src/components/DoseCard.tsx`)
- Today’s doses → Reminder scheduler: refreshes reminders (evidence: `app/today.tsx`)
- Dose schedule and logs → Medication records: loads schedules (evidence: `src/db/doseLogs.ts`)
- Dose schedule and logs → Caregiver records: checks active shift (evidence: `src/db/doseLogs.ts`)
- Caregiver → Caregiver shifts: manages shifts (evidence: `app/caregivers/index.tsx`)
- Caregiver → Create shift: creates shift (evidence: `app/caregivers/shift/new.tsx`)
- Caregiver → Incoming invitations: reviews invitations (evidence: `app/caregivers/incoming.tsx`)
- Caregiver shifts → Secure handoff protocol: creates envelopes (evidence: `app/caregivers/index.tsx`)
- Caregiver shifts → Message transport: sends envelopes (evidence: `app/caregivers/index.tsx`)
- Create shift → Secure handoff protocol: creates handoff (evidence: `app/caregivers/shift/new.tsx`)
- Create shift → Message transport: sends messages (evidence: `app/caregivers/shift/new.tsx`)
- Incoming invitations → Secure handoff protocol: handles protocol (evidence: `app/caregivers/incoming.tsx`)
- Incoming invitations → Message transport: receives messages (evidence: `app/caregivers/incoming.tsx`)
- Incoming invitations → Caregiver records: updates shifts (evidence: `app/caregivers/incoming.tsx`)
- Secure handoff protocol → Encrypted local database: reads and writes (evidence: `src/messaging/secureProtocol.ts`)
- Caregiver records → Medication records: loads medications (evidence: `src/db/caregivers.ts`)
- Caregiver → App settings: configures app (evidence: `app/settings.tsx`)
- App settings → Settings records: reads and writes (evidence: `app/settings.tsx`)
- App settings → Data backup: backs up data (evidence: `app/settings.tsx`)
- App settings → Reminder scheduler: configures alerts (evidence: `app/settings.tsx`)
- Settings records → Encrypted local database: uses store (evidence: `src/db/settings.ts`)
- Medication records → Encrypted local database: uses store (evidence: `src/db/medications.ts`)
