# balla-hemanth-srinivas/recovery-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/balla-hemanth-srinivas/recovery-tracker
- Repository: https://github.com/balla-hemanth-srinivas/recovery-tracker

## Overview

Recovery Tracker is a local-first habit recovery PWA. Users register or sign in, create habits with daily thresholds, record occurrences, and review calendar, streak, heatmap, and trend views; settings provide theme and data controls. Browser storage is the local source of truth, with optional GitHub Gist synchronization. The graph reflects sampled calls and README capabilities; some view dispatch and visualization wiring is not shown, so those links are omitted or marked unverified.

Main entry points: [`js/app.js`](https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/app.js) (App shell and routing), [`js/storage.js`](https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/storage.js) (Browser data store), [`js/sync.js`](https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/sync.js) (Gist sync engine), [`js/settings.js`](https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/settings.js) (Settings and data tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_app["App shell and routing<br/>[app.js]"]
  node_utils["Shared utilities<br/>[utils.js]"]
  node_service_worker["Offline service worker<br/>[sw.js]"]
end

subgraph group_tracking["Habit tracking"]
  node_habits["Habit management<br/>[habits.js]"]
  node_entries["Occurrence entry<br/>[entries.js]"]
  node_calendar["Monthly calendar<br/>[calendar.js]"]
end

subgraph group_insights["Progress insights"]
  node_stats["Streak statistics<br/>[stats.js]"]
  node_heatmap["Yearly heatmap<br/>[heatmap.js]"]
  node_charts["Trend charts<br/>[charts.js]"]
end

subgraph group_account_data["Account and data"]
  node_auth["Authentication<br/>[auth.js]"]
  node_settings["Settings and data tools<br/>[settings.js]"]
  node_storage[("Browser data store<br/>[storage.js]")]
  node_sync["Gist sync engine<br/>[sync.js]"]
end

node_person(("Tracker user"))
node_gist{{"GitHub Gist API"}}

node_person -->|"uses"| node_app
node_app -->|"initializes"| node_sync
node_app -->|"observes changes"| node_storage
node_app -->|"renders calendar"| node_calendar
node_app -->|"renders entries"| node_entries
node_app -.->|"shows insights"| node_stats
node_app -.->|"opens habit tools"| node_habits
node_app -.->|"opens settings"| node_settings
node_auth -->|"stores account"| node_storage
node_auth -->|"restores Gist"| node_sync
node_auth -->|"hashes password"| node_utils
node_habits -->|"updates habits"| node_storage
node_entries -->|"updates entries"| node_storage
node_entries -->|"refreshes view"| node_app
node_calendar -->|"reads occurrences"| node_storage
node_stats -->|"reads occurrences"| node_storage
node_heatmap -->|"reads occurrences"| node_storage
node_heatmap -->|"uses color scale"| node_calendar
node_charts -->|"reads occurrences"| node_storage
node_settings -->|"manages data"| node_storage
node_settings -->|"applies theme"| node_app
node_settings -->|"logs out"| node_auth
node_storage -->|"schedules sync"| node_sync
node_sync -->|"reads and writes"| node_storage
node_sync -->|"syncs data"| node_gist
node_service_worker -->|"bypasses cache"| node_gist

click node_app "https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/app.js"
click node_auth "https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/auth.js"
click node_habits "https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/habits.js"
click node_entries "https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/entries.js"
click node_calendar "https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/calendar.js"
click node_stats "https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/stats.js"
click node_heatmap "https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/heatmap.js"
click node_charts "https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/charts.js"
click node_settings "https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/settings.js"
click node_storage "https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/storage.js"
click node_sync "https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/sync.js"
click node_utils "https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/utils.js"
click node_service_worker "https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/sw.js"

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_app,node_utils,node_service_worker,node_person toneBlue
class node_habits,node_entries,node_calendar toneAmber
class node_stats,node_heatmap,node_charts,node_gist toneMint
class node_auth,node_settings,node_storage,node_sync toneRose
```

## Components

### App experience

- [App shell and routing](https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/app.js): `js/app.js`
- [Shared utilities](https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/utils.js): `js/utils.js`
- [Offline service worker](https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/sw.js): `sw.js`

### Habit tracking

- [Habit management](https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/habits.js): `js/habits.js`
- [Occurrence entry](https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/entries.js): `js/entries.js`
- [Monthly calendar](https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/calendar.js): `js/calendar.js`

### Progress insights

- [Streak statistics](https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/stats.js): `js/stats.js`
- [Yearly heatmap](https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/heatmap.js): `js/heatmap.js`
- [Trend charts](https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/charts.js): `js/charts.js`

### Account and data

- [Authentication](https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/auth.js): `js/auth.js`
- [Settings and data tools](https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/settings.js): `js/settings.js`
- [Browser data store](https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/storage.js): `js/storage.js`
- [Gist sync engine](https://github.com/balla-hemanth-srinivas/recovery-tracker/blob/main/js/sync.js): `js/sync.js`

### Other components

- **Tracker user**
- **GitHub Gist API**

## Connections

- Tracker user → App shell and routing: uses (evidence: `README.md`)
- App shell and routing → Gist sync engine: initializes (evidence: `js/app.js`)
- App shell and routing → Browser data store: observes changes (evidence: `js/app.js`)
- App shell and routing → Monthly calendar: renders calendar (evidence: `js/app.js`)
- App shell and routing → Occurrence entry: renders entries (evidence: `js/app.js`)
- App shell and routing → Streak statistics: shows insights
- App shell and routing → Habit management: opens habit tools
- App shell and routing → Settings and data tools: opens settings
- Authentication → Browser data store: stores account (evidence: `js/auth.js`)
- Authentication → Gist sync engine: restores Gist (evidence: `js/auth.js`)
- Authentication → Shared utilities: hashes password (evidence: `js/auth.js`)
- Habit management → Browser data store: updates habits (evidence: `js/habits.js`)
- Occurrence entry → Browser data store: updates entries (evidence: `js/entries.js`)
- Occurrence entry → App shell and routing: refreshes view (evidence: `js/entries.js`)
- Monthly calendar → Browser data store: reads occurrences (evidence: `js/calendar.js`)
- Streak statistics → Browser data store: reads occurrences (evidence: `js/stats.js`)
- Yearly heatmap → Browser data store: reads occurrences (evidence: `js/heatmap.js`)
- Yearly heatmap → Monthly calendar: uses color scale (evidence: `js/heatmap.js`)
- Trend charts → Browser data store: reads occurrences (evidence: `js/charts.js`)
- Settings and data tools → Browser data store: manages data (evidence: `js/settings.js`)
- Settings and data tools → App shell and routing: applies theme (evidence: `js/settings.js`)
- Settings and data tools → Authentication: logs out (evidence: `js/settings.js`)
- Browser data store → Gist sync engine: schedules sync (evidence: `js/storage.js`)
- Gist sync engine → Browser data store: reads and writes (evidence: `js/sync.js`)
- Gist sync engine → GitHub Gist API: syncs data (evidence: `js/sync.js`)
- Offline service worker → GitHub Gist API: bypasses cache (evidence: `sw.js`)
