# asmit-rm/proxy-alts architecture

> Architecture diagram of the GitHub repository asmit-rm/proxy-alts, 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/asmit-rm/proxy-alts
- Repository: https://github.com/asmit-rm/proxy-alts

## Overview

This is a Telegram storefront bot for selling phone-number accounts, with wallet deposits, owner-reviewed payments, order delivery, and administrative inventory management. Buyers browse products, purchase with wallet balance, view orders, and request login codes; owners manage stock and payments. The graph follows the bot’s registered handlers into services and persistence, with separate nodes for fulfillment and notifications. Source excerpts and the index show key calls, but some handler and service implementations were not sampled, so their internal behavior is represented only where indexed references or excerpts support it.

Main entry points: [`bot.py`](https://github.com/asmit-rm/proxy-alts/blob/main/bot.py) (Bot dispatcher), [`app/handlers/orders.py`](https://github.com/asmit-rm/proxy-alts/blob/main/app/handlers/orders.py) (Purchase and orders), [`app/database/models.py`](https://github.com/asmit-rm/proxy-alts/blob/main/app/database/models.py) (Commerce records), [`app/handlers/admin.py`](https://github.com/asmit-rm/proxy-alts/blob/main/app/handlers/admin.py) (Admin controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Bot interface"]
  node_bot["Bot dispatcher<br/>[bot.py]"]
  node_forcejoin["Membership gate<br/>[force_join.py]"]
  node_start["Start and home<br/>[start.py]"]
  node_keyboards["Interaction keyboards"]
end

subgraph group_commerce["Marketplace"]
  node_shop["Product browsing<br/>[shop.py]"]
  node_orders["Purchase and orders<br/>[orders.py]"]
  node_products["Product service<br/>[products.py]"]
  node_order_service["Order service<br/>[orders.py]"]
  node_fulfillment["Number fulfillment<br/>[fulfillment.py]"]
end

subgraph group_accounts["Wallet and payments"]
  node_wallet_handler["Wallet interface<br/>[wallet.py]"]
  node_payments_handler["Deposit review<br/>[payments.py]"]
  node_wallet_service["Wallet service<br/>[wallet.py]"]
  node_payment_service["Payment service<br/>[payments.py]"]
  node_users["User service<br/>[users.py]"]
end

subgraph group_operations["Owner operations"]
  node_admin["Admin controls<br/>[admin.py]"]
  node_notifications["Sale notifications<br/>[notifications.py]"]
  node_support["Support handler<br/>[support.py]"]
end

subgraph group_platform["Data and integrations"]
  node_database["Async database<br/>[database.py]"]
  node_models[("Commerce records<br/>[models.py]")]
  node_repositories["User repository<br/>[repositories.py]"]
  node_config["Runtime settings<br/>[config.py]"]
end

node_buyer(("Telegram buyer"))
node_owner(("Telegram owner"))
node_telegram["Telegram services"]

node_buyer -->|"sends updates"| node_bot
node_owner -->|"sends updates"| node_bot
node_bot -->|"initializes"| node_database
node_bot -->|"registers"| node_start
node_bot -->|"registers"| node_shop
node_bot -->|"registers"| node_orders
node_bot -->|"registers"| node_wallet_handler
node_bot -->|"registers"| node_payments_handler
node_bot -->|"registers"| node_admin
node_bot -->|"registers"| node_support
node_bot -->|"registers"| node_forcejoin
node_start -->|"renders"| node_keyboards
node_shop -->|"queries"| node_products
node_shop -->|"queries"| node_users
node_shop -->|"renders"| node_keyboards
node_orders -->|"creates and lists"| node_order_service
node_orders -->|"looks up"| node_products
node_orders -->|"looks up"| node_users
node_orders -->|"requests codes"| node_fulfillment
node_orders -->|"notifies sale"| node_notifications
node_orders -->|"renders"| node_keyboards
node_order_service -->|"uses"| node_wallet_service
node_wallet_handler -->|"manages balance"| node_wallet_service
node_wallet_handler -->|"renders"| node_keyboards
node_payments_handler -->|"submits and reviews"| node_payment_service
node_payments_handler -->|"gets or creates"| node_users
node_payments_handler -->|"sends review notice"| node_telegram
node_payment_service -->|"credits on approval"| node_wallet_service
node_admin -->|"logs in numbers"| node_fulfillment
node_admin -->|"renders"| node_keyboards
node_admin -->|"broadcasts messages"| node_telegram
node_forcejoin -->|"checks membership"| node_telegram
node_support -->|"reads support settings"| node_config
node_database -->|"reads database URL"| node_config
node_database -->|"creates tables"| node_models
node_users -->|"delegates user access"| node_repositories
node_wallet_service -->|"loads user"| node_repositories
node_repositories -->|"queries"| node_models
node_order_service -->|"uses records"| node_models
node_payment_service -->|"uses records"| node_models
node_products -->|"uses records"| node_models
node_fulfillment -->|"connects with Telethon"| node_telegram
node_notifications -->|"sends notifications"| node_telegram
node_admin -->|"manages inventory"| node_models

click node_bot "https://github.com/asmit-rm/proxy-alts/blob/main/bot.py"
click node_forcejoin "https://github.com/asmit-rm/proxy-alts/blob/main/app/middlewares/force_join.py"
click node_start "https://github.com/asmit-rm/proxy-alts/blob/main/app/handlers/start.py"
click node_shop "https://github.com/asmit-rm/proxy-alts/blob/main/app/handlers/shop.py"
click node_orders "https://github.com/asmit-rm/proxy-alts/blob/main/app/handlers/orders.py"
click node_products "https://github.com/asmit-rm/proxy-alts/blob/main/app/services/products.py"
click node_order_service "https://github.com/asmit-rm/proxy-alts/blob/main/app/services/orders.py"
click node_fulfillment "https://github.com/asmit-rm/proxy-alts/blob/main/app/services/fulfillment.py"
click node_wallet_handler "https://github.com/asmit-rm/proxy-alts/blob/main/app/handlers/wallet.py"
click node_payments_handler "https://github.com/asmit-rm/proxy-alts/blob/main/app/handlers/payments.py"
click node_wallet_service "https://github.com/asmit-rm/proxy-alts/blob/main/app/services/wallet.py"
click node_payment_service "https://github.com/asmit-rm/proxy-alts/blob/main/app/services/payments.py"
click node_users "https://github.com/asmit-rm/proxy-alts/blob/main/app/services/users.py"
click node_admin "https://github.com/asmit-rm/proxy-alts/blob/main/app/handlers/admin.py"
click node_notifications "https://github.com/asmit-rm/proxy-alts/blob/main/app/services/notifications.py"
click node_support "https://github.com/asmit-rm/proxy-alts/blob/main/app/handlers/support.py"
click node_database "https://github.com/asmit-rm/proxy-alts/blob/main/app/database/database.py"
click node_models "https://github.com/asmit-rm/proxy-alts/blob/main/app/database/models.py"
click node_repositories "https://github.com/asmit-rm/proxy-alts/blob/main/app/database/repositories.py"
click node_keyboards "https://github.com/asmit-rm/proxy-alts/tree/main/app/keyboards"
click node_config "https://github.com/asmit-rm/proxy-alts/blob/main/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_bot,node_forcejoin,node_start,node_keyboards toneBlue
class node_shop,node_orders,node_products,node_order_service,node_fulfillment toneAmber
class node_wallet_handler,node_payments_handler,node_wallet_service,node_payment_service,node_users toneMint
class node_admin,node_notifications,node_support toneRose
class node_database,node_models,node_repositories,node_config,node_buyer,node_owner,node_telegram toneIndigo
```

## Components

### Bot interface

- [Bot dispatcher](https://github.com/asmit-rm/proxy-alts/blob/main/bot.py): `bot.py`
- [Membership gate](https://github.com/asmit-rm/proxy-alts/blob/main/app/middlewares/force_join.py): `app/middlewares/force_join.py`
- [Start and home](https://github.com/asmit-rm/proxy-alts/blob/main/app/handlers/start.py): `app/handlers/start.py`
- [Interaction keyboards](https://github.com/asmit-rm/proxy-alts/tree/main/app/keyboards): `app/keyboards`

### Marketplace

- [Product browsing](https://github.com/asmit-rm/proxy-alts/blob/main/app/handlers/shop.py): `app/handlers/shop.py`
- [Purchase and orders](https://github.com/asmit-rm/proxy-alts/blob/main/app/handlers/orders.py): `app/handlers/orders.py`
- [Product service](https://github.com/asmit-rm/proxy-alts/blob/main/app/services/products.py): `app/services/products.py`
- [Order service](https://github.com/asmit-rm/proxy-alts/blob/main/app/services/orders.py): `app/services/orders.py`
- [Number fulfillment](https://github.com/asmit-rm/proxy-alts/blob/main/app/services/fulfillment.py): `app/services/fulfillment.py`

### Wallet and payments

- [Wallet interface](https://github.com/asmit-rm/proxy-alts/blob/main/app/handlers/wallet.py): `app/handlers/wallet.py`
- [Deposit review](https://github.com/asmit-rm/proxy-alts/blob/main/app/handlers/payments.py): `app/handlers/payments.py`
- [Wallet service](https://github.com/asmit-rm/proxy-alts/blob/main/app/services/wallet.py): `app/services/wallet.py`
- [Payment service](https://github.com/asmit-rm/proxy-alts/blob/main/app/services/payments.py): `app/services/payments.py`
- [User service](https://github.com/asmit-rm/proxy-alts/blob/main/app/services/users.py): `app/services/users.py`

### Owner operations

- [Admin controls](https://github.com/asmit-rm/proxy-alts/blob/main/app/handlers/admin.py): `app/handlers/admin.py`
- [Sale notifications](https://github.com/asmit-rm/proxy-alts/blob/main/app/services/notifications.py): `app/services/notifications.py`
- [Support handler](https://github.com/asmit-rm/proxy-alts/blob/main/app/handlers/support.py): `app/handlers/support.py`

### Data and integrations

- [Async database](https://github.com/asmit-rm/proxy-alts/blob/main/app/database/database.py): `app/database/database.py`
- [Commerce records](https://github.com/asmit-rm/proxy-alts/blob/main/app/database/models.py): `app/database/models.py`
- [User repository](https://github.com/asmit-rm/proxy-alts/blob/main/app/database/repositories.py): `app/database/repositories.py`
- [Runtime settings](https://github.com/asmit-rm/proxy-alts/blob/main/config.py): `config.py`

### Other components

- **Telegram buyer**
- **Telegram owner**
- **Telegram services**

## Connections

- Telegram buyer → Bot dispatcher: sends updates (evidence: `bot.py`)
- Telegram owner → Bot dispatcher: sends updates (evidence: `bot.py`)
- Bot dispatcher → Async database: initializes (evidence: `bot.py`)
- Bot dispatcher → Start and home: registers (evidence: `bot.py`)
- Bot dispatcher → Product browsing: registers (evidence: `bot.py`)
- Bot dispatcher → Purchase and orders: registers (evidence: `bot.py`)
- Bot dispatcher → Wallet interface: registers (evidence: `bot.py`)
- Bot dispatcher → Deposit review: registers (evidence: `bot.py`)
- Bot dispatcher → Admin controls: registers (evidence: `bot.py`)
- Bot dispatcher → Support handler: registers (evidence: `bot.py`)
- Bot dispatcher → Membership gate: registers (evidence: `bot.py`)
- Start and home → Interaction keyboards: renders (evidence: `app/handlers/start.py`)
- Product browsing → Product service: queries (evidence: `app/handlers/shop.py`)
- Product browsing → User service: queries (evidence: `app/handlers/shop.py`)
- Product browsing → Interaction keyboards: renders (evidence: `app/handlers/shop.py`)
- Purchase and orders → Order service: creates and lists (evidence: `app/handlers/orders.py`)
- Purchase and orders → Product service: looks up (evidence: `app/handlers/orders.py`)
- Purchase and orders → User service: looks up (evidence: `app/handlers/orders.py`)
- Purchase and orders → Number fulfillment: requests codes (evidence: `app/handlers/orders.py`)
- Purchase and orders → Sale notifications: notifies sale (evidence: `app/handlers/orders.py`)
- Purchase and orders → Interaction keyboards: renders (evidence: `app/handlers/orders.py`)
- Order service → Wallet service: uses (evidence: `app/services/orders.py`)
- Wallet interface → Wallet service: manages balance (evidence: `app/handlers/wallet.py`)
- Wallet interface → Interaction keyboards: renders (evidence: `app/handlers/wallet.py`)
- Deposit review → Payment service: submits and reviews (evidence: `app/handlers/payments.py`)
- Deposit review → User service: gets or creates (evidence: `app/handlers/payments.py`)
- Deposit review → Telegram services: sends review notice (evidence: `app/handlers/payments.py`)
- Payment service → Wallet service: credits on approval (evidence: `app/services/payments.py`)
- Admin controls → Number fulfillment: logs in numbers (evidence: `app/handlers/admin.py`)
- Admin controls → Interaction keyboards: renders (evidence: `app/handlers/admin.py`)
- Admin controls → Telegram services: broadcasts messages (evidence: `app/handlers/admin.py`)
- Membership gate → Telegram services: checks membership (evidence: `app/middlewares/force_join.py`)
- Support handler → Runtime settings: reads support settings (evidence: `app/handlers/support.py`)
- Async database → Runtime settings: reads database URL (evidence: `app/database/database.py`)
- Async database → Commerce records: creates tables (evidence: `app/database/database.py`)
- User service → User repository: delegates user access (evidence: `app/services/users.py`)
- Wallet service → User repository: loads user (evidence: `app/services/wallet.py`)
- User repository → Commerce records: queries (evidence: `app/database/repositories.py`)
- Order service → Commerce records: uses records (evidence: `app/services/orders.py`)
- Payment service → Commerce records: uses records (evidence: `app/services/payments.py`)
- Product service → Commerce records: uses records (evidence: `app/services/products.py`)
- Number fulfillment → Telegram services: connects with Telethon (evidence: `app/services/fulfillment.py`)
- Sale notifications → Telegram services: sends notifications (evidence: `app/services/notifications.py`)
- Admin controls → Commerce records: manages inventory (evidence: `app/handlers/admin.py`)
