Skip to content

webshining/aiogram-sqlalchemy-template

Repository files navigation

Aiogram SQLAlchemy Template

Technologies used:

  • Aiogram
  • Redis
  • SQLAlchemy
  • SQLite3
  • PostgreSQL
  • i18n
  • Docker and docker compose

Navigate

Getting started

Init project

#:/> git clone https://github.com/webshining/aiogram-sqlalchemy-template project_name
#:/> cd project_name
#:/project_name> pip install -r requirements.txt

if you have uv

#:/project_name> uv sync

Configure environment variables

Copy variables from .env.ren file to .env

#:/project_name> cp .env.ren .env

Bot config

TELEGRAM_BOT_TOKEN - your bot token (required)

I18N_DOMAIN - locales file name

Redis config

If you are not using redis, by default used MemoryStorage

RD_URI format
> redis[s]://[[username][:password]@][host][:port][/db-number]

RD_URI - connection url to your redis server

Database config

DB_URI format
> dialect+driver://username:password@host:port/database

DB_USER - your database username

DB_PASS - your database password

DB_NAME - your database name

DB_HOST - your database host

DB_PORT - your database port

You can specify DB_URI instead of DB_USER, DB_PASS, DB_NAME, DB_HOST and DB_PORT

DB_URI - connection url to your database server

Application start (local)

#:/project_name> python main.py

if you have make

#:/project_name> make run

if you have uv

#:/project_name> uv run main.py

Docker

Application start (docker)

Run only one service:
$ docker-compose up -d service-name

#:/project_name> docker compose up -d

If you have make you can enter

#:/project_name> make rebuild

View app logs

#:/project_name> docker-compose logs -f app

If you have make you can enter

#:/project_name> make logs

Rebuild app

#:/project_name> docker-compose up -d --build --no-deps --force-recreate

If you have make you can enter

#:/project_name> make rebuild