Skip to content

Latest commit

 

History

84 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Flight Router

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.

Table of Contents

Project Overview

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.

Key Features

  • 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.

Architecture

  • Client: React 19 + Vite application that uses Axios for API calls and OpenLayers for geospatial rendering.
  • Server: Flask API that exposes /api/search for algorithmic routing and /api/liveflights for scraped data, backed by reusable search helpers in algorithms.py and flight_scrapper.py.
  • Data: Routes sourced from airline_routes.json, loaded at server start to power distance and duration calculations.

Getting Started

Prerequisites

  • Node.js 18+ and npm
  • Python 3.10+
  • Playwright browser dependencies (installed via the commands below)

Server

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.py

The server starts on http://127.0.0.1:8080 by default.

Client

cd client
npm install --legacy-peer-deps
npm run dev

The Vite dev server runs on http://127.0.0.1:5173 by default.

Running the Full Stack

  1. Start the Flask API using the steps in the Server section.
  2. In a separate terminal, start the Vite dev server as described in the Client section.
  3. Open the client URL in your browser; API requests are proxied directly to the Flask server (http://127.0.0.1:8080).

Project Structure

.
├── client/            # React front end with OpenLayers map components
├── server/            # Flask API, routing algorithms, and Playwright scraper
└── README.md          # Project documentation (this file)

Troubleshooting

  • Missing Playwright browsers: Run python -m playwright install if playwright install fails.
  • 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 .venv directory and reinstall dependencies after pulling upstream changes.

About

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.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Contributors

Languages