A FastAPI web application integrated with a Telegram bot using aiogram.
- FastAPI: Modern, fast web framework for building APIs
- Aiogram: Powerful framework for Telegram Bot API
- UV Package Manager: Fast, reliable Python package management
- Environment-based Configuration: Easy configuration via
.envfiles
- Python 3.12 or higher
- Task - Task runner (install from https://taskfile.dev/installation/)
- UV - Will be installed automatically during setup
git clone <your-repo-url>
cd backendThe setup process is automated using Taskfile:
task setupThis will:
- ✓ Check Python version (3.12+)
- ✓ Install UV package manager if needed
- ✓ Create virtual environment
- ✓ Install all dependencies
- ✓ Create
.envfile for your configuration
Edit the .env file and add your configuration:
# Required: Get your token from @BotFather on Telegram
TELEGRAM_BOT_TOKEN=your_actual_bot_token_here
SUPABASE_URL=https://your_supabase_url_here
SUPABASE_ANON_KEY=your_supabase_anon_key_heretask devYour FastAPI application is now running at http://localhost:8000.
Run task --list to see all available tasks:
| Task | Description |
|---|---|
task setup |
Complete project setup for local development |
task dev |
Run FastAPI development server with hot reload |
task install |
Install project dependencies |
task update |
Update dependencies to latest versions |
task clean |
Remove virtual environment and cache files |
task shell |
Get command to activate virtual environment |
.
├── main.py # FastAPI application entry point
├── pyproject.toml # Project configuration and dependencies
├── Taskfile.yml # Task runner configuration
├── .env # Environment variables (create from .env.example)
├── .env.example # Environment variables template
├── uv.lock # UV package lock file
└── .venv/ # Virtual environment (created during setup)
Once the server is running, you can access:
- Interactive API docs (Swagger UI): http://localhost:8000/docs
- Alternative API docs (ReDoc): http://localhost:8000/redoc
- OpenAPI schema: http://localhost:8000/openapi.json
# Activate virtual environment first
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Add a new package
uv add package-name
# Or add as dev dependency
uv add --dev package-nameIf you prefer to work with the virtual environment directly:
# Get activation command
task shell
# Then run the command shown
source .venv/bin/activate # Unix/Mac
# or
.venv\Scripts\activate # WindowsThis project can be deployed to Vercel with Serverless Functions:
npm i -g vercel
vercel- Docker: Add a Dockerfile for containerized deployment
- Traditional Hosting: Use uvicorn or gunicorn with systemd
- Cloud Platforms: Deploy to AWS, GCP, Azure, etc.
If automatic UV installation fails, install manually:
# Unix/Mac
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows (PowerShell)
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"Verify your Python version:
python3 --version # Should be 3.12 or higherIf you encounter virtual environment problems:
task clean # Remove existing venv
task setup # Recreate everything- Create a new branch for your feature
- Make your changes
- Test thoroughly
- Submit a pull request
[Your License Here]