Loading repository dataβ¦
Loading repository dataβ¦
TimNekk / repository
π Copier Template for Telegram Bot using Aiogram, Postgres, Redis, Docker, Coolify Ready
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Ensure uv is installed, then create a new Telegram bot project with:
uvx --with copier-templates-extensions copier copy --trust -r HEAD gh:TimNekk/copier-telegram-bot ~/path/to/your/project
Built with Copier, this template lets you toggle features during setup - choose what you need and generate files instantly! Ready for Docker π³ and Coolify βοΈ deployment.
Docker Compose π³ Launch bot + services with one commandPython 3.9β3.14 π Choose your Python version easilyuv π Fast dependency management powered by RustPoetry π¦ Manage dependencies safely with virtual environmentspip π Classic Python package installerAiogram β‘ Modern async bot framework with state managementAiogram Dialog πΌοΈ Create menus and interactive interfacesRedis β€οΈ Keep bot data safe between restartsPostgreSQL π Powerful database for complex projectsSQLAlchemy π οΈ Work with databases using Python codeAlembic β³ Track and apply database changes easilyUser Table π€ id, username, first_name, last_name, etcDependency Injection π Share tools/data across bot handlersThrottling π Stop spam with automatic speed limitsDatabase Sessions β»οΈ Auto-manage database connectionsLoguru π Simple logging with colors and funUser Register π Adds a user to the database on /startCallback Answer π Automatically answer callback queriesPostHog π Product analytics with user tracking and event capturei18n π Multiple languages supportDependabot π€ Automatic dependency updatesPydantic Settings β
Safe config management with type checkingDynaconf βοΈ Configs for dev/test/prod environmentsRuff πͺΆ Super-fast code linting and cleanupJustfile πͺ Short commands for complex tasksCache Decorator β‘ Speed up functions with Redis cachingThe fully-featured generated project can be found in the example/ directory.
Below is the folder structure of the generated project:
.
βββ bot # Main directory for the bot's source code
β βββ cache # Contains caching-related modules
β β βββ redis.py # Module for Redis-based caching functionality
β β βββ serialization.py # Handles serialization and deserialization for cached data
β β
β βββ core # Core components of the bot
β β βββ loader.py # Initializes and loads core components of the bot
β β βββ settings.py # Configuration and settings for the bot
β β
β βββ database # Database-related modules and models
β β βββ models # Directory for database model definitions
β β β βββ base.py # Base class for database models
β β β βββ user.py # User table model
β β βββ database.py # Database connection
β β
β βββ dialogs # Dialog flow and interaction logic
β β βββ example # Example implementation of dialogs
β β βββ dialogs.py # Defines dialogs
β β βββ getters.py # Retrieves data required for dialogs
β β βββ handlers.py # Handles user interactions within dialogs
β β
β βββ filters/ # Custom filters for handling specific bot commands or messages
β β
β βββ handlers # General handlers for bot events
β β βββ start.py # Handler for the /start command
β β
β βββ keyboards # Defines inline and reply keyboards for user interaction
β β βββ inline # Inline keyboards
β β
β βββ middleware # Middleware modules to extend bot behavior
β β βββ analytics.py # Middleware to identify user for analytics
β β βββ database.py # Middleware to manage database interactions during events
β β βββ dependency.py # Dependency injection middleware for shared resources
β β βββ logger.py # Middleware to log events
β β βββ throttling.py # Middleware to handle rate-limiting of requests
β β βββ user_register.py # Add user to DB on /start
β β
β βββ services/ # Auxiliary services with business logic
β β βββ user.py # User CRUD and helpers
β β
β βββ states/ # FSM states
β β βββ example.py # Example states
β β
β βββ __main__.py # Entry point to run the bot application
β βββ commands.py # Commands setup
β
βββ locales # Translations (Fluent `.ftl` files)
β βββ en
β βββ LC_MESSAGES
β βββ bot.ftl # English texts (add more locales similarly)
β
βββ migrations # Database migration files (managed by Alembic)
β βββ versions/ # Directory containing individual migration scripts
β β βββ add_users_table.py # Creates users table
β βββ env.py # Alembic environment configuration file
β βββ script.py.mako # Template for generating new migration scripts
β
βββ .dockerignore # Specifies files and directories to ignore in Docker builds
βββ .gitignore # Specifies files and directories to ignore in Git version control
βββ .github
β βββ dependabot.yml # Automatic dependency updates
βββ .python-version # Python version specification file for version managers like pyenv
βββ .env # Environment variable settings file
βββ .template.env # Template file for environment variables
βββ alembic.ini # Alembic configuration file for database migrations
βββ compose.yaml # Docker Compose configuration file for multi-container setups
βββ Dockerfile # Instructions to build a Docker image for the application
βββ entrypoint.sh # Script executed as the container's entry point
βββ justfile # Task runner configuration file (for `just` command automation)
βββ pyproject.toml # Python project metadata and dependencies configuration (PEP-518)
βββ README.md # Documentation readme file describing the project
βββ uv.lock # Lock file generated by a dependency manager
Before using the Copier Telegram Bot template, ensure you have the following installed:
Once these prerequisites are installed, you're ready to use the template!
copier copy --trust -r HEAD gh:TimNekk/copier-telegram-bot ~/path/to/your/project
Copier will ask you a lot of questions. Answer them to properly generate the template.
Help shape the future! Planned improvements:
Testing β
Add testing frameworkFlake8 / wemake π§Ή Alternative strict linting for code quality fansAdmin Role π Add admin filterCommands i18n π Add i18n support for bot commandsGot ideas? Star β the repo or open an issue to collaborate! π