# nurt1-creator/habit_tracker architecture

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

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

## Overview

Habit Tracker is an in-memory habit-tracking application whose current interface is a console menu. The main workflow is to create a habit for a user, record a completion, and view streak and completion-rate statistics; the menu also archives and reactivates habits. The domain model validates habits and completion dates, while the repository stores logs and calculates statistics. The README describes REST API, authentication, and database support as planned, not current runtime components. Relationships below follow the sampled source; unsampled features are not inferred.

Main entry points: [`app/main.py`](https://github.com/nurt1-creator/habit_tracker/blob/main/app/main.py) (Menu workflow), [`app/models.py`](https://github.com/nurt1-creator/habit_tracker/blob/main/app/models.py) (Habit rules), [`app/repository.py`](https://github.com/nurt1-creator/habit_tracker/blob/main/app/repository.py) (Log repository), [`app/exceptions.py`](https://github.com/nurt1-creator/habit_tracker/blob/main/app/exceptions.py) (Domain errors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Console interface"]
  node_menu["Menu workflow<br/>[main.py]"]
end

subgraph group_domain["Habit domain"]
  node_user["User habits<br/>[user.py]"]
  node_habit["Habit rules<br/>[models.py]"]
  node_enums["Habit enums<br/>[enums.py]"]
  node_exceptions["Domain errors<br/>[exceptions.py]"]
end

subgraph group_tracking["Completion tracking"]
  node_log["Completion log<br/>[models.py]"]
  node_repository["Log repository<br/>[repository.py]"]
end

node_person(("Console user"))

node_person -->|"uses menu"| node_menu
node_menu -->|"manages habits"| node_user
node_menu -->|"creates habit"| node_habit
node_menu -->|"creates completion"| node_log
node_menu -->|"records and queries"| node_repository
node_menu -->|"checks status"| node_enums
node_menu -->|"handles errors"| node_exceptions
node_user -->|"stores habits"| node_habit
node_user -->|"raises duplicate"| node_exceptions
node_habit -->|"validates status and frequency"| node_enums
node_habit -->|"rejects archived habit"| node_exceptions
node_log -->|"checks habit status"| node_habit
node_repository -->|"stores and reads logs"| node_log
node_repository -->|"filters and reads frequency"| node_habit
node_repository -->|"checks frequency"| node_enums
node_repository -->|"rejects duplicate log"| node_exceptions

click node_menu "https://github.com/nurt1-creator/habit_tracker/blob/main/app/main.py"
click node_user "https://github.com/nurt1-creator/habit_tracker/blob/main/app/user.py"
click node_habit "https://github.com/nurt1-creator/habit_tracker/blob/main/app/models.py"
click node_log "https://github.com/nurt1-creator/habit_tracker/blob/main/app/models.py"
click node_repository "https://github.com/nurt1-creator/habit_tracker/blob/main/app/repository.py"
click node_enums "https://github.com/nurt1-creator/habit_tracker/blob/main/app/enums.py"
click node_exceptions "https://github.com/nurt1-creator/habit_tracker/blob/main/app/exceptions.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_menu,node_person toneBlue
class node_user,node_habit,node_enums,node_exceptions toneAmber
class node_log,node_repository toneMint
```

## Components

### Console interface

- [Menu workflow](https://github.com/nurt1-creator/habit_tracker/blob/main/app/main.py): `app/main.py`

### Habit domain

- [User habits](https://github.com/nurt1-creator/habit_tracker/blob/main/app/user.py): `app/user.py`
- [Habit rules](https://github.com/nurt1-creator/habit_tracker/blob/main/app/models.py): `app/models.py`
- [Habit enums](https://github.com/nurt1-creator/habit_tracker/blob/main/app/enums.py): `app/enums.py`
- [Domain errors](https://github.com/nurt1-creator/habit_tracker/blob/main/app/exceptions.py): `app/exceptions.py`

### Completion tracking

- [Completion log](https://github.com/nurt1-creator/habit_tracker/blob/main/app/models.py): `app/models.py`
- [Log repository](https://github.com/nurt1-creator/habit_tracker/blob/main/app/repository.py): `app/repository.py`

### Other components

- **Console user**

## Connections

- Console user → Menu workflow: uses menu (evidence: `app/main.py`)
- Menu workflow → User habits: manages habits (evidence: `app/main.py`)
- Menu workflow → Habit rules: creates habit (evidence: `app/main.py`)
- Menu workflow → Completion log: creates completion (evidence: `app/main.py`)
- Menu workflow → Log repository: records and queries (evidence: `app/main.py`)
- Menu workflow → Habit enums: checks status (evidence: `app/main.py`)
- Menu workflow → Domain errors: handles errors (evidence: `app/main.py`)
- User habits → Habit rules: stores habits (evidence: `app/user.py`)
- User habits → Domain errors: raises duplicate (evidence: `app/user.py`)
- Habit rules → Habit enums: validates status and frequency (evidence: `app/models.py`)
- Habit rules → Domain errors: rejects archived habit (evidence: `app/models.py`)
- Completion log → Habit rules: checks habit status (evidence: `app/models.py`)
- Log repository → Completion log: stores and reads logs (evidence: `app/repository.py`)
- Log repository → Habit rules: filters and reads frequency (evidence: `app/repository.py`)
- Log repository → Habit enums: checks frequency (evidence: `app/repository.py`)
- Log repository → Domain errors: rejects duplicate log (evidence: `app/repository.py`)
