Skip to content

Template based on Forden's template for creating scalable bots with aiogram

Notifications You must be signed in to change notification settings

realdevss/aiogram_template

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aiogram bot template by Forzend

Python Telegram Bot API Aiogram Docker

Template based on Forden's template for creating scalable bots with aiogram

Setting up

  1. Make sure you have installed cookiecutter.

  2. Generate project

    cookiecutter https://github.com/0Kit/aiogram_template.git
    
  3. Create an environment

    Make sure you have installed poetry

    poetry install
    
  4. Make changes to the project

  5. Make migrations (Choose one of the options)

    Using make

    make makemigrations
    

    Using poetry

    poetry run alembic revision --autogenerate -m init 
    
  6. Run project (Choose one of the options)

    In docker container(using make)

    Make sure you have installed poetry and Make

    make app-create
    

    In Docker(without extraneous tools)

     docker-compose up -d
    

    In your system

    python3 -m app
    

Development

dependencies

Click here to see some system dependencies

Structure

  • app — the source of the application
    • filters — module with custom
    • handlers — module with all project handlers
    • keyboards — module with telegram keyboards
      • inline
      • reply
    • middlewares — module with aiogram middlewares
    • models — module with database models
    • states — module aiogram state groups
    • utils — module with any project utils
    • main.py — Entrypoint
      • config.py — project constants loaded from the. env file
      • misc.py — project global varibles there
  • migrations — database migration module [automatically generated by alembic]
  • scripts — bash scripts * docker-entrypoint.sh — bash script for launching the application in a Docker container
  • .env.dist — example for .env file
  • .flake8 — flake8 config

Make commands

All commands are in the Makefile and are used by make [options] [command] [variables]

app-create — build and run start application

app-logs — check application log

app-strart — start the application

app-stop — stop the application

app-down — down the application

app-destroy — down the application with removing containers for services not defined in the Compose file and named volumes declared in the volumes section of the Compose file and anonymous volumes attached to containers.

Click here to see all make commands

Linters

isort — format code using isort

black — format code using black

flake8 — lint code using flake8

lint — use all code formatters and linters

Migrations

alembic ${args} — run alembic with some args

makemigrations — create new migrations based on the changes you have made to your models.

migrate — apply all migrations

downgrade — go back to the previous version of migrations

Docker

docker-config — is the same as docker-compose config

docker-ps — is the same as docker-compose ps

docker-build — is the same as docker-compose build

docker-up-dependencies — up dependencies in docker-compose

docker-up — up the app with its dependencies

docker-stop — is the same as docker-compose stop

docker-down — is the same as docker-compose down

docker-destroy — destroy application

docker-logs — show application log

About

Template based on Forden's template for creating scalable bots with aiogram

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 85.2%
  • Makefile 9.3%
  • Mako 2.3%
  • Dockerfile 1.6%
  • Shell 1.6%