Flight Router is an interactive web application that pairs a React map-based interface with a Flask routing engine to help travelers compare optimized flight paths across one-way, round-trip, and multi-city itineraries.
- Project Overview
- Key Features
- Architecture
- Getting Started
- Running the Full Stack
- Project Structure
- Troubleshooting
The project combines a geospatial front end with route-finding algorithms and live flight scraping to visualize practical travel options. Users can search for routes between airports, tune algorithmic preferences, and overlay scraped fare results to make more informed decisions.
- Search customization – Choose among Dijkstra, A* or backtracking algorithms, routing priorities (cheapest, fastest, optimal), stop limits, and trip types including multi-city itineraries.
- Interactive map visualization – Render suggested routes directly on an OpenLayers-powered map with waypoint highlighting for the selected itinerary.
- Live flight data – Scrape Google Flights via Playwright to collect fare, duration, and emissions data that match the user’s search parameters.
- Multi-leg aggregation – Merge routes for multi-city trips, combining distance and duration across legs to present cohesive itineraries.
- Client: React 19 + Vite application that uses Axios for API calls and OpenLayers for geospatial rendering.
- Server: Flask API that exposes
/api/searchfor algorithmic routing and/api/liveflightsfor scraped data, backed by reusable search helpers inalgorithms.pyandflight_scrapper.py. - Data: Routes sourced from
airline_routes.json, loaded at server start to power distance and duration calculations.
- Node.js 18+ and npm
- Python 3.10+
- Playwright browser dependencies (installed via the commands below)
cd server
python -m venv .venv
source .venv/bin/activate # On Windows use `.venv\\Scripts\\activate`
pip install --upgrade pip
pip install -r requirements.txt
playwright install # If this fails, try `python -m playwright install`
python main.pyThe server starts on http://127.0.0.1:8080 by default.
cd client
npm install --legacy-peer-deps
npm run devThe Vite dev server runs on http://127.0.0.1:5173 by default.
- Start the Flask API using the steps in the Server section.
- In a separate terminal, start the Vite dev server as described in the Client section.
- Open the client URL in your browser; API requests are proxied directly to the Flask server (
http://127.0.0.1:8080).
.
├── client/ # React front end with OpenLayers map components
├── server/ # Flask API, routing algorithms, and Playwright scraper
└── README.md # Project documentation (this file)
- Missing Playwright browsers: Run
python -m playwright installifplaywright installfails. - No flights returned: Verify that trip dates are valid and sequential for multi-city searches; the client enforces these constraints and the scraper saves empty results if Google Flights shows no matches.
- Stale virtual environment: Recreate the
.venvdirectory and reinstall dependencies after pulling upstream changes.