# valentinvelnesev-alt/vpn-panel architecture

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

- Interactive diagram: https://gitdiagram.com/valentinvelnesev-alt/vpn-panel
- Repository: https://github.com/valentinvelnesev-alt/vpn-panel

## Overview

Reactus VPN Panel is a self-hosted VPN business management product built around Remnawave, with an admin web panel and a Telegram sales bot. The principal customer journey runs from bot interaction through payment confirmation to subscription provisioning. Administrators configure the bot and services, manage customers and nodes, and review business metrics in the web panel. The graph also preserves documented analytics, broadcasts, promotions, referrals, and import capabilities. Some routes and workers were not sampled; their inclusion and links rely on README descriptions, not inspection of their implementations.

Main entry points: [`backend/app/main.py`](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/main.py) (API application), [`shared/db/models.py`](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/shared/db/models.py) (Shared domain models), [`frontend/src/App.tsx`](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/frontend/src/App.tsx) (Admin SPA), [`bot/app/services/payment_processor.py`](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/bot/app/services/payment_processor.py) (Payment application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Admin web panel"]
  node_webapp["Admin SPA<br/>[App.tsx]"]
  node_webapi["API client<br/>[api.ts]"]
  node_dashboard["Dashboard and analytics<br/>[Dashboard.tsx]"]
  node_management["Customer and node management<br/>[Clients.tsx]"]
  node_botsettings["Bot and sales settings<br/>[Bot.tsx]"]
  node_broadcastui["Broadcast management<br/>[Broadcasts.tsx]"]
end

subgraph group_api["Panel API"]
  node_apiapp["API application<br/>[main.py]"]
  node_auth["Admin authentication<br/>[auth.py]"]
  node_botadmin["Bot administration<br/>[bot.py]"]
  node_customers["Client management<br/>[clients.py]"]
  node_nodeapi["Node management<br/>[nodes.py]"]
  node_analyticsapi["Analytics and dashboard<br/>[analytics.py]"]
  node_broadcastapi["Broadcast API<br/>[broadcasts.py]"]
  node_promoapi["Promotions and referrals<br/>[promo.py]"]
  node_webhooks["Payment webhooks<br/>[webhooks.py]"]
  node_imports["Legacy bot imports<br/>[bedolaga_import.py]"]
end

subgraph group_bot["Telegram sales bot"]
  node_botentry["Bot conversation handlers<br/>[handlers.py]"]
  node_botconfig["Runtime bot configuration<br/>[config.py]"]
  node_payment["Payment application"]
  node_subscription["Subscription provisioning<br/>[subscriptions.py]"]
  node_referral["Referral rewards<br/>[referral.py]"]
  node_broadcastworker["Broadcast worker<br/>[broadcast.py]"]
end

subgraph group_shared["Shared services"]
  node_bus["Redis command bus<br/>[bus.py]"]
  node_models["Shared domain models<br/>[models.py]"]
  node_database[("PostgreSQL data<br/>[session.py]")]
  node_remnawave["Remnawave client<br/>[client.py]"]
  node_paymentproviders["Payment provider clients<br/>[cryptobot.py]"]
end

node_admin(("Panel admin"))
node_customer(("Bot customer"))
node_telegram["Telegram"]
node_remnawaveservice["Remnawave service"]
node_redis["Redis"]

node_admin -->|"uses"| node_webapp
node_webapp -->|"uses"| node_webapi
node_webapi -.->|"calls"| node_apiapp
node_apiapp -->|"routes"| node_auth
node_apiapp -->|"routes"| node_botadmin
node_apiapp -->|"routes"| node_customers
node_apiapp -->|"routes"| node_nodeapi
node_apiapp -->|"routes"| node_analyticsapi
node_apiapp -->|"routes"| node_broadcastapi
node_apiapp -->|"routes"| node_promoapi
node_apiapp -->|"routes"| node_webhooks
node_webapp -.->|"shows"| node_dashboard
node_webapp -.->|"shows"| node_management
node_webapp -.->|"shows"| node_botsettings
node_webapp -.->|"shows"| node_broadcastui
node_customer -->|"interacts"| node_telegram
node_telegram -.->|"delivers updates"| node_botentry
node_botentry -->|"applies payment"| node_payment
node_payment -->|"provisions access"| node_subscription
node_subscription -->|"manages access"| node_remnawave
node_remnawave -->|"calls"| node_remnawaveservice
node_webhooks -->|"verifies payment"| node_paymentproviders
node_webhooks -->|"notifies bot"| node_bus
node_botadmin -->|"publishes commands"| node_bus
node_bus -->|"publishes messages"| node_redis
node_botentry -->|"uses settings"| node_botconfig
node_botconfig -->|"loads configuration"| node_models
node_payment -->|"uses payment records"| node_models
node_subscription -->|"updates subscriptions"| node_models
node_referral -->|"uses referral records"| node_models
node_broadcastworker -->|"reads audiences"| node_models
node_models -.->|"persists records"| node_database
node_imports -.->|"imports customer data"| node_models
node_customer -.->|"pays for access"| node_payment

click node_webapp "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/frontend/src/App.tsx"
click node_webapi "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/frontend/src/lib/api.ts"
click node_dashboard "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/frontend/src/pages/Dashboard.tsx"
click node_management "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/frontend/src/pages/Clients.tsx"
click node_botsettings "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/frontend/src/pages/Bot.tsx"
click node_broadcastui "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/frontend/src/pages/Broadcasts.tsx"
click node_apiapp "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/main.py"
click node_auth "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/api/v1/auth.py"
click node_botadmin "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/api/v1/bot.py"
click node_customers "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/api/v1/clients.py"
click node_nodeapi "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/api/v1/nodes.py"
click node_analyticsapi "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/api/v1/analytics.py"
click node_broadcastapi "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/api/v1/broadcasts.py"
click node_promoapi "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/api/v1/promo.py"
click node_webhooks "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/api/v1/webhooks.py"
click node_imports "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/services/bedolaga_import.py"
click node_botentry "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/bot/app/handlers.py"
click node_botconfig "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/bot/app/config.py"
click node_payment "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/bot/app/services/payment_processor.py"
click node_subscription "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/bot/app/services/subscriptions.py"
click node_referral "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/bot/app/services/referral.py"
click node_broadcastworker "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/bot/app/workers/broadcast.py"
click node_bus "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/shared/bus.py"
click node_models "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/shared/db/models.py"
click node_database "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/shared/db/session.py"
click node_remnawave "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/shared/remnawave/client.py"
click node_paymentproviders "https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/shared/payments/cryptobot.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_webapp,node_webapi,node_dashboard,node_management,node_botsettings,node_broadcastui toneBlue
class node_apiapp,node_auth,node_botadmin,node_customers,node_nodeapi,node_analyticsapi,node_broadcastapi,node_promoapi,node_webhooks,node_imports,node_redis toneAmber
class node_botentry,node_botconfig,node_payment,node_subscription,node_referral,node_broadcastworker toneMint
class node_bus,node_models,node_database,node_remnawave,node_paymentproviders toneRose
class node_admin,node_customer,node_telegram,node_remnawaveservice toneIndigo
```

## Components

### Admin web panel

- [Admin SPA](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API client](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [Dashboard and analytics](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/frontend/src/pages/Dashboard.tsx): `frontend/src/pages/Dashboard.tsx`
- [Customer and node management](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/frontend/src/pages/Clients.tsx): `frontend/src/pages/Clients.tsx`
- [Bot and sales settings](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/frontend/src/pages/Bot.tsx): `frontend/src/pages/Bot.tsx`
- [Broadcast management](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/frontend/src/pages/Broadcasts.tsx): `frontend/src/pages/Broadcasts.tsx`

### Panel API

- [API application](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/main.py): `backend/app/main.py`
- [Admin authentication](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/api/v1/auth.py): `backend/app/api/v1/auth.py`
- [Bot administration](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/api/v1/bot.py): `backend/app/api/v1/bot.py`
- [Client management](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/api/v1/clients.py): `backend/app/api/v1/clients.py`
- [Node management](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/api/v1/nodes.py): `backend/app/api/v1/nodes.py`
- [Analytics and dashboard](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/api/v1/analytics.py): `backend/app/api/v1/analytics.py`
- [Broadcast API](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/api/v1/broadcasts.py): `backend/app/api/v1/broadcasts.py`
- [Promotions and referrals](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/api/v1/promo.py): `backend/app/api/v1/promo.py`
- [Payment webhooks](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/api/v1/webhooks.py): `backend/app/api/v1/webhooks.py`
- [Legacy bot imports](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/backend/app/services/bedolaga_import.py): `backend/app/services/bedolaga_import.py`

### Telegram sales bot

- [Bot conversation handlers](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/bot/app/handlers.py): `bot/app/handlers.py`
- [Runtime bot configuration](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/bot/app/config.py): `bot/app/config.py`
- [Payment application](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/bot/app/services/payment_processor.py): `bot/app/services/payment_processor.py`
- [Subscription provisioning](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/bot/app/services/subscriptions.py): `bot/app/services/subscriptions.py`
- [Referral rewards](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/bot/app/services/referral.py): `bot/app/services/referral.py`
- [Broadcast worker](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/bot/app/workers/broadcast.py): `bot/app/workers/broadcast.py`

### Shared services

- [Redis command bus](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/shared/bus.py): `shared/bus.py`
- [Shared domain models](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/shared/db/models.py): `shared/db/models.py`
- [PostgreSQL data](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/shared/db/session.py): `shared/db/session.py`
- [Remnawave client](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/shared/remnawave/client.py): `shared/remnawave/client.py`
- [Payment provider clients](https://github.com/valentinvelnesev-alt/vpn-panel/blob/main/shared/payments/cryptobot.py): `shared/payments/cryptobot.py`

### Other components

- **Panel admin**
- **Bot customer**
- **Telegram**
- **Remnawave service**
- **Redis**

## Connections

- Panel admin → Admin SPA: uses (evidence: `README.md`)
- Admin SPA → API client: uses (evidence: `frontend/src/App.tsx`)
- API client → API application: calls
- API application → Admin authentication: routes
- API application → Bot administration: routes
- API application → Client management: routes
- API application → Node management: routes
- API application → Analytics and dashboard: routes
- API application → Broadcast API: routes
- API application → Promotions and referrals: routes
- API application → Payment webhooks: routes
- Admin SPA → Dashboard and analytics: shows
- Admin SPA → Customer and node management: shows
- Admin SPA → Bot and sales settings: shows
- Admin SPA → Broadcast management: shows
- Bot customer → Telegram: interacts (evidence: `README.md`)
- Telegram → Bot conversation handlers: delivers updates
- Bot conversation handlers → Payment application: applies payment (evidence: `bot/app/handlers.py`)
- Payment application → Subscription provisioning: provisions access (evidence: `bot/app/services/payment_processor.py`)
- Subscription provisioning → Remnawave client: manages access (evidence: `bot/app/services/subscriptions.py`)
- Remnawave client → Remnawave service: calls (evidence: `shared/remnawave/client.py`)
- Payment webhooks → Payment provider clients: verifies payment (evidence: `backend/app/api/v1/webhooks.py`)
- Payment webhooks → Redis command bus: notifies bot (evidence: `backend/app/api/v1/webhooks.py`)
- Bot administration → Redis command bus: publishes commands (evidence: `backend/app/api/v1/bot.py`)
- Redis command bus → Redis: publishes messages (evidence: `shared/bus.py`)
- Bot conversation handlers → Runtime bot configuration: uses settings (evidence: `bot/app/handlers.py`)
- Runtime bot configuration → Shared domain models: loads configuration (evidence: `bot/app/config.py`)
- Payment application → Shared domain models: uses payment records (evidence: `bot/app/services/payment_processor.py`)
- Subscription provisioning → Shared domain models: updates subscriptions (evidence: `bot/app/services/subscriptions.py`)
- Referral rewards → Shared domain models: uses referral records (evidence: `bot/app/services/referral.py`)
- Broadcast worker → Shared domain models: reads audiences (evidence: `bot/app/workers/broadcast.py`)
- Shared domain models → PostgreSQL data: persists records
- Legacy bot imports → Shared domain models: imports customer data
- Bot customer → Payment application: pays for access
