# amir-aghajani/amo-bot architecture

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

- Interactive diagram: https://gitdiagram.com/amir-aghajani/amo-bot
- Repository: https://github.com/amir-aghajani/amo-bot

## Overview

AmoBot is a Persian, Telegram-centered VPN subscription shop with customer, agent, and owner experiences. The main customer workflow is browsing plans and services, placing an order, paying into the shop, and receiving or managing a VPN service; owners and agents configure shops through web panels. The README also documents imports, backups, scheduled work, and report-group operations, so these appear as separate capabilities. The available source excerpts are selective: most domain relationships below follow README descriptions, not inspection of every implementation.

Main entry points: [`app/Modules/Telegram/Controllers/WebhookController.php`](https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Telegram/Controllers/WebhookController.php) (Telegram bot), [`resources/panel/src/apps/app/app.tsx`](https://github.com/amir-aghajani/amo-bot/blob/main/resources/panel/src/apps/app/app.tsx) (Telegram mini app), [`resources/panel/src/apps/admin/app.tsx`](https://github.com/amir-aghajani/amo-bot/blob/main/resources/panel/src/apps/admin/app.tsx) (Owner and agent panels), [`app/Modules/Orders/Services/OrderService.php`](https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Orders/Services/OrderService.php) (Orders and pricing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer experiences"]
  node_telegram_bot["Telegram bot"]
  node_mini_app["Telegram mini app<br/>[app.tsx]"]
  node_store_api["Store API"]
  node_accounts["Customer accounts"]
end

subgraph group_commerce["Shop commerce"]
  node_catalog["Plans and catalog<br/>[PlanService.php]"]
  node_orders["Orders and pricing<br/>[OrderService.php]"]
  node_payments["Payments and deposits<br/>[PaymentService.php]"]
  node_gateway_webhooks["Gateway callbacks"]
end

subgraph group_service["VPN services"]
  node_provisioning["Service provisioning"]
  node_vpn_panels["VPN panels"]
  node_service_management["Service management<br/>[Server.php]"]
end

subgraph group_management["Shop management"]
  node_admin_panel["Owner and agent panels<br/>[app.tsx]"]
  node_admin_api["Shop administration API"]
  node_imports["Shop imports<br/>[Importer.php]"]
  node_backups["Backups and restore<br/>[Backups.php]"]
  node_reports["Report group"]
end

subgraph group_runtime["Runtime operations"]
  node_scheduler["Scheduled tasks<br/>[Scheduler.php]"]
  node_cron["Cron endpoint<br/>[CronController.php]"]
  node_application["Application runtime<br/>[Application.php]"]
  node_database[("Application database")]
end

node_customer(("Customer"))
node_owner(("Shop owner"))
node_agent(("Shop agent"))

node_customer -->|"uses shop"| node_telegram_bot
node_customer -->|"opens in Telegram"| node_mini_app
node_customer -->|"uses website"| node_store_api
node_telegram_bot -->|"signs in"| node_accounts
node_mini_app -->|"shares account"| node_accounts
node_telegram_bot -->|"browses plans"| node_catalog
node_mini_app -->|"browses plans"| node_catalog
node_store_api -->|"offers shop"| node_catalog
node_telegram_bot -->|"places order"| node_orders
node_mini_app -->|"places order"| node_orders
node_store_api -->|"checks out"| node_orders
node_orders -->|"accepts payment"| node_payments
node_gateway_webhooks -->|"confirms payment"| node_payments
node_payments -->|"enables delivery"| node_provisioning
node_provisioning -->|"creates service"| node_vpn_panels
node_customer -->|"manages service"| node_service_management
node_owner -->|"runs shop"| node_admin_panel
node_agent -->|"runs shop"| node_admin_panel
node_admin_panel -->|"manages through API"| node_admin_api
node_admin_panel -->|"reviews import"| node_imports
node_admin_api -->|"manages backups"| node_backups
node_owner -->|"acts on reports"| node_reports
node_cron -->|"ticks scheduler"| node_scheduler
node_scheduler -.->|"runs tasks"| node_database
node_application -->|"boots database"| node_database

click node_telegram_bot "https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Telegram/Controllers/WebhookController.php"
click node_mini_app "https://github.com/amir-aghajani/amo-bot/blob/main/resources/panel/src/apps/app/app.tsx"
click node_store_api "https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Store/Api/CheckoutController.php"
click node_accounts "https://github.com/amir-aghajani/amo-bot/tree/main/app/Modules/Accounts/Services"
click node_catalog "https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Catalog/Services/PlanService.php"
click node_orders "https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Orders/Services/OrderService.php"
click node_payments "https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Payments/Services/PaymentService.php"
click node_gateway_webhooks "https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Payments/Controllers/GatewayWebhookController.php"
click node_provisioning "https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Subscriptions/Services/ProvisioningService.php"
click node_service_management "https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Providers/Models/Server.php"
click node_admin_panel "https://github.com/amir-aghajani/amo-bot/blob/main/resources/panel/src/apps/admin/app.tsx"
click node_admin_api "https://github.com/amir-aghajani/amo-bot/tree/main/app/Modules/Admin/Api"
click node_imports "https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Imports/Importer.php"
click node_backups "https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Backups/Backups.php"
click node_reports "https://github.com/amir-aghajani/amo-bot/tree/main/app/Modules/Telegram/Reports"
click node_scheduler "https://github.com/amir-aghajani/amo-bot/blob/main/app/Core/Scheduling/Scheduler.php"
click node_cron "https://github.com/amir-aghajani/amo-bot/blob/main/app/Core/Http/Controllers/CronController.php"
click node_application "https://github.com/amir-aghajani/amo-bot/blob/main/app/Core/Application.php"
click node_database "https://github.com/amir-aghajani/amo-bot/blob/main/app/Core/Database/DatabaseManager.php"

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_telegram_bot,node_mini_app,node_store_api,node_accounts toneBlue
class node_catalog,node_orders,node_payments,node_gateway_webhooks toneAmber
class node_provisioning,node_vpn_panels,node_service_management toneMint
class node_admin_panel,node_admin_api,node_imports,node_backups,node_reports toneRose
class node_scheduler,node_cron,node_application,node_database,node_customer,node_owner,node_agent toneIndigo
```

## Components

### Customer experiences

- [Telegram bot](https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Telegram/Controllers/WebhookController.php): `app/Modules/Telegram/Controllers/WebhookController.php`
- [Telegram mini app](https://github.com/amir-aghajani/amo-bot/blob/main/resources/panel/src/apps/app/app.tsx): `resources/panel/src/apps/app/app.tsx`
- [Store API](https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Store/Api/CheckoutController.php): `app/Modules/Store/Api/CheckoutController.php`
- [Customer accounts](https://github.com/amir-aghajani/amo-bot/tree/main/app/Modules/Accounts/Services): `app/Modules/Accounts/Services`

### Shop commerce

- [Plans and catalog](https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Catalog/Services/PlanService.php): `app/Modules/Catalog/Services/PlanService.php`
- [Orders and pricing](https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Orders/Services/OrderService.php): `app/Modules/Orders/Services/OrderService.php`
- [Payments and deposits](https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Payments/Services/PaymentService.php): `app/Modules/Payments/Services/PaymentService.php`
- [Gateway callbacks](https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Payments/Controllers/GatewayWebhookController.php): `app/Modules/Payments/Controllers/GatewayWebhookController.php`

### VPN services

- [Service provisioning](https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Subscriptions/Services/ProvisioningService.php): `app/Modules/Subscriptions/Services/ProvisioningService.php`
- **VPN panels**
- [Service management](https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Providers/Models/Server.php): `app/Modules/Providers/Models/Server.php`

### Shop management

- [Owner and agent panels](https://github.com/amir-aghajani/amo-bot/blob/main/resources/panel/src/apps/admin/app.tsx): `resources/panel/src/apps/admin/app.tsx`
- [Shop administration API](https://github.com/amir-aghajani/amo-bot/tree/main/app/Modules/Admin/Api): `app/Modules/Admin/Api`
- [Shop imports](https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Imports/Importer.php): `app/Modules/Imports/Importer.php`
- [Backups and restore](https://github.com/amir-aghajani/amo-bot/blob/main/app/Modules/Backups/Backups.php): `app/Modules/Backups/Backups.php`
- [Report group](https://github.com/amir-aghajani/amo-bot/tree/main/app/Modules/Telegram/Reports): `app/Modules/Telegram/Reports`

### Runtime operations

- [Scheduled tasks](https://github.com/amir-aghajani/amo-bot/blob/main/app/Core/Scheduling/Scheduler.php): `app/Core/Scheduling/Scheduler.php`
- [Cron endpoint](https://github.com/amir-aghajani/amo-bot/blob/main/app/Core/Http/Controllers/CronController.php): `app/Core/Http/Controllers/CronController.php`
- [Application runtime](https://github.com/amir-aghajani/amo-bot/blob/main/app/Core/Application.php): `app/Core/Application.php`
- [Application database](https://github.com/amir-aghajani/amo-bot/blob/main/app/Core/Database/DatabaseManager.php): `app/Core/Database/DatabaseManager.php`

### Other components

- **Customer**
- **Shop owner**
- **Shop agent**

## Connections

- Customer → Telegram bot: uses shop (evidence: `README.md`)
- Customer → Telegram mini app: opens in Telegram (evidence: `README.md`)
- Customer → Store API: uses website (evidence: `README.md`)
- Telegram bot → Customer accounts: signs in (evidence: `README.md`)
- Telegram mini app → Customer accounts: shares account (evidence: `README.md`)
- Telegram bot → Plans and catalog: browses plans (evidence: `README.md`)
- Telegram mini app → Plans and catalog: browses plans (evidence: `README.md`)
- Store API → Plans and catalog: offers shop (evidence: `README.md`)
- Telegram bot → Orders and pricing: places order (evidence: `README.md`)
- Telegram mini app → Orders and pricing: places order (evidence: `README.md`)
- Store API → Orders and pricing: checks out (evidence: `README.md`)
- Orders and pricing → Payments and deposits: accepts payment (evidence: `README.md`)
- Gateway callbacks → Payments and deposits: confirms payment (evidence: `app/Modules/Payments/Controllers/GatewayWebhookController.php`)
- Payments and deposits → Service provisioning: enables delivery (evidence: `README.md`)
- Service provisioning → VPN panels: creates service (evidence: `README.md`)
- Customer → Service management: manages service (evidence: `README.md`)
- Shop owner → Owner and agent panels: runs shop (evidence: `README.md`)
- Shop agent → Owner and agent panels: runs shop (evidence: `README.md`)
- Owner and agent panels → Shop administration API: manages through API (evidence: `README.md`)
- Owner and agent panels → Shop imports: reviews import (evidence: `README.md`)
- Shop administration API → Backups and restore: manages backups (evidence: `README.md`)
- Shop owner → Report group: acts on reports (evidence: `README.md`)
- Cron endpoint → Scheduled tasks: ticks scheduler (evidence: `app/Core/Http/Controllers/CronController.php`)
- Scheduled tasks → Application database: runs tasks
- Application runtime → Application database: boots database (evidence: `app/Core/Application.php`)
