A comprehensive flight price monitoring and notification system with Telegram integration. Track flight prices and get instant notifications when prices change!
- Real-time Flight Price Tracking: Monitor flight prices from major airlines
- Telegram Notifications: Get instant alerts when prices drop or change
- Web Interface: Easy-to-use web form for creating tracking requests
- Background Monitoring: Automated price checking every 2 hours
- Price History: Track price trends over time
- Multi-user Support: Multiple users can track different flights
- Docker Deployment: One-command deployment with Docker Compose
- Backend: Python 3.11, FastAPI, SQLAlchemy, Celery
- Frontend: JavaScript, HTML/CSS
- Database: PostgreSQL 15
- Cache/Broker: Redis 6
- APIs: Amadeus Flight API, Telegram Bot API
- Deployment: Docker, docker-compose
- Docker & Docker Compose (recommended)
- OR Manual Setup: Python 3.11+, PostgreSQL 14+, Redis 6+
Before deployment, obtain these API keys:
- Visit Amadeus Developer Portal
- Create account and new application
- Copy API Key and API Secret
- Start with Test environment (free 2,000 calls/month)
- Message @BotFather on Telegram
- Send
/newbotcommand and follow instructions - Save the Bot Token (format:
123456789:ABCdefGHI...) - Get your Chat ID from @userinfobot
Generate a secure key:
python -c "import secrets; print(secrets.token_urlsafe(32))"-
Clone Repository
git clone https://github.com/ngdbruce/flight-price-tracker.git cd flight-price-tracker -
Create Environment File
cp .env.example .env
-
Configure Environment Variables Edit
.envfile with your API keys:# Required API Keys AMADEUS_API_KEY=your_amadeus_api_key_here AMADEUS_API_SECRET=your_amadeus_api_secret_here TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here SECRET_KEY=your_generated_secret_key_here # Database & Redis (auto-configured) DATABASE_URL=postgresql://flight_user:flight_pass@db:5432/flight_tracker REDIS_URL=redis://redis:6379/0 # Application Settings ENVIRONMENT=production DEBUG=false PRICE_CHECK_INTERVAL_MINUTES=120 PRICE_CHANGE_THRESHOLD_PERCENT=5.0 MAX_TRACKING_REQUESTS_PER_USER=10
-
Deploy with Docker Compose
# Build and start all services docker compose up -d # Check service status docker compose ps # View logs docker compose logs -f
-
Access the Application
- Web Interface: http://localhost
- API Documentation: http://localhost:8000/docs
- Health Check: http://localhost:8000/health
-
Access Web Interface at http://localhost
-
Fill the Form:
- Origin Airport: Use IATA codes (e.g.,
JFK,LAX) - Destination Airport: Use IATA codes (e.g.,
SFO,CDG) - Departure Date: Pick a future date
- Return Date: Optional for round trips
- Telegram Chat ID: Your Telegram user ID
- Origin Airport: Use IATA codes (e.g.,
-
Example Request:
Origin: JFK (New York) Destination: LAX (Los Angeles) Departure: 2025-12-15 Return: 2025-12-22 Chat ID: 123456789
When prices change, you'll receive Telegram messages like:
βοΈ PRICE DROP ALERT!
JFK β LAX on 2025-12-15
Old Price: $299.99
New Price: $249.99
You Save: $50.00 (16.7% β¬οΈ)
Tracked since: 2025-09-20 14:30
| Service | Description | Port | Health Check |
|---|---|---|---|
| frontend | Web interface | 80 | http://localhost/ |
| backend | FastAPI REST API | 8000 | http://localhost:8000/health |
| worker | Celery background tasks | - | Check logs |
| scheduler | Celery beat scheduler | - | Check logs |
| db | PostgreSQL database | 5432 | Auto-configured |
| redis | Redis cache/broker | 6379 | Auto-configured |
# Start services
docker compose up -d
# Stop services
docker compose down
# Rebuild after code changes
docker compose build && docker compose up -d
# View logs
docker compose logs backend
docker compose logs worker
docker compose logs -f # Follow all logs
# Restart specific service
docker compose restart backendGET /health- System health statusGET /api/v1/flights/search- Search for flightsPOST /api/v1/tracking/requests- Create price trackingGET /api/v1/tracking/requests- List user's tracking requestsDELETE /api/v1/tracking/requests/{id}- Cancel tracking
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
# Search flights
curl "http://localhost:8000/api/v1/flights/search?origin=JFK&destination=LAX&departure_date=2025-12-15"
# Create tracking request
curl -X POST http://localhost:8000/api/v1/tracking/requests \
-H "Content-Type: application/json" \
-d '{
"origin_iata": "JFK",
"destination_iata": "LAX",
"departure_date": "2025-12-15",
"telegram_chat_id": 123456789
}'# API Health
curl http://localhost:8000/health
# Test flight search
curl "http://localhost:8000/api/v1/flights/search?origin=JFK&destination=LAX&departure_date=2025-12-15"
# Send test notification
curl -X POST http://localhost:8000/api/v1/test/notification \
-H "Content-Type: application/json" \
-d '{"chat_id": 123456789, "message": "Test notification"}'# Backend tests
docker compose exec backend pytest
# With coverage
docker compose exec backend pytest --cov=src- Backend Not Starting: Check logs with
docker compose logs backend - Database Connection Failed: Restart with
docker compose restart db - Telegram Bot Not Working: Verify bot token format and test manually
- Amadeus API Errors: Check API quota and credentials
- Frontend Not Loading: Check nginx logs with
docker compose logs frontend
Enable detailed logging:
# In .env file
DEBUG=true
LOG_LEVEL=DEBUGThen restart: docker compose down && docker compose up -d
| Variable | Description | Default | Required |
|---|---|---|---|
AMADEUS_API_KEY |
Amadeus API key | - | β |
AMADEUS_API_SECRET |
Amadeus API secret | - | β |
TELEGRAM_BOT_TOKEN |
Telegram bot token | - | β |
SECRET_KEY |
App security key | - | β |
DATABASE_URL |
PostgreSQL connection | - | β |
REDIS_URL |
Redis connection | - | β |
PRICE_CHECK_INTERVAL_MINUTES |
How often to check prices | 120 | β |
PRICE_CHANGE_THRESHOLD_PERCENT |
Min % change for notification | 5.0 | β |
MAX_TRACKING_REQUESTS_PER_USER |
Max requests per user | 10 | β |
flight-price-tracker/
βββ backend/
β βββ src/
β β βββ api/ # FastAPI endpoints
β β βββ models/ # Database models
β β βββ services/ # Business logic
β β βββ tasks/ # Celery background tasks
β β βββ main.py # FastAPI app
β βββ requirements.txt # Python dependencies
β βββ Dockerfile
βββ frontend/
β βββ src/
β β βββ scripts/ # JavaScript files
β β βββ styles/ # CSS files
β βββ index.html
βββ docker-compose.yml # Service orchestration
βββ .env.example # Environment template
βββ README.md
- Fork the repository
- Create feature branch:
git checkout -b feature/your-feature - Write tests for new functionality
- Follow code quality standards (Black, flake8)
- Submit pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- API Docs: Interactive docs at
/docsendpoint - Email: [email protected]
π« Happy Flight Tracking!
Created with β€οΈ by ngdbruce