# jsackey101/hydration-reminder architecture

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

- Interactive diagram: https://gitdiagram.com/jsackey101/hydration-reminder
- Repository: https://github.com/jsackey101/hydration-reminder

## Overview

Hydration Reminder is a Tauri tray app for scheduling drink reminders. Users log or undo drinks from the tray, respond to reminder popups, and change the interval and timeout in Settings. The scheduler owns the reminder state and transitions; persistence stores that state in the app data folder. The sampled excerpts establish tray dispatch, popup behavior, and badge rendering, but omit much of the application’s command and state-update wiring, so those connections are marked unverified rather than asserted.

Main entry points: [`src-tauri/src/lib.rs`](https://github.com/jsackey101/hydration-reminder/blob/main/src-tauri/src/lib.rs) (App coordinator), [`src-tauri/src/tray.rs`](https://github.com/jsackey101/hydration-reminder/blob/main/src-tauri/src/tray.rs) (Tray menu), [`src-tauri/src/settings.rs`](https://github.com/jsackey101/hydration-reminder/blob/main/src-tauri/src/settings.rs) (Settings window), [`src/settings.ts`](https://github.com/jsackey101/hydration-reminder/blob/main/src/settings.ts) (Settings UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["User interaction"]
  node_tray["Tray menu<br/>[tray.rs]"]
  node_settings["Settings window<br/>[settings.rs]"]
  node_settings_ui["Settings UI<br/>[settings.ts]"]
  node_popup_ui["Popup UI<br/>[popup.ts]"]
end

subgraph group_runtime["Reminder runtime"]
  node_app["App coordinator<br/>[lib.rs]"]
  node_scheduler["Reminder scheduler<br/>[scheduler.rs]"]
end

subgraph group_state["State and persistence"]
  node_persistence["State persistence<br/>[persist.rs]"]
  node_state_file[("state.json")]
end

subgraph group_presentation["Windows and tray"]
  node_popup["Reminder popup<br/>[popup.rs]"]
  node_badge["Count badge<br/>[badge.rs]"]
end

node_user(("User"))

node_user -->|"selects action"| node_tray
node_tray -->|"dispatches log/undo"| node_app
node_tray -->|"opens settings"| node_settings
node_user -.->|"answers prompt"| node_popup_ui
node_settings -->|"shows window"| node_settings_ui
node_settings_ui -.->|"updates settings"| node_app
node_popup_ui -.->|"submits answer"| node_app
node_app -->|"advances state"| node_scheduler
node_app -->|"loads state"| node_persistence
node_persistence -->|"reads/writes"| node_state_file
node_app -->|"shows/hides"| node_popup
node_app -.->|"refreshes view"| node_tray
node_tray -->|"renders badge"| node_badge

click node_tray "https://github.com/jsackey101/hydration-reminder/blob/main/src-tauri/src/tray.rs"
click node_settings "https://github.com/jsackey101/hydration-reminder/blob/main/src-tauri/src/settings.rs"
click node_settings_ui "https://github.com/jsackey101/hydration-reminder/blob/main/src/settings.ts"
click node_popup_ui "https://github.com/jsackey101/hydration-reminder/blob/main/src/popup.ts"
click node_app "https://github.com/jsackey101/hydration-reminder/blob/main/src-tauri/src/lib.rs"
click node_scheduler "https://github.com/jsackey101/hydration-reminder/blob/main/src-tauri/src/scheduler.rs"
click node_persistence "https://github.com/jsackey101/hydration-reminder/blob/main/src-tauri/src/persist.rs"
click node_popup "https://github.com/jsackey101/hydration-reminder/blob/main/src-tauri/src/popup.rs"
click node_badge "https://github.com/jsackey101/hydration-reminder/blob/main/src-tauri/src/badge.rs"

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_tray,node_settings,node_settings_ui,node_popup_ui,node_user toneBlue
class node_app,node_scheduler toneAmber
class node_persistence,node_state_file toneMint
class node_popup,node_badge toneRose
```

## Components

### User interaction

- [Tray menu](https://github.com/jsackey101/hydration-reminder/blob/main/src-tauri/src/tray.rs): `src-tauri/src/tray.rs`
- [Settings window](https://github.com/jsackey101/hydration-reminder/blob/main/src-tauri/src/settings.rs): `src-tauri/src/settings.rs`
- [Settings UI](https://github.com/jsackey101/hydration-reminder/blob/main/src/settings.ts): `src/settings.ts`
- [Popup UI](https://github.com/jsackey101/hydration-reminder/blob/main/src/popup.ts): `src/popup.ts`

### Reminder runtime

- [App coordinator](https://github.com/jsackey101/hydration-reminder/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`
- [Reminder scheduler](https://github.com/jsackey101/hydration-reminder/blob/main/src-tauri/src/scheduler.rs): `src-tauri/src/scheduler.rs`

### State and persistence

- [State persistence](https://github.com/jsackey101/hydration-reminder/blob/main/src-tauri/src/persist.rs): `src-tauri/src/persist.rs`
- **state.json**

### Windows and tray

- [Reminder popup](https://github.com/jsackey101/hydration-reminder/blob/main/src-tauri/src/popup.rs): `src-tauri/src/popup.rs`
- [Count badge](https://github.com/jsackey101/hydration-reminder/blob/main/src-tauri/src/badge.rs): `src-tauri/src/badge.rs`

### Other components

- **User**

## Connections

- User → Tray menu: selects action (evidence: `src-tauri/src/tray.rs`)
- Tray menu → App coordinator: dispatches log/undo (evidence: `src-tauri/src/tray.rs`)
- Tray menu → Settings window: opens settings (evidence: `src-tauri/src/tray.rs`)
- User → Popup UI: answers prompt
- Settings window → Settings UI: shows window (evidence: `src-tauri/src/settings.rs`)
- Settings UI → App coordinator: updates settings
- Popup UI → App coordinator: submits answer
- App coordinator → Reminder scheduler: advances state (evidence: `src-tauri/src/lib.rs`)
- App coordinator → State persistence: loads state (evidence: `src-tauri/src/lib.rs`)
- State persistence → state.json: reads/writes (evidence: `src-tauri/src/persist.rs`)
- App coordinator → Reminder popup: shows/hides (evidence: `src-tauri/src/lib.rs`)
- App coordinator → Tray menu: refreshes view (evidence: `src-tauri/src/lib.rs`)
- Tray menu → Count badge: renders badge (evidence: `src-tauri/src/tray.rs`)
