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
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
- Fork the repository
- Create feature branch (
git checkout -b feature/NewFeature) - Commit changes (
git commit -m 'Add NewFeature') - Push to branch (
git push origin feature/NewFeature) - Open a Pull Request
๐ License
MIT License - see LICENSE for details.
๐ Support
- Issues: GitHub Issues
- PyPI: pypi.org/project/boundless-aiogram
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da7d0fef7631bb1c8bca01910cdcc979e0aff1a9fc2f377c7138bcf6145cd3eb
|
|
| MD5 |
3dbac791d28a8f04ba92ca424bf0fdfb
|
|
| BLAKE2b-256 |
2d9dab999f1c3e306bc15391639f46ae031e4954fb8dcae6755e21c0bad6a89e
|
File details
Details for the file boundless_aiogram-2.0.0-py3-none-any.whl.
File metadata
- Download URL: boundless_aiogram-2.0.0-py3-none-any.whl
- Upload date:
- Size: 50.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bc82831d5792709771667afe74412979453c4b0af3cbf6071791f5722ba99d2
|
|
| MD5 |
7fe74f96a67b75e53404a5dfb7256848
|
|
| BLAKE2b-256 |
b5a151f4ade2ec19c66c2928672f5424358c7ac9808198f26bb1eb6b74d6b2dd
|