Telegram bot for logging workouts. Manage a personal list of exercises, record sessions (date, weight, reps, sets), view history by date or by exercise, and optionally set profile (height, weight, age).
- Python 3.11+
- Poetry for dependency management
-
Copy the example env file and set your bot token:
cp .env.example .env # Edit .env and set TELEGRAM_BOT_TOKEN (get one from https://t.me/BotFather) -
Install dependencies and run migrations:
poetry install poetry run alembic upgrade head
-
Run the bot:
poetry run python -m app.main
| Variable | Required | Default | Description |
|---|---|---|---|
TELEGRAM_BOT_TOKEN |
Yes | — | Telegram bot token from BotFather |
LOG_LEVEL |
No | INFO |
Logging level |
SQLITE_DB_PATH |
No | bot.db |
Path to SQLite database file |
The image uses Poetry inside the container and runs migrations automatically on startup.
# Build
docker build -t tg-workout-bot .
# Run (pass token and mount a volume for the DB)
docker run --rm -e TELEGRAM_BOT_TOKEN=your_token_here -v bot-data:/data tg-workout-botThe container stores the database at /data/bot.db by default. Mount a volume at /data so it persists (e.g. -v bot-data:/data or use the host’s volume mapping).
For local or single-host runs:
cp .env.example .env
# Set TELEGRAM_BOT_TOKEN in .env
docker compose up --buildThis builds the image and loads env from .env. The DB is at /data/bot.db; mount a volume at /data for persistence. The entrypoint runs alembic upgrade head on each start, then starts the bot.
Same as above: TELEGRAM_BOT_TOKEN is required. Optional: LOG_LEVEL, SQLITE_DB_PATH (default in the image is /data/bot.db).
- Connect repo - Deploy via Git (push to their URL) or Docker build/push.
- Secrets / env - Set
TELEGRAM_BOT_TOKEN(from BotFather). - Volume - Map a persistent volume to /data so the DB at
/data/bot.dbsurvives restarts.
The bot uses long polling only (no HTTP server). The entrypoint runs alembic upgrade head on each start, then starts the bot. If the platform requires a health-check endpoint to avoid restarts, you would need to add one back (e.g. a small server on a port).
- VPS: Install Docker (or Python + Poetry), set
TELEGRAM_BOT_TOKENand optionallySQLITE_DB_PATH, run migrations if not using the Docker entrypoint, then start the bot or run the container with a volume.