Real-Time Airfare Intelligence Platform
A FastAPI dashboard and API for exploring real-time airfare prices, route analytics, price history, and fare indexes.
Project Explanation
The Real-Time Airfare Intelligence Platform is a data-driven web application that brings flight discovery and airfare analytics into one place. Users can search airports and routes, inspect available flights and prices, review historical fare movements, and explore analytical insights through a dashboard and REST API.
The platform uses FastAPI to serve the dashboard and API, PostgreSQL to store airport, route, flight, and price data, and FlightAPI.io to support real airfare collection. Synthetic data and historical snapshots are also included so the application remains useful for demonstrations and analysis when live data is unavailable.
Project Objective
The primary objective is to transform complex airfare data into clear, searchable, and actionable insights. By combining current prices with historical trends and route analytics, the platform helps travelers compare fares and identify useful price patterns while giving analysts a foundation for studying airline pricing behavior.
It also demonstrates how a production-style data platform can combine an API backend, database storage, external data collection, analytics, and cloud deployment in one scalable solution.
Features
- FastAPI backend with PostgreSQL support.
- Searchable airport, route, flight, and price APIs.
- Synthetic historical fare data for demos.
- FlightAPI.io collection with direct PostgreSQL storage.
- Optional Kafka and Redis services for the full local stack.
- Frontend dashboard served by FastAPI.
Deploy on Render with Aiven
The repository includes render.yaml and a Docker deployment configuration.
- Create an Aiven PostgreSQL service.
- Copy its complete Service URI.
- Create a Render Blueprint from the repository.
- Set
DATABASE_URL, optionalFLIGHTAPI_API_KEY, and a long randomJWT_SECRET_KEY.
Render runs python -m app.startup before starting FastAPI. This creates the database tables and bundled airports, routes, flights, mock price snapshots, and synthetic history automatically. The operation is idempotent and safe across service restarts.
The deployment demo is limited to 250 routes for faster startup. Remove DEMO_ROUTE_LIMIT for the complete airport route graph. Set DEMO_ON_DEMAND_ROUTES=true to create mock flights for any two catalog airports when a user searches that pair.
Available Endpoints
/- Dashboard/docs- Interactive API documentation/api/airports/api/routes/api/flights/api/search/api/analytics
Run Locally with Docker
Copy .env.example to .env, provide a strong database password and JWT secret, then run:
copy .env.example .env
docker compose up -d --build
Open the dashboard at http://127.0.0.1:8010 and API documentation at http://127.0.0.1:8010/docs. To also run Kafka and Redis, use:
docker compose --profile full up -d --build
Run the Backend Locally
Install the backend dependencies, configure backend/.env, and run:
cd backend
pip install -r requirements.txt
python -m app.startup
For local development with the real FlightAPI.io collector, use python run_local.py after setting FLIGHTAPI_API_KEY.
Generate Additional History
Synthetic history is generated automatically during deployment. Generate it manually for an existing database with:
cd backend
python -m app.scripts.generate_historical_data --days 30 --snapshots-per-day 4
For one route only:
cd backend
python -m app.scripts.generate_historical_data --route DEL-BLR
Tests
cd backend
pytest
Security
Never commit .env files or database credentials. If a database URI has been shared publicly, rotate the database password and update Render's DATABASE_URL value.
Open the live dashboard or view the complete source code on GitHub.