Skip to content

abdul8704/FlyByViews

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

49 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FlyByViews πŸ›«

FlyByViews is an intelligent flight route planner that helps travelers discover scenic views and choose optimal airplane seats for sunrise/sunset viewing. The application analyzes geographical features along flight paths and calculates sun positions to provide personalized seat recommendations.

Flight Route Planning

✨ Features

πŸ—ΊοΈ Interactive Route Planning

  • Plan flight routes between any two cities worldwide
  • Interactive map visualization with Leaflet and OpenStreetMap
  • Real-time great-circle path calculation

πŸ”οΈ Scenic Feature Discovery

  • Discover mountains, volcanoes, and coastlines along your flight path
  • Left/right side classification of scenic features
  • Detailed scenery statistics and breakdown

πŸŒ… Smart Seat Recommendations

  • Sun Position Analysis: Real-time solar calculations for optimal sunrise/sunset viewing
  • Time-based Recommendations: Suggests left or right window seats based on flight time
  • Interactive Sun Tracking: Time slider to visualize sun position throughout the flight
  • Night Flight Detection: Intelligent handling of nighttime flights

πŸ“Š Flight Analytics

  • Distance calculations and flight duration estimates
  • Scenic feature counts by type (mountains, coastlines, volcanoes)
  • Subsolar point tracking (where sun is directly overhead)

πŸ› οΈ Tech Stack

Frontend

  • React 17 - User interface framework
  • Leaflet & React-Leaflet - Interactive maps
  • Tailwind CSS - Utility-first CSS framework
  • Axios - HTTP client for API requests

Backend

  • Node.js - JavaScript runtime
  • Express.js - Web application framework
  • MongoDB - NoSQL database
  • Mongoose - MongoDB object modeling
  • Redis - Caching recent queries
  • Nodemailer - Email service for OTP

External APIs & Data Sources

  • OpenStreetMap Nominatim - City coordinates geocoding
  • Overpass API - Geographical feature data
  • Custom astronomical calculations - Sun position algorithms

πŸš€ Local Setup

Prerequisites

  • Node.js (v16+ recommended)
  • MongoDB (local installation or MongoDB Atlas)
  • Redis (for caching)
  • Git

1. Clone the Repository

git clone https://github.com/abdul8704/FlightBooking-clean.git
cd FlightBooking-clean

2. Backend Setup

Navigate to server directory

cd server

Install dependencies

npm install

Environment Configuration

Create a .env file in the server directory:

# Database
MONGODB_URI=mongodb://localhost:27017/flybyviews
# Or for MongoDB Atlas:
# MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/flybyviews

# Redis
REDIS_URL=redis://localhost:6379

# JWT Secrets
JWT_SECRET=your-super-secret-jwt-key-here
JWT_REFRESH_SECRET=your-refresh-token-secret-here

# Email Configuration (for OTP)
EMAIL_USER=your-email@gmail.com
EMAIL_PASS=your-app-password

# API Configuration
USER_EMAIL=your-email@domain.com  # Used for OpenStreetMap API requests
PORT=5000

Start the backend server

npm run dev
# Server runs on http://localhost:5000

3. Frontend Setup

Navigate to client directory (new terminal)

cd client

Install dependencies

npm install

Start the development server

npm run dev
# Client runs on http://localhost:5173

4. Access the Application

Open your browser and navigate to:

πŸ“± How to Use

1. Plan a Flight Route

  1. Navigate to the Flight Route Planner page
  2. Enter your source city (e.g., "Chennai")
  3. Enter your destination city (e.g., "Srinagar")
  4. Optionally add a departure time for sun calculations
  5. Click "Plan Route & Show Scenery"

2. Explore Scenic Features

  • View the interactive map showing your flight path
  • Examine scenic statistics showing mountains, coastlines, and volcanoes on left/right sides
  • Click on map markers to see feature details

3. Get Seat Recommendations

  • If you provided a departure time, see smart seat recommendations
  • Use the time slider to track sun position throughout your flight
  • Choose between sunrise/sunset viewing or scenic features

4. Interactive Sun Tracking

  • The yellow dot shows where the sun is directly overhead
  • Drag the slider to see sun movement during your flight
  • Get real-time guidance on which side to look for the sun

πŸ”§ API Endpoints

Flight Routes

  • POST /api/flights/route-scenery - Get scenic features along a flight route

Authentication

  • POST /auth/signup - User registration
  • POST /auth/login - User login
  • POST /auth/send-otp - Send OTP for password reset
  • POST /auth/verify-otp - Verify OTP
  • POST /auth/reset-password - Reset password

🌟 Key Algorithms

Sun Position Calculation

The application uses precise astronomical algorithms to calculate:

  • Solar azimuth and altitude at any time and location
  • Subsolar point (where sun is directly overhead)
  • Relative bearing from aircraft heading to sun position

Great Circle Path

  • Implements great circle interpolation for accurate flight paths
  • Accounts for Earth's curvature in route calculations
  • Provides smooth geodesic visualization

Side Classification

  • Determines if scenic features are visible on left or right side of aircraft
  • Uses cross-product mathematics for precise spatial classification

πŸ“‚ Project Structure

FlightBooking-clean/
β”œβ”€β”€ client/                    # React frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/        # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ pages/            # Main application pages
β”‚   β”‚   β”œβ”€β”€ utils/            # Helper functions & calculations
β”‚   β”‚   └── api/              # API configuration
β”‚   └── package.json
β”œβ”€β”€ server/                   # Node.js backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ controllers/      # Request handlers
β”‚   β”‚   β”œβ”€β”€ models/           # Database schemas
β”‚   β”‚   β”œβ”€β”€ routes/           # API route definitions
β”‚   β”‚   β”œβ”€β”€ services/         # Business logic
β”‚   β”‚   β”œβ”€β”€ utils/            # Helper utilities
β”‚   β”‚   └── config/           # Database & app configuration
β”‚   └── package.json
└── instructions/             # Documentation

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ™ Acknowledgments

  • OpenStreetMap community for geographical data
  • Leaflet for excellent mapping library
  • Overpass API for efficient geographical queries
  • Nominatim for city geocoding services

Built with ❀️ for travelers who love scenic flights βœˆοΈπŸŒ…

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors