An expanding collection of easily adaptable Aiogram templates for building Telegram bots.
- Easily extensible and maintainable code
- Simple and clean architecture
- RedisStorage caching for retaining message history
- Ready-to-use Alembic migration system
- Modern DB engine
- Design UIs easily with Aiogram Dialog
- Localization with Project Fluent
- Enviroment configuration with Poetry
- Python 3.x
- Aiogram 3.x
- Aiogram Dialog 2
- PostgreSQL
- Redis
- Alembic
- SQLAlchemy
- Project Fluent
- Docker
- Docker Compose
- Poetry
Clone the repository and navigate to the template-1 folder:
git clone git@github.com:avrtt/tg-bot-boilerplates.git
cd tg-bot-boilerplates/template-1
Create an .env file with the following contents and fill the lines (<...>
):
API_TOKEN=<...>
POSTGRES_USER=bot_user
POSTGRES_PASSWORD=<...>
POSTGRES_DB=bot_db
DB_HOST=db
DB_PORT=5432
DB_NAME=bot_db
DB_USER=bot_user
DB_PASS=<...>
Build:
docker-compose up --build
In the bot container, run:
alembic revision --autogenerate -m "init"
For using migrations:
alembic upgrade head
For shutting down the bot:
docker-compose down -v
Navigate to the template-2 folder instead. Rename docker-compose.example.yml
to docker-compose.yml
and .env.dist
to .env
. Configure .env
in the same way.
Build:
make app-build
Start:
make app-run
Setup environment:
poetry install
Update DB tables structure. Make the migration script:
make migration message=MIGRATION_DESCRIPTION
Run migrations:
make migrate
For updating translations, parse the new localization keys:
make i18n locale=TRANSLATION_LOCALE
Write new translations in .ftl
(translations/TRANSLATION_LOCALE
) and restart the bot.
This templates are licensed under the MIT License - see the LICENSE file for details.