Compare Indian domestic flights by ₹ per kilometre — not just total price.
Most travellers compare total fares — but a ₹3,000 short-hop and a ₹3,000 long-haul are not equal value. Flight Cost Intelligence normalises every Indian domestic route to ₹/km so you can compare fairly.
₹ per km = Total Ticket Price (₹) ÷ Route Distance (km)
Lower ₹/km = better value per kilometre flown.
The project is split into two repos:
| Repo | What it does | Hosted on |
|---|---|---|
Flight_per_km_cost (this) |
8-page HTML/JS frontend | GitHub Pages |
Flight_per_km_backend |
Flask REST API + data files | Render |
Browser (GitHub Pages)
│
▼ fetch JSON over REST (CORS enabled)
Flask API on Render
│
▼ loaded once at worker startup
CSV + JSON data files (~118 routes, 26 airports)
- No database — data lives in flat CSV/JSON files loaded into memory at startup
- Frontend auto-detects localhost vs. production and switches the API URL accordingly
- A background ping to
/api/pingwarms the Render server on every page load
| Page | File | What it does |
|---|---|---|
| Home | index.html |
Quick compare, popular routes, live stats |
| Route Compare | compare.html |
Multi-route ₹/km table, bar chart, Leaflet map |
| Price Predictor | predictor.html |
Monthly price trends, best booking month |
| Route Finder | route-finder.html |
All destinations from one origin, ranked by ₹/km |
| Route Optimizer | optimizer.html |
Nearby airports, cabin classes, layover options |
| Cost Heatmap | heatmap.html |
India map coloured by cost intensity |
| Visualizations | visualizations.html |
Cheapest/priciest routes, city averages |
| FAQ | faq.html |
Methodology, data sources, technical info |
| 404 | 404.html |
Friendly not-found page |
All responses: { "success": true, "data": ... } or { "success": false, "error": "..." }
| Method | Endpoint | Description | Used on |
|---|---|---|---|
GET |
/api/ping |
Health check / server warm-up | All pages |
GET |
/api/airports |
All airports with coords | All dropdowns |
POST |
/api/compare |
Compare routes by ₹/km | Compare |
POST |
/api/predict |
Monthly price trend for a route | Predictor |
POST |
/api/route-find |
Best destinations from an origin | Route Finder |
GET |
/api/nearby-airports |
Nearby airports by IATA code | Optimizer |
GET |
/api/class-layover |
Cabin class & layover data | Optimizer |
GET |
/api/heatmap |
Regional cost heatmap data | Heatmap |
GET |
/api/visualizations |
Cheapest/priciest routes + city averages | Visualizations, Home |
GET |
/api/raw-compare-data |
Enriched routes (CSV + JSON merged) | Home popular routes |
POST /api/comparealso returnsskippedandnot_foundarrays for invalid or missing routes.
You need both repos running simultaneously.
git clone https://github.com/Rakshita-0206/Flight_Project.git
cd Flight_Project/Flight_backend
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
python app.pyBackend runs at http://127.0.0.1:5000
git clone https://github.com/Rakshita-0206/Flight_Project.git
cd Flight_Project/Flight_Fronted
python3 -m http.server 5500Open http://localhost:5500 in your browser.
config.js auto-detects localhost and points the frontend at http://127.0.0.1:5000.
├── index.html
├── compare.html
├── predictor.html
├── route-finder.html
├── optimizer.html
├── heatmap.html
├── visualizations.html
├── faq.html
├── 404.html
└── assets/
├── css/
│ └── main.css # Design system (dark theme, responsive)
├── images/ # Hero + sub-hero photos
└── js/
├── config.js # API base URL + endpoint map
├── common.js # apiCall, fetchAirports, formatters, share URLs
└── images.js # Route thumbnail paths
├── app.py # Flask app + all API routes
├── gunicorn_config.py # 4 workers, port 10000
├── Procfile
├── render.yaml # Render deploy config
├── requirements.txt
├── scripts/
│ └── generate_data.py # Regenerates JSON from CSV
├── data/
│ ├── compare_data_new.csv # Canonical route prices (UPDATE FIRST)
│ ├── merged_flight_data.csv # Airport coords + names (UPDATE FIRST)
│ ├── compare_data.json # auto-generated
│ ├── trend_data.json # auto-generated
│ ├── class_layover_data.json# auto-generated
│ ├── heatmap_data.json # auto-generated
│ └── nearby_airports.json # auto-generated
└── tests/
└── test_api.py # 12 smoke tests covering all endpoints
Push to main — GitHub Pages auto-deploys in 1–3 minutes.
git add .
git commit -m "Your message"
git push origin mainLive at: https://Rakshita-0206.github.io/Flight_Project/
Push to the backend repo's main branch — Render auto-deploys.
git add .
git commit -m "Your message"
git push origin mainRender runs pip install -r requirements.txt then gunicorn -c gunicorn_config.py app:app.
| Setting | Value |
|---|---|
| Health check | /api/ping |
| Port | 10000 |
| Python version | 3.9.0 |
| You changed… | Push frontend? | Push backend? |
|---|---|---|
| HTML, CSS, JS, images only | ✅ Yes | ❌ No |
config.js API URL |
✅ Yes | ❌ No |
app.py or data files |
❌ No | ✅ Yes |
| Both UI and API | ✅ Yes | ✅ Yes (backend first) |
cd Flight_per_km_backend
python scripts/generate_data.py # write all JSON files
python scripts/generate_data.py --check # coverage report only- Update
compare_data_new.csvandmerged_flight_data.csv - Run
python scripts/generate_data.py - Push to GitHub → Render auto-redeploys (~2–5 min)
- Run
pytest tests/ -vto verify
cd Flight_per_km_backend
pip install -r requirements.txt
pytest tests/ -v12 smoke tests cover all API endpoints.
| Layer | Technology |
|---|---|
| Frontend | HTML5, CSS3, Vanilla ES6+ |
| Icons | Font Awesome 6.4 |
| Charts | Chart.js 4.4.1 |
| Maps | Leaflet 1.9.4 |
| Backend | Python 3.9+, Flask 2.0, flask-cors |
| Production server | Gunicorn + gevent (4 workers) |
| Storage | No database — in-memory cache at startup |
| Frontend hosting | GitHub Pages |
| API hosting | Render (free tier) |
| Problem | Fix |
|---|---|
| Slow first load (30–60 s) | Render free-tier cold start — wait and refresh |
| "Could not load route data" | Check backend is running; verify config.js API URL |
| Dropdowns empty | /api/airports call failed — check CORS and API URL |
| Maps or charts broken | Open browser console; check CDN scripts loaded |
| CORS errors locally | Ensure flask-cors is installed in the backend |
Tip: Point an uptime monitor (e.g. UptimeRobot, free) at
/api/pingevery 10 minutes to prevent Render cold starts.
- All prices in INR (₹);
cost_per_kmin ₹/km - IATA codes must be 3 uppercase letters — invalid codes are returned in
skipped - Predictor uses historical trend averages from
trend_data.json— not a live ML model - Country is hardcoded to
"India"in/api/airports - Home page falls back to
/api/visualizationsif/api/raw-compare-datalackscost_per_km - Distances use the Haversine formula (great-circle, accurate to ~0.3%)
| Name | GitHub |
|---|---|
| Rakshita | @Rakshita-0206 |
| Shalini | — |
📍 Lucknow, India