# artyomturkoff/habit_tracker architecture

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

- Interactive diagram: https://gitdiagram.com/artyomturkoff/habit_tracker
- Repository: https://github.com/artyomturkoff/habit_tracker

## Overview

This is a Python command-line habit tracker. A user selects a CLI workflow to check off, view, create, or delete habits, or inspect analytics. Habit logic maintains daily/weekly completion state and streaks; SQLite persists habits and completion history. First-run initialization can seed predefined habits and sample history. The README documents an overall-longest-streak report; source excerpts are partial, so uncertain internal wiring for that report is omitted.

Main entry points: [`main.py`](https://github.com/artyomturkoff/habit_tracker/blob/main/main.py) (Command-line app), [`data/predefined_habits.py`](https://github.com/artyomturkoff/habit_tracker/blob/main/data/predefined_habits.py) (Predefined sample data), [`database/sqlitedb.py`](https://github.com/artyomturkoff/habit_tracker/blob/main/database/sqlitedb.py) (SQLite storage), [`model/habit.py`](https://github.com/artyomturkoff/habit_tracker/blob/main/model/habit.py) (Habit state and streaks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["CLI workflows"]
  node_cli["Command-line app<br/>[main.py]"]
  node_workflows["Habit workflows<br/>[main.py]"]
end

subgraph group_domain["Habit domain"]
  node_habit["Habit state and streaks<br/>[habit.py]"]
end

subgraph group_insights["Analytics"]
  node_analytics["Habit analytics<br/>[analytics.py]"]
end

subgraph group_persistence["Persistence and seed data"]
  node_sqlite[("SQLite storage<br/>[sqlitedb.py]")]
  node_predefined["Predefined sample data"]
end

node_user(("CLI user"))

node_user -->|"chooses workflow"| node_cli
node_cli -->|"dispatches"| node_workflows
node_workflows -->|"loads and saves"| node_sqlite
node_workflows -->|"checks off"| node_habit
node_workflows -->|"requests reports"| node_analytics
node_cli -->|"initializes database"| node_sqlite
node_cli -->|"loads on first run"| node_predefined
node_predefined -->|"creates sample habits"| node_habit
node_predefined -->|"saves sample history"| node_sqlite

click node_cli "https://github.com/artyomturkoff/habit_tracker/blob/main/main.py"
click node_workflows "https://github.com/artyomturkoff/habit_tracker/blob/main/main.py"
click node_habit "https://github.com/artyomturkoff/habit_tracker/blob/main/model/habit.py"
click node_analytics "https://github.com/artyomturkoff/habit_tracker/blob/main/analytics/analytics.py"
click node_sqlite "https://github.com/artyomturkoff/habit_tracker/blob/main/database/sqlitedb.py"
click node_predefined "https://github.com/artyomturkoff/habit_tracker/blob/main/data/predefined_habits.py"

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_cli,node_workflows,node_user toneBlue
class node_habit toneAmber
class node_analytics toneMint
class node_sqlite,node_predefined toneRose
```

## Components

### CLI workflows

- [Command-line app](https://github.com/artyomturkoff/habit_tracker/blob/main/main.py): `main.py`
- [Habit workflows](https://github.com/artyomturkoff/habit_tracker/blob/main/main.py): `main.py`

### Habit domain

- [Habit state and streaks](https://github.com/artyomturkoff/habit_tracker/blob/main/model/habit.py): `model/habit.py`

### Analytics

- [Habit analytics](https://github.com/artyomturkoff/habit_tracker/blob/main/analytics/analytics.py): `analytics/analytics.py`

### Persistence and seed data

- [SQLite storage](https://github.com/artyomturkoff/habit_tracker/blob/main/database/sqlitedb.py): `database/sqlitedb.py`
- [Predefined sample data](https://github.com/artyomturkoff/habit_tracker/blob/main/data/predefined_habits.py): `data/predefined_habits.py`

### Other components

- **CLI user**

## Connections

- CLI user → Command-line app: chooses workflow
- Command-line app → Habit workflows: dispatches
- Habit workflows → SQLite storage: loads and saves
- Habit workflows → Habit state and streaks: checks off
- Habit workflows → Habit analytics: requests reports
- Command-line app → SQLite storage: initializes database
- Command-line app → Predefined sample data: loads on first run
- Predefined sample data → Habit state and streaks: creates sample habits
- Predefined sample data → SQLite storage: saves sample history
