aiogram_bot_template
aiogram_bot_template copied to clipboard
Aiogram 3.x bot template using PostgreSQL (asyncpg) with SQLAlchemy + alembic.
aiogram_bot_template
System dependencies
- Python 3.11+
- Docker
- docker-compose
- make
- poetry
Deployment
Via Docker
- Rename
.env.distto.envand configure it - Rename
docker-compose.example.ymltodocker-compose.yml - Run
make app-buildcommand thenmake app-runto start the bot
Via Systemd service
- Configure and start PostgreSQL
- Configure and start Redis (» Read more)
- Rename
.env.exampleto.envand configure it - Run database migrations with
make migratecommand - Configure
telegram-bot.service(» Read more)
Development
Setup environment
poetry install
Update database tables structure
Make migration script:
make migration message=MESSAGE_WHAT_THE_MIGRATION_DOES
Run migrations:
make migrate
Update translations
- Parse new used localization keys to update translations files
(
make i18n locale=TRANSLATION_LOCALE) - Write new translations in
.ftlfiles bytranslations/TRANSLATION_LOCALE - Restart the bot
Used technologies:
- Aiogram 3.x (Telegram bot framework)
- PostgreSQL (database)
- SQLAlchemy (working with database from Python)
- Alembic (lightweight database migration tool)
- Redis (in-memory data storage for FSM and caching)
- Project Fluent (modern localization system)