# ay1nesk/project architecture

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

- Interactive diagram: https://gitdiagram.com/ay1nesk/project
- Repository: https://github.com/ay1nesk/project

## Overview

HabitBot is a Telegram habit-tracking bot. Users interact through Telegram to create habits, receive reminders, mark habits complete, and review history and statistics. The tree assigns these capabilities to separate handlers and includes database, scheduling, middleware, and keyboard modules. Source excerpts are empty, so internal calls, database operations, and startup wiring cannot be confirmed; dashed edges mark only the documented product-level interactions.

Main entry points: [`app/bot/main.py`](https://github.com/ay1nesk/project/blob/main/app/bot/main.py) (Bot entry point), [`app/bot/handlers/habits.py`](https://github.com/ay1nesk/project/blob/main/app/bot/handlers/habits.py) (Habit management), [`app/bot/handlers/reminders.py`](https://github.com/ay1nesk/project/blob/main/app/bot/handlers/reminders.py) (Reminders), [`app/bot/handlers/stats.py`](https://github.com/ay1nesk/project/blob/main/app/bot/handlers/stats.py) (Progress statistics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Telegram interaction"]
  node_main["Bot entry point<br/>[main.py]"]
  node_start["Start handler<br/>[start.py]"]
  node_keyboards["Inline keyboards<br/>[inline.py]"]
end

subgraph group_habit["Habit tracking"]
  node_habits["Habit management<br/>[habits.py]"]
  node_reminders["Reminders<br/>[reminders.py]"]
  node_stats["Progress statistics<br/>[stats.py]"]
  node_subscription["Subscription handler<br/>[subscription.py]"]
end

subgraph group_runtime["Bot runtime"]
  node_db[("Database access<br/>[dp.py]")]
  node_middleware["DB middleware<br/>[db.py]"]
  node_scheduler["Reminder scheduler<br/>[scheduler.py]"]
  node_config["Bot configuration<br/>[config.py]"]
end

node_user(("Telegram user"))
node_telegram(("Telegram"))

node_user -.->|"uses"| node_telegram
node_telegram -.->|"reaches bot"| node_main
node_user -.->|"creates habits"| node_habits
node_user -.->|"receives reminders"| node_reminders
node_user -.->|"views progress"| node_stats

click node_main "https://github.com/ay1nesk/project/blob/main/app/bot/main.py"
click node_start "https://github.com/ay1nesk/project/blob/main/app/bot/handlers/start.py"
click node_keyboards "https://github.com/ay1nesk/project/blob/main/app/bot/keyboards/inline.py"
click node_habits "https://github.com/ay1nesk/project/blob/main/app/bot/handlers/habits.py"
click node_reminders "https://github.com/ay1nesk/project/blob/main/app/bot/handlers/reminders.py"
click node_stats "https://github.com/ay1nesk/project/blob/main/app/bot/handlers/stats.py"
click node_subscription "https://github.com/ay1nesk/project/blob/main/app/bot/handlers/subscription.py"
click node_db "https://github.com/ay1nesk/project/blob/main/app/bot/database/dp.py"
click node_middleware "https://github.com/ay1nesk/project/blob/main/app/bot/middlewares/db.py"
click node_scheduler "https://github.com/ay1nesk/project/blob/main/app/bot/utils/scheduler.py"
click node_config "https://github.com/ay1nesk/project/blob/main/app/bot/config.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_main,node_start,node_keyboards,node_user toneBlue
class node_habits,node_reminders,node_stats,node_subscription toneAmber
class node_db,node_middleware,node_scheduler,node_config toneMint
class node_telegram toneIndigo
```

## Components

### Telegram interaction

- [Bot entry point](https://github.com/ay1nesk/project/blob/main/app/bot/main.py): `app/bot/main.py`
- [Start handler](https://github.com/ay1nesk/project/blob/main/app/bot/handlers/start.py): `app/bot/handlers/start.py`
- [Inline keyboards](https://github.com/ay1nesk/project/blob/main/app/bot/keyboards/inline.py): `app/bot/keyboards/inline.py`

### Habit tracking

- [Habit management](https://github.com/ay1nesk/project/blob/main/app/bot/handlers/habits.py): `app/bot/handlers/habits.py`
- [Reminders](https://github.com/ay1nesk/project/blob/main/app/bot/handlers/reminders.py): `app/bot/handlers/reminders.py`
- [Progress statistics](https://github.com/ay1nesk/project/blob/main/app/bot/handlers/stats.py): `app/bot/handlers/stats.py`
- [Subscription handler](https://github.com/ay1nesk/project/blob/main/app/bot/handlers/subscription.py): `app/bot/handlers/subscription.py`

### Bot runtime

- [Database access](https://github.com/ay1nesk/project/blob/main/app/bot/database/dp.py): `app/bot/database/dp.py`
- [DB middleware](https://github.com/ay1nesk/project/blob/main/app/bot/middlewares/db.py): `app/bot/middlewares/db.py`
- [Reminder scheduler](https://github.com/ay1nesk/project/blob/main/app/bot/utils/scheduler.py): `app/bot/utils/scheduler.py`
- [Bot configuration](https://github.com/ay1nesk/project/blob/main/app/bot/config.py): `app/bot/config.py`

### Other components

- **Telegram user**
- **Telegram**

## Connections

- Telegram user → Telegram: uses (evidence: `README.md`)
- Telegram → Bot entry point: reaches bot (evidence: `README.md`)
- Telegram user → Habit management: creates habits (evidence: `README.md`)
- Telegram user → Reminders: receives reminders (evidence: `README.md`)
- Telegram user → Progress statistics: views progress (evidence: `README.md`)
