2026-01-11 08:11:04 +03:00
2026-01-11 07:47:40 +03:00
2026-01-11 07:07:32 +03:00
2026-01-11 08:11:04 +03:00
2026-01-09 22:21:26 +03:00
2026-01-09 22:21:26 +03:00
2026-01-11 07:07:32 +03:00
2026-01-11 07:52:31 +03:00
2026-01-11 07:07:32 +03:00
2026-01-11 07:07:32 +03:00
2026-01-11 07:14:22 +03:00
2026-01-11 07:19:05 +03:00
Fix
2026-01-11 08:03:42 +03:00
2026-01-11 07:07:32 +03:00

Marzban Telegram Bot

A powerful Telegram Bot with a built-in Web App (Mini App) for managing Marzban VPN subscriptions.

Features

  • 📱 Interactive Web App: A beautiful Material 3 Expressive UI for users to manage their VPN.
  • 🌍 Localization: Fully localized in English and Russian.
  • 📊 User Dashboard: Real-time traffic usage, expiration date, and subscription status.
  • 🛍️ Shop: Integrated store to purchase VPN plans (Lite, Medium, Heavy, Unlimited) using Telegram Stars.
  • 🎟️ Promo Codes: Advanced promo code system (discounts, bonus days, unlimited usage).
  • 🔧 Configuration: Easy setup for users with QR codes and subscription links (VLESS/VMess/Trojan).
  • 🛡️ Admin Panel: comprehensive admin tools directly in the Web App:
    • View bot and server statistics (CPU, RAM, Revenue).
    • Manage users (add days, reset traffic, ban/unban, delete).
    • Create and manage promo codes.
    • Broadcast messages to all users.

Tech Stack

  • Backend: Python 3.11, Aiogram 3.x, FastAPI
  • Database: SQLite (default) or PostgreSQL (via asyncpg)
  • Frontend: HTML5, CSS3 (Material 3 Expressive Design), Vanilla JS
  • Integration: Marzban API

Prerequisites

  • A running Marzban instance.
  • Telegram Bot Token (from @BotFather).
  • Python 3.11+ (for local run) or Docker.

Setup & Configuration

  1. Clone the repository:

    git clone <your-repo-url>
    cd marzban_tg_bot
    
  2. Create config file: Rename .env.example to .env and fill in the values:

    BOT_TOKEN=your_bot_token_here
    ADMIN_IDS=12345678,87654321
    
    # Marzban Credentials
    MARZBAN_URL=https://your-marzban-domain.com
    MARZBAN_USERNAME=admin
    MARZBAN_PASSWORD=admin_password
    
    # Web App Settings
    BASE_URL=https://your-marzban-domain.com
    WEB_APP_URL=https://your-bot-domain.com # URL where this bot is hosted
    WEB_APP_PORT=8888
    
    # Database (leave empty for SQLite)
    DATABASE_URL=
    
  1. Build and Run:

    docker-compose -f docker/docker-compose.yml up -d --build
    
  2. Check Logs:

    docker-compose -f docker/docker-compose.yml logs -f
    

The Web App will be available at http://your-server-ip:8888. Ensure you have set up a reverse proxy (Nginx/Caddy) with SSL pointing to this port, as Telegram Web Apps require HTTPS.

Running Locally

  1. Create Virtual Environment:

    python -m venv .venv
    source .venv/bin/activate  # Linux/Mac
    .venv\Scripts\activate     # Windows
    
  2. Install Dependencies:

    pip install -r requirements.txt
    
  3. Run:

    python main.py
    

License

MIT License.

Description
No description provided
Readme 322 KiB
Languages
Python 47.4%
JavaScript 24.8%
CSS 18.6%
HTML 9.1%
Dockerfile 0.1%