# zayothmane33-cpu/habit-flow architecture

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

- Interactive diagram: https://gitdiagram.com/zayothmane33-cpu/habit-flow
- Repository: https://github.com/zayothmane33-cpu/habit-flow

## Overview

HabitFlow is a local-first habit tracker. The main workflow is to set up the app, create habits, record progress, and review history and rewards; the README also highlights XP, levels, badges, challenges, and a calendar. The runtime is concentrated in one large JavaScript file, so these nodes represent responsibilities within that file rather than separate services. The source excerpt is partial, and the README contains no implementation detail, so some feature connections are not shown.

Main entry points: [`script.js`](https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.js) (Habit management), [`index.html`](https://github.com/zayothmane33-cpu/habit-flow/blob/main/index.html) (App interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Setup and access"]
  node_page["App interface<br/>[index.html]"]
  node_onboarding["Onboarding<br/>[script.js]"]
  node_access["Session and access<br/>[script.js]"]
end

subgraph group_habits["Habit tracking"]
  node_habits["Habit management<br/>[script.js]"]
  node_schedule["Habit scheduling<br/>[script.js]"]
  node_state["Local app state<br/>[script.js]"]
  node_storage[("Device storage")]
end

subgraph group_insights["Progress and rewards"]
  node_calendar["Calendar history<br/>[script.js]"]
  node_gamification["XP and badges<br/>[script.js]"]
  node_challenges["Challenges<br/>[script.js]"]
  node_rewards["Rewards<br/>[script.js]"]
end

subgraph group_interaction["Assistant"]
  node_assistant["Habit assistant<br/>[script.js]"]
end

node_user(("User"))

node_user -->|"uses"| node_page
node_page -.->|"starts"| node_onboarding
node_onboarding -->|"checks session"| node_access
node_access -->|"reads legacy data"| node_storage
node_user -.->|"creates and tracks"| node_habits
node_habits -.->|"checks frequency"| node_schedule
node_habits -.->|"updates"| node_state
node_state -->|"persists locally"| node_storage
node_user -.->|"reviews history"| node_calendar
node_user -.->|"earns progress"| node_gamification
node_user -.->|"uses"| node_challenges
node_user -.->|"claims"| node_rewards
node_user -.->|"asks"| node_assistant
node_assistant -->|"opens add form"| node_habits
node_assistant -->|"gives reset guidance"| node_page

click node_page "https://github.com/zayothmane33-cpu/habit-flow/blob/main/index.html"
click node_onboarding "https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.js"
click node_access "https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.js"
click node_habits "https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.js"
click node_schedule "https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.js"
click node_state "https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.js"
click node_calendar "https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.js"
click node_gamification "https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.js"
click node_challenges "https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.js"
click node_rewards "https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.js"
click node_assistant "https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.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_page,node_onboarding,node_access,node_user toneBlue
class node_habits,node_schedule,node_state,node_storage toneAmber
class node_calendar,node_gamification,node_challenges,node_rewards toneMint
class node_assistant toneRose
```

## Components

### Setup and access

- [App interface](https://github.com/zayothmane33-cpu/habit-flow/blob/main/index.html): `index.html`
- [Onboarding](https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.js): `script.js`
- [Session and access](https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.js): `script.js`

### Habit tracking

- [Habit management](https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.js): `script.js`
- [Habit scheduling](https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.js): `script.js`
- [Local app state](https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.js): `script.js`
- **Device storage**

### Progress and rewards

- [Calendar history](https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.js): `script.js`
- [XP and badges](https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.js): `script.js`
- [Challenges](https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.js): `script.js`
- [Rewards](https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.js): `script.js`

### Assistant

- [Habit assistant](https://github.com/zayothmane33-cpu/habit-flow/blob/main/script.js): `script.js`

### Other components

- **User**

## Connections

- User → App interface: uses (evidence: `README.md`)
- App interface → Onboarding: starts
- Onboarding → Session and access: checks session (evidence: `script.js`)
- Session and access → Device storage: reads legacy data (evidence: `script.js`)
- User → Habit management: creates and tracks
- Habit management → Habit scheduling: checks frequency (evidence: `script.js`)
- Habit management → Local app state: updates (evidence: `script.js`)
- Local app state → Device storage: persists locally (evidence: `README.md`)
- User → Calendar history: reviews history
- User → XP and badges: earns progress
- User → Challenges: uses
- User → Rewards: claims
- User → Habit assistant: asks
- Habit assistant → Habit management: opens add form (evidence: `script.js`)
- Habit assistant → App interface: gives reset guidance (evidence: `script.js`)
