This guide helps you run the bot and the Mini App locally in minutes. It covers setup with Docker and local tooling, plus a quick verification checklist.
- Python 3.11+ (Docker uses Python 3.12)
- Node.js 18+ (Node 20 is used in the webapp Dockerfile)
- Docker + Docker Compose (optional but recommended)
- A Telegram bot token from @BotFather
git clone https://github.com/MrConsoleka/aiogram-miniapp-template.git
cd aiogram-miniapp-template
cp .env.example .env
cp webapp/.env.example webapp/.envEdit .env and set the mandatory values:
TG__BOT_TOKEN=YOUR_BOT_TOKEN_HERE
TG__ADMIN_IDS=[YOUR_TELEGRAM_ID]
TG__WEBHOOK_USE=False
WEBAPP__URL=http://localhost:3000Notes:
TG__WEBHOOK_USE=Falseenables polling for local development.WEBAPP__URLis used to build the WebApp button in/profile.- Use
http://localhostif you run the full Docker stack with nginx. webapp/.envcontrols frontend API base URL (VITE_API_URL).
For full configuration details, see guides/configuration.md.
docker compose up -d --buildVerify:
- Bot responds to
/start - Mini App loads at
http://localhost - API responds at
http://localhost/api/health
make venv
make install
make runThis starts:
- Bot polling loop
- FastAPI Mini App backend on
API__PORT(default8000)
cd webapp
npm install
npm run devThe Vite dev server runs on http://localhost:3000 and proxies /api to http://localhost:8000.
- Open your bot in Telegram.
- Run
/profileto open the Mini App. - Check the Profile page loads and your data is displayed.
In .env, set:
API__DEBUG=trueFastAPI Swagger UI becomes available at:
http://localhost:8000/api/docs
Symptoms: No reply to /start.
Cause: Missing or invalid bot token.
Solution: Check TG__BOT_TOKEN and restart the bot.
Symptoms: /profile opens but shows a blank screen.
Cause: WEBAPP__URL is wrong or webapp is not running.
Solution: Set WEBAPP__URL to your webapp domain or http://localhost for Docker.
Symptoms: Profile page shows authorization error.
Cause: Invalid initData or wrong bot token.
Solution: Confirm bot token matches the bot opening the Mini App.
Symptoms: Browser blocks requests to /api.
Cause: API only allows Telegram WebApp domains by default.
Solution: Use the Vite proxy (/api) or add http://localhost:3000 to cors_settings() for development.
- DO keep
.envout of version control. - DO use Docker for production-like testing.
- DO run
make migrationandalembic upgrade headafter schema changes. - DO use
WEBAPP__URLto match your deployment domain. - DO keep
API__DEBUG=falsein production.
- Explore Handlers for bot logic
- Learn the Mini Apps Overview
- Read Deployment for production setup