# softdevdanial/streaky-habit architecture

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

- Interactive diagram: https://gitdiagram.com/softdevdanial/streaky-habit
- Repository: https://github.com/softdevdanial/streaky-habit

## Overview

Streaky Habit is a browser-only habit tracker: users record daily completions, review rings across 12 weeks or a year, and edit past days; streaks and saved state update with each change. The app module orchestrates domain rules, persistence, and screen rendering. Calendar arithmetic and ring geometry are supporting layers. The README documents the product views and local-only storage; sampled source and the SOURCE INDEX establish module dependencies. Some rendering and event wiring is only partially excerpted, so the graph omits unshown call details.

Main entry points: [`src/app.js`](https://github.com/softdevdanial/streaky-habit/blob/main/src/app.js) (App orchestration), [`src/calendar.js`](https://github.com/softdevdanial/streaky-habit/blob/main/src/calendar.js) (Calendar rendering), [`src/habits.js`](https://github.com/softdevdanial/streaky-habit/blob/main/src/habits.js) (Habit rules), [`src/popups.js`](https://github.com/softdevdanial/streaky-habit/blob/main/src/popups.js) (Dialogs and views)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["App interaction"]
  node_app["App orchestration<br/>[app.js]"]
end

subgraph group_domain["Habit domain"]
  node_rules["Habit rules<br/>[habits.js]"]
  node_dates["Date utilities<br/>[dates.js]"]
end

subgraph group_presentation["Views and rendering"]
  node_mainview["Main screen<br/>[view.js]"]
  node_popups["Dialogs and views<br/>[popups.js]"]
  node_calendar["Calendar rendering<br/>[calendar.js]"]
  node_ring["Ring geometry<br/>[ring.js]"]
end

subgraph group_persistence["Browser persistence"]
  node_storage["State persistence<br/>[storage.js]"]
  node_localstorage[("Browser localStorage")]
end

node_person(("Habit tracker"))

node_person -->|"uses"| node_app
node_app -->|"loads and saves"| node_storage
node_storage -->|"reads and writes"| node_localstorage
node_app -->|"updates habits"| node_rules
node_app -->|"renders screen"| node_mainview
node_app -->|"opens views"| node_popups
node_app -->|"finds day control"| node_calendar
node_rules -->|"uses calendar math"| node_dates
node_storage -->|"validates habits"| node_rules
node_storage -->|"validates dates"| node_dates
node_mainview -->|"calculates streaks"| node_rules
node_mainview -->|"draws overview"| node_calendar
node_mainview -->|"formats dates"| node_dates
node_popups -->|"calculates streaks"| node_rules
node_popups -->|"draws popup grids"| node_calendar
node_popups -->|"uses stats rendering"| node_mainview
node_popups -->|"formats dates"| node_dates
node_calendar -->|"uses completion flags"| node_rules
node_calendar -->|"formats calendar days"| node_dates
node_calendar -->|"uses ring geometry"| node_ring

click node_app "https://github.com/softdevdanial/streaky-habit/blob/main/src/app.js"
click node_rules "https://github.com/softdevdanial/streaky-habit/blob/main/src/habits.js"
click node_dates "https://github.com/softdevdanial/streaky-habit/blob/main/src/dates.js"
click node_storage "https://github.com/softdevdanial/streaky-habit/blob/main/src/storage.js"
click node_mainview "https://github.com/softdevdanial/streaky-habit/blob/main/src/view.js"
click node_popups "https://github.com/softdevdanial/streaky-habit/blob/main/src/popups.js"
click node_calendar "https://github.com/softdevdanial/streaky-habit/blob/main/src/calendar.js"
click node_ring "https://github.com/softdevdanial/streaky-habit/blob/main/src/ring.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 toneBlue
class node_rules,node_dates toneAmber
class node_mainview,node_popups,node_calendar,node_ring toneMint
class node_storage,node_localstorage toneRose
class node_person toneIndigo
```

## Components

### App interaction

- [App orchestration](https://github.com/softdevdanial/streaky-habit/blob/main/src/app.js): `src/app.js`

### Habit domain

- [Habit rules](https://github.com/softdevdanial/streaky-habit/blob/main/src/habits.js): `src/habits.js`
- [Date utilities](https://github.com/softdevdanial/streaky-habit/blob/main/src/dates.js): `src/dates.js`

### Views and rendering

- [Main screen](https://github.com/softdevdanial/streaky-habit/blob/main/src/view.js): `src/view.js`
- [Dialogs and views](https://github.com/softdevdanial/streaky-habit/blob/main/src/popups.js): `src/popups.js`
- [Calendar rendering](https://github.com/softdevdanial/streaky-habit/blob/main/src/calendar.js): `src/calendar.js`
- [Ring geometry](https://github.com/softdevdanial/streaky-habit/blob/main/src/ring.js): `src/ring.js`

### Browser persistence

- [State persistence](https://github.com/softdevdanial/streaky-habit/blob/main/src/storage.js): `src/storage.js`
- **Browser localStorage**

### Other components

- **Habit tracker**

## Connections

- Habit tracker → App orchestration: uses (evidence: `README.md`)
- App orchestration → State persistence: loads and saves (evidence: `src/app.js`)
- State persistence → Browser localStorage: reads and writes (evidence: `src/storage.js`)
- App orchestration → Habit rules: updates habits (evidence: `src/app.js`)
- App orchestration → Main screen: renders screen (evidence: `src/app.js`)
- App orchestration → Dialogs and views: opens views (evidence: `src/app.js`)
- App orchestration → Calendar rendering: finds day control (evidence: `src/app.js`)
- Habit rules → Date utilities: uses calendar math (evidence: `src/habits.js`)
- State persistence → Habit rules: validates habits (evidence: `src/storage.js`)
- State persistence → Date utilities: validates dates (evidence: `src/storage.js`)
- Main screen → Habit rules: calculates streaks (evidence: `src/view.js`)
- Main screen → Calendar rendering: draws overview (evidence: `src/view.js`)
- Main screen → Date utilities: formats dates (evidence: `src/view.js`)
- Dialogs and views → Habit rules: calculates streaks (evidence: `src/popups.js`)
- Dialogs and views → Calendar rendering: draws popup grids (evidence: `src/popups.js`)
- Dialogs and views → Main screen: uses stats rendering (evidence: `src/popups.js`)
- Dialogs and views → Date utilities: formats dates (evidence: `src/popups.js`)
- Calendar rendering → Habit rules: uses completion flags (evidence: `src/calendar.js`)
- Calendar rendering → Date utilities: formats calendar days (evidence: `src/calendar.js`)
- Calendar rendering → Ring geometry: uses ring geometry (evidence: `src/calendar.js`)
