# stepan1604/numbershop architecture

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

- Interactive diagram: https://gitdiagram.com/stepan1604/numbershop
- Repository: https://github.com/stepan1604/numbershop

## Overview

NumberShop is a Telegram storefront for virtual numbers and accounts. Buyers accept terms, browse a country-grouped catalog, select an item, pay through YooMoney, and receive purchase details and a login code; administrators manage inventory, roles, settings, and support workflows. The graph separates bot workflows, payment and code providers, and persistence. README documents several major workflows whose handlers are in unsampled portions of bot.py; their internal call paths are therefore not asserted.

Main entry points: [`bot.py`](https://github.com/stepan1604/numbershop/blob/main/bot.py) (Buyer and admin workflows), [`database.py`](https://github.com/stepan1604/numbershop/blob/main/database.py) (Database operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bot["Telegram bot"]
  node_bot_workflows["Buyer and admin workflows<br/>[bot.py]"]
  node_catalog["Catalog and selection<br/>[bot.py]"]
  node_admin_ops["Inventory and roles<br/>[bot.py]"]
end

subgraph group_commerce["Commerce and fulfillment"]
  node_checkout["Payment and purchase<br/>[bot.py]"]
  node_code_delivery["Code delivery<br/>[bot.py]"]
  node_telethon["Telethon sessions<br/>[bot.py]"]
  node_webhook["Health and payment webhook<br/>[bot.py]"]
end

subgraph group_persistence["Persistence"]
  node_db_access["Database operations<br/>[database.py]"]
  node_shop_store[("Catalog and purchases<br/>[database.py]")]
  node_admin_store[("Roles and settings<br/>[database.py]")]
end

node_buyer(("Buyer"))
node_admin(("Administrator"))
node_telegram{{"Telegram Bot API"}}
node_yoomoney{{"YooMoney"}}
node_lzt{{"LZT Market API"}}

node_buyer -->|"sends updates"| node_telegram
node_telegram -.->|"dispatches updates"| node_bot_workflows
node_admin -.->|"sends commands"| node_telegram
node_bot_workflows -->|"opens shop"| node_catalog
node_catalog -->|"loads products"| node_db_access
node_bot_workflows -.->|"selects item"| node_checkout
node_checkout -->|"checks payment"| node_yoomoney
node_checkout -.->|"records purchase"| node_db_access
node_checkout -.->|"requests code"| node_code_delivery
node_code_delivery -->|"requests code"| node_lzt
node_code_delivery -->|"retrieves code"| node_telethon
node_bot_workflows -.->|"handles admin actions"| node_admin_ops
node_admin_ops -.->|"manages inventory"| node_db_access
node_admin_ops -->|"buys listed item"| node_lzt
node_bot_workflows -.->|"serves endpoint"| node_webhook
node_webhook -->|"receives webhook"| node_yoomoney
node_db_access -->|"reads and writes"| node_shop_store
node_db_access -->|"reads and writes"| node_admin_store
node_bot_workflows -->|"loads admin roles"| node_db_access

click node_bot_workflows "https://github.com/stepan1604/numbershop/blob/main/bot.py"
click node_catalog "https://github.com/stepan1604/numbershop/blob/main/bot.py"
click node_checkout "https://github.com/stepan1604/numbershop/blob/main/bot.py"
click node_code_delivery "https://github.com/stepan1604/numbershop/blob/main/bot.py"
click node_admin_ops "https://github.com/stepan1604/numbershop/blob/main/bot.py"
click node_telethon "https://github.com/stepan1604/numbershop/blob/main/bot.py"
click node_webhook "https://github.com/stepan1604/numbershop/blob/main/bot.py"
click node_db_access "https://github.com/stepan1604/numbershop/blob/main/database.py"
click node_shop_store "https://github.com/stepan1604/numbershop/blob/main/database.py"
click node_admin_store "https://github.com/stepan1604/numbershop/blob/main/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_bot_workflows,node_catalog,node_admin_ops toneBlue
class node_checkout,node_code_delivery,node_telethon,node_webhook toneAmber
class node_db_access,node_shop_store,node_admin_store,node_telegram,node_lzt toneMint
class node_buyer,node_admin,node_yoomoney toneIndigo
```

## Components

### Telegram bot

- [Buyer and admin workflows](https://github.com/stepan1604/numbershop/blob/main/bot.py): `bot.py`
- [Catalog and selection](https://github.com/stepan1604/numbershop/blob/main/bot.py): `bot.py`
- [Inventory and roles](https://github.com/stepan1604/numbershop/blob/main/bot.py): `bot.py`

### Commerce and fulfillment

- [Payment and purchase](https://github.com/stepan1604/numbershop/blob/main/bot.py): `bot.py`
- [Code delivery](https://github.com/stepan1604/numbershop/blob/main/bot.py): `bot.py`
- [Telethon sessions](https://github.com/stepan1604/numbershop/blob/main/bot.py): `bot.py`
- [Health and payment webhook](https://github.com/stepan1604/numbershop/blob/main/bot.py): `bot.py`

### Persistence

- [Database operations](https://github.com/stepan1604/numbershop/blob/main/database.py): `database.py`
- [Catalog and purchases](https://github.com/stepan1604/numbershop/blob/main/database.py): `database.py`
- [Roles and settings](https://github.com/stepan1604/numbershop/blob/main/database.py): `database.py`

### Other components

- **Buyer**
- **Administrator**
- **Telegram Bot API**
- **YooMoney**
- **LZT Market API**

## Connections

- Buyer → Telegram Bot API: sends updates (evidence: `README.md`)
- Telegram Bot API → Buyer and admin workflows: dispatches updates
- Administrator → Telegram Bot API: sends commands
- Buyer and admin workflows → Catalog and selection: opens shop (evidence: `bot.py`)
- Catalog and selection → Database operations: loads products (evidence: `bot.py`)
- Buyer and admin workflows → Payment and purchase: selects item (evidence: `bot.py`)
- Payment and purchase → YooMoney: checks payment (evidence: `README.md`)
- Payment and purchase → Database operations: records purchase (evidence: `bot.py`)
- Payment and purchase → Code delivery: requests code (evidence: `bot.py`)
- Code delivery → LZT Market API: requests code (evidence: `README.md`)
- Code delivery → Telethon sessions: retrieves code (evidence: `README.md`)
- Buyer and admin workflows → Inventory and roles: handles admin actions (evidence: `bot.py`)
- Inventory and roles → Database operations: manages inventory (evidence: `bot.py`)
- Inventory and roles → LZT Market API: buys listed item (evidence: `README.md`)
- Buyer and admin workflows → Health and payment webhook: serves endpoint (evidence: `bot.py`)
- Health and payment webhook → YooMoney: receives webhook (evidence: `README.md`)
- Database operations → Catalog and purchases: reads and writes (evidence: `database.py`)
- Database operations → Roles and settings: reads and writes (evidence: `database.py`)
- Buyer and admin workflows → Database operations: loads admin roles (evidence: `bot.py`)
