Skip to main content

A modern, production-ready framework for building scalable Telegram bots with Aiogram 3.x

Project description

boundless-aiogram

Production-ready Telegram bot framework with CLI scaffolding โ€” powering bots with 1000s of users

PyPI version Downloads Python License: MIT

boundless-aiogram is a battle-tested bot framework built on top of aiogram 3.x. It provides a complete project structure, CLI tools, and best practices out of the box โ€” so you can focus on building features, not boilerplate.

2,000+ downloads and counting. Used in production bots serving thousands of users.


๐Ÿš€ Bots Built With This Framework

Bot Users Monthly Activity
Smart English HR 1,200+ 100+ applications
Cake Bot 200+ Active daily
+ More in production โ€” โ€”

โœจ Features

  • ๐Ÿ› ๏ธ CLI Scaffolding โ€” Generate new bot projects instantly
  • ๐Ÿ“ Production Structure โ€” Organized handlers, database, utils, languages
  • ๐Ÿ—„๏ธ Database Layer โ€” SQLAlchemy + Alembic migrations built-in
  • ๐ŸŒ Multi-language โ€” i18n support out of the box
  • โš™๏ธ Core Module โ€” Config and middleware ready to go
  • ๐Ÿงช Test Setup โ€” Testing structure included
  • ๐Ÿ“ค File Uploads โ€” Upload handling utilities

๐Ÿ“ฆ Installation

pip install boundless-aiogram

๐Ÿš€ Quick Start

Create a New Bot Project

# Generate new project
boundless-aiogram init my-awesome-bot

# Navigate to project
cd my-awesome-bot

# Install dependencies
pip install -r requirements.txt

# Configure environment
cp .env.example .env
# Edit .env with your bot token

# Run migrations
alembic upgrade head

# Start your bot
python main.py

That's it. You're ready to build.


๐Ÿ“ Generated Project Structure

my-awesome-bot/
โ”‚
โ”œโ”€โ”€ bot/                    # Bot handlers and logic
โ”‚   โ”œโ”€โ”€ handlers/          # Message & callback handlers
โ”‚   โ”œโ”€โ”€ keyboards/         # Inline & reply keyboards
โ”‚   โ”œโ”€โ”€ states/            # FSM states
โ”‚   โ””โ”€โ”€ filters/           # Custom filters
โ”‚
โ”œโ”€โ”€ core/                   # Core configuration
โ”‚   โ”œโ”€โ”€ config.py          # Settings management
โ”‚   โ””โ”€โ”€ middleware.py      # Bot middleware
โ”‚
โ”œโ”€โ”€ database/               # Database layer
โ”‚   โ”œโ”€โ”€ models.py          # SQLAlchemy models
โ”‚   โ”œโ”€โ”€ crud.py            # CRUD operations
โ”‚   โ””โ”€โ”€ session.py         # DB session management
โ”‚
โ”œโ”€โ”€ languages/              # Internationalization
โ”‚   โ”œโ”€โ”€ en.py              # English
โ”‚   โ”œโ”€โ”€ uz.py              # Uzbek
โ”‚   โ””โ”€โ”€ ru.py              # Russian
โ”‚
โ”œโ”€โ”€ migrations/             # Alembic migrations
โ”‚   โ””โ”€โ”€ versions/          # Migration files
โ”‚
โ”œโ”€โ”€ utils/                  # Utility functions
โ”‚   โ””โ”€โ”€ helpers.py         # Common helpers
โ”‚
โ”œโ”€โ”€ tests/                  # Test suite
โ”‚
โ”œโ”€โ”€ main.py                 # Entry point
โ”œโ”€โ”€ alembic.ini            # Alembic config
โ”œโ”€โ”€ requirements.txt        # Dependencies
โ”œโ”€โ”€ .env.example           # Environment template
โ””โ”€โ”€ .gitignore             # Git ignore

๐Ÿ› ๏ธ CLI Commands

Command Description
boundless-aiogram init <name> Create new bot project
boundless-aiogram --version Show version
boundless-aiogram --help Show help

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚          BOUNDLESS-AIOGRAM STRUCTURE            โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                 โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚   โ”‚                BOT                      โ”‚   โ”‚
โ”‚   โ”‚   Handlers โ€ข Keyboards โ€ข States         โ”‚   โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ”‚                        โ”‚                        โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚   โ”‚               CORE                      โ”‚   โ”‚
โ”‚   โ”‚       Config โ€ข Middleware               โ”‚   โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ”‚                        โ”‚                        โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚   โ”‚        โ”‚                       โ”‚        โ”‚   โ”‚
โ”‚   โ–ผ        โ–ผ                       โ–ผ        โ–ผ   โ”‚
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚ โ”‚Utils โ”‚ โ”‚Databaseโ”‚ โ”‚ Languages โ”‚ โ”‚Tests โ”‚    โ”‚
โ”‚ โ”‚      โ”‚ โ”‚Alembic โ”‚ โ”‚   i18n    โ”‚ โ”‚      โ”‚    โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ”‚                                                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“– Usage Examples

Basic Handler

from aiogram import Router
from aiogram.filters import Command
from aiogram.types import Message

router = Router()

@router.message(Command("start"))
async def cmd_start(message: Message):
    await message.answer("Welcome! ๐Ÿš€")

Using Database

from database.crud import create_user, get_user
from database.session import get_session

async def register_user(telegram_id: int, name: str):
    async with get_session() as session:
        user = await create_user(session, telegram_id, name)
        return user

Multi-language Support

from languages import get_text

async def greet(message: Message, lang: str = "en"):
    text = get_text("welcome", lang)
    await message.answer(text)

FSM States

from aiogram.fsm.state import State, StatesGroup

class RegistrationStates(StatesGroup):
    first_name = State()
    last_name = State()
    phone = State()

โš™๏ธ Configuration

Environment Variables

# Bot
BOT_TOKEN=your-bot-token-from-botfather

# Database
DATABASE_URL=postgresql://user:pass@localhost:5432/mybot
# Or SQLite:
# DATABASE_URL=sqlite:///bot.db

# Settings
ADMIN_IDS=123456789,987654321
DEFAULT_LANGUAGE=en
DEBUG=False

๐Ÿ—„๏ธ Database Migrations

# Create new migration
alembic revision --autogenerate -m "Add users table"

# Apply all migrations
alembic upgrade head

# Rollback one step
alembic downgrade -1

# View current version
alembic current

๐Ÿงช Testing

# Run tests
pytest

# With coverage
pytest --cov=bot --cov=database

๐Ÿš€ Deployment

systemd (Linux)

[Unit]
Description=My Telegram Bot
After=network.target

[Service]
Type=simple
User=ubuntu
WorkingDirectory=/path/to/my-bot
ExecStart=/path/to/venv/bin/python main.py
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

Docker

FROM python:3.12-slim

WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt

COPY . .

CMD ["python", "main.py"]

๐Ÿ“Š Why boundless-aiogram?

Feature boundless-aiogram Starting from scratch
Project setup 1 command 30+ minutes
Database layer โœ… Included Manual setup
Migrations โœ… Alembic ready Manual setup
Multi-language โœ… Built-in Manual setup
Best practices โœ… Enforced Hope for the best
Production tested โœ… 1000s of users Unknown

๐Ÿค Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/NewFeature)
  3. Commit changes (git commit -m 'Add NewFeature')
  4. Push to branch (git push origin feature/NewFeature)
  5. Open a Pull Request

๐Ÿ“„ License

MIT License - see LICENSE for details.


๐Ÿ“ž Support


Stop writing boilerplate. Start building bots.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

boundless_aiogram-2.0.0.tar.gz (35.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

boundless_aiogram-2.0.0-py3-none-any.whl (50.9 kB view details)

Uploaded Python 3

File details

Details for the file boundless_aiogram-2.0.0.tar.gz.

File metadata

  • Download URL: boundless_aiogram-2.0.0.tar.gz
  • Upload date:
  • Size: 35.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for boundless_aiogram-2.0.0.tar.gz
Algorithm Hash digest
SHA256 da7d0fef7631bb1c8bca01910cdcc979e0aff1a9fc2f377c7138bcf6145cd3eb
MD5 3dbac791d28a8f04ba92ca424bf0fdfb
BLAKE2b-256 2d9dab999f1c3e306bc15391639f46ae031e4954fb8dcae6755e21c0bad6a89e

See more details on using hashes here.

File details

Details for the file boundless_aiogram-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for boundless_aiogram-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5bc82831d5792709771667afe74412979453c4b0af3cbf6071791f5722ba99d2
MD5 7fe74f96a67b75e53404a5dfb7256848
BLAKE2b-256 b5a151f4ade2ec19c66c2928672f5424358c7ac9808198f26bb1eb6b74d6b2dd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page