OptimalAir is a web application designed to help users find the best flights based on their preferences for cost, duration, and whether the flight is a red-eye. The project is composed of a backend server written in Python and a frontend application built with React and Vite.
- Prerequisites
- Installation
- Running the Backend Server
- Running the Frontend
- Environment Variables
- Scripts
Before you begin, ensure you have the following installed:
- Node.js (version 14 or later)
- npm (version 6 or later)
- Python (version 3.8 or later)
- pip (Python package installer)
-
Clone the repository:
git clone https://github.com/yourusername/optimalair.git cd optimalair
-
Install frontend dependencies:
npm install
-
Install backend dependencies:
cd backend python3 -m venv venv source venv/bin/activate pip install -r requirements.txt
-
Make sure you have your SerpAPI key. You can obtain one by signing up at SerpAPI.
-
Create a
.env
file in thebackend
directory and add your SerpAPI key:SERPAPI_KEY=your_serpapi_key
-
Run the backend server:
cd backend source venv/bin/activate python3 run.py
-
Start the frontend development server:
npm run dev
-
Open your browser and navigate to
http://localhost:5173
.
The backend requires an environment variable for the SerpAPI key. This should be stored in a .env
file located in the backend
directory.
Example .env
file:
SERPAPI_KEY=your_serpapi_key
Happy flying!