# arbuz7277/arbot architecture

> Architecture diagram of the GitHub repository arbuz7277/arbot, 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/arbuz7277/arbot
- Repository: https://github.com/arbuz7277/arbot

## Overview

Arbot is a modular aiogram Telegram-bot starter. Its main workflow starts polling, dispatches Telegram updates through registered handlers and callbacks, and returns replies to users; the `/start` handler also builds an inline menu. The template includes a ping command, an about callback, password-generation handler, middleware, configuration, and an SQLite access layer. The password handler is present in the tree and registered by the handler package, but its implementation was not sampled; other edges are limited to relationships visible in excerpts or the README.

Main entry points: [`main.py`](https://github.com/arbuz7277/arbot/blob/main/main.py) (Bot entry and polling), [`handlers/__init__.py`](https://github.com/arbuz7277/arbot/blob/main/handlers/__init__.py) (Handler registration), [`handlers/start.py`](https://github.com/arbuz7277/arbot/blob/main/handlers/start.py) (Start command), [`handlers/ping.py`](https://github.com/arbuz7277/arbot/blob/main/handlers/ping.py) (Ping command)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_entry["Bot entry and polling<br/>[main.py]"]
  node_handler_registry["Handler registration<br/>[__init__.py]"]
  node_callback_registry["Callback registration<br/>[__init__.py]"]
end

subgraph group_interactions["User interactions"]
  node_start["Start command<br/>[start.py]"]
  node_ping["Ping command<br/>[ping.py]"]
  node_password["Password command<br/>[gen_password.py]"]
  node_menu["Inline menu<br/>[main.py]"]
  node_about["About callback<br/>[about.py]"]
end

subgraph group_middleware["Middleware"]
  node_middleware_registry["Middleware registration<br/>[__init__.py]"]
  node_example_middleware["Example middleware<br/>[example.py]"]
end

subgraph group_data["Configuration and data"]
  node_config["Bot configuration<br/>[config.py]"]
  node_database["Database access<br/>[database.py]"]
end

node_user(("Telegram user"))
node_telegram{{"Telegram API"}}
node_sqlite[("SQLite database")]

node_user -->|"sends updates"| node_entry
node_entry -->|"polls updates"| node_telegram
node_entry -->|"registers handlers"| node_handler_registry
node_entry -->|"registers callbacks"| node_callback_registry
node_entry -->|"registers middleware"| node_middleware_registry
node_handler_registry -->|"includes router"| node_start
node_handler_registry -->|"includes router"| node_ping
node_handler_registry -->|"includes router"| node_password
node_callback_registry -->|"includes router"| node_about
node_middleware_registry -->|"registers middleware"| node_example_middleware
node_example_middleware -->|"passes event onward"| node_entry
node_start -->|"builds menu"| node_menu
node_start -->|"replies"| node_user
node_ping -->|"checks bot identity"| node_telegram
node_ping -->|"replies with latency"| node_user
node_about -->|"edits message"| node_user
node_entry -->|"reads bot settings"| node_config
node_entry -->|"connects and closes"| node_database
node_database -->|"reads database path"| node_config
node_database -->|"executes queries"| node_sqlite

click node_entry "https://github.com/arbuz7277/arbot/blob/main/main.py"
click node_handler_registry "https://github.com/arbuz7277/arbot/blob/main/handlers/__init__.py"
click node_callback_registry "https://github.com/arbuz7277/arbot/blob/main/callbacks/__init__.py"
click node_middleware_registry "https://github.com/arbuz7277/arbot/blob/main/middlewares/__init__.py"
click node_example_middleware "https://github.com/arbuz7277/arbot/blob/main/middlewares/example.py"
click node_start "https://github.com/arbuz7277/arbot/blob/main/handlers/start.py"
click node_ping "https://github.com/arbuz7277/arbot/blob/main/handlers/ping.py"
click node_password "https://github.com/arbuz7277/arbot/blob/main/handlers/gen_password.py"
click node_menu "https://github.com/arbuz7277/arbot/blob/main/keyboards/inline/main.py"
click node_about "https://github.com/arbuz7277/arbot/blob/main/callbacks/about.py"
click node_config "https://github.com/arbuz7277/arbot/blob/main/config.py"
click node_database "https://github.com/arbuz7277/arbot/blob/main/database/database.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_entry,node_handler_registry,node_callback_registry,node_user toneBlue
class node_start,node_ping,node_password,node_menu,node_about,node_sqlite toneAmber
class node_middleware_registry,node_example_middleware,node_telegram toneMint
class node_config,node_database toneRose
```

## Components

### Bot runtime

- [Bot entry and polling](https://github.com/arbuz7277/arbot/blob/main/main.py): `main.py`
- [Handler registration](https://github.com/arbuz7277/arbot/blob/main/handlers/__init__.py): `handlers/__init__.py`
- [Callback registration](https://github.com/arbuz7277/arbot/blob/main/callbacks/__init__.py): `callbacks/__init__.py`

### User interactions

- [Start command](https://github.com/arbuz7277/arbot/blob/main/handlers/start.py): `handlers/start.py`
- [Ping command](https://github.com/arbuz7277/arbot/blob/main/handlers/ping.py): `handlers/ping.py`
- [Password command](https://github.com/arbuz7277/arbot/blob/main/handlers/gen_password.py): `handlers/gen_password.py`
- [Inline menu](https://github.com/arbuz7277/arbot/blob/main/keyboards/inline/main.py): `keyboards/inline/main.py`
- [About callback](https://github.com/arbuz7277/arbot/blob/main/callbacks/about.py): `callbacks/about.py`

### Middleware

- [Middleware registration](https://github.com/arbuz7277/arbot/blob/main/middlewares/__init__.py): `middlewares/__init__.py`
- [Example middleware](https://github.com/arbuz7277/arbot/blob/main/middlewares/example.py): `middlewares/example.py`

### Configuration and data

- [Bot configuration](https://github.com/arbuz7277/arbot/blob/main/config.py): `config.py`
- [Database access](https://github.com/arbuz7277/arbot/blob/main/database/database.py): `database/database.py`

### Other components

- **Telegram user**
- **Telegram API**
- **SQLite database**

## Connections

- Telegram user → Bot entry and polling: sends updates (evidence: `main.py`)
- Bot entry and polling → Telegram API: polls updates (evidence: `main.py`)
- Bot entry and polling → Handler registration: registers handlers (evidence: `main.py`)
- Bot entry and polling → Callback registration: registers callbacks (evidence: `main.py`)
- Bot entry and polling → Middleware registration: registers middleware (evidence: `main.py`)
- Handler registration → Start command: includes router (evidence: `handlers/__init__.py`)
- Handler registration → Ping command: includes router (evidence: `handlers/__init__.py`)
- Handler registration → Password command: includes router (evidence: `handlers/__init__.py`)
- Callback registration → About callback: includes router (evidence: `callbacks/__init__.py`)
- Middleware registration → Example middleware: registers middleware (evidence: `middlewares/__init__.py`)
- Example middleware → Bot entry and polling: passes event onward (evidence: `middlewares/example.py`)
- Start command → Inline menu: builds menu (evidence: `handlers/start.py`)
- Start command → Telegram user: replies (evidence: `handlers/start.py`)
- Ping command → Telegram API: checks bot identity (evidence: `handlers/ping.py`)
- Ping command → Telegram user: replies with latency (evidence: `handlers/ping.py`)
- About callback → Telegram user: edits message (evidence: `callbacks/about.py`)
- Bot entry and polling → Bot configuration: reads bot settings (evidence: `main.py`)
- Bot entry and polling → Database access: connects and closes (evidence: `main.py`)
- Database access → Bot configuration: reads database path (evidence: `database/database.py`)
- Database access → SQLite database: executes queries (evidence: `database/database.py`)
