Plane Scape is a web application designed for users to search, filter, and book flights easily, offering a seamless travel planning experience.
- π« User Registration & Login: Users can create accounts and log in to access personalized features. for each transaction.
βοΈ Flight Browsing: Browse through available flights with detailed information.- π Advanced Filtering: Filter flights by airport, date, time, layovers, and direction (one-way or round-trip).
- ποΈ Reservation Management: Users can reserve flights, with bookings listed on their flights page.
- πΌοΈ Responsive Design: Adaptable interface that works on different screen sizes.
- π« Animation on No Results: Engaging animations display when no flights match the selected filters.
- π Notification Messages: Error and success notifications are displayed throughout the application for user actions such as registration, login, filtering and reservation.
- π¦ Vite - Module bundler
- π» React.js - JS library for crafting user interfaces
- π¨ Tailwind CSS - A utility-first CSS framework
- βοΈ Material-UI (MUI) - React components for faster and easier web development.
- πΌοΈ React Icons - A library of popular icons for React applications
- π¬ Notistack - Notification library for React
- π Axios - Promise-based HTTP client for making API requests.
- π€οΈ React Router - Declarative routing for React applications.
- π Express.js - Web framework for Node.js
- π Cors - Mechanism for integrating applications
- βοΈ Dotenv - A zero-dependency module that loads environment variables from a .env file into process.env
- π Bcrypt - A library to help you hash passwords.
- π Multer - A middleware for handling multipart/form-data in Node.js, primarily used for uploading files.
- πΎ Google Cloud Storage: - For interacting with Google Cloud Storage.
- π§ Body-parser - Middleware for parsing the body of HTTP requests.
- πͺ Cookie-parser - For handling cookies.
- π Jsonwebtoken - For creating and verifying JSON Web Tokens.
- π¨βπ» Nodemon - Automatically restarts the application when file changes are detected.
- π’οΈ Prisma - Prisma ORM is an open-source next-generation ORM
- βοΈ MongoDB Atlas Cloud Database - Cloud-based NoSQL database for storing and managing data.
- βοΈ Google Cloud Console - Platform for managing Google Cloud services, including Cloud Firestore and Google Cloud Storage.
Prerequisites
- Install Node.js βοΈ
- Clone the repo π
π¦ After cloning the repo install dependecies with
- Open up two terminal instances and run scripts below in directories
/server
and/client
- Server π
npm i && npm run dev
- Client π±
npm i && npm run dev
after running scripts go to http://localhost:5173
with your browser to use the app. π
To list flights from Schiphol Airport, you need to use the Flight V4 API. Follow these steps:
-
Create an Account:
- Sign up for a free account at Schiphol Developer Portal.
-
Obtain Credentials:π
- After creating an account, retrieve your Application ID and Application Key for the Flight V4 API.
-
API Endpoint:
- Use the endpoint for fetching flights. No additional external processes are required.
You will use these credentials in your application to make API requests.
-
Cloning the Project: π
- Once you've cloned the project, you'll need to create a
.env
file. - I've included an .env.example file with detailed instructions on which environment variables the project requires and how to set them up.
- Once you've cloned the project, you'll need to create a
-
Creating the .env File: π
- Start by copying the
.env.example
file and creating a new file named.env
. - Make sure to fill in the contents of the
.env
file.
- Start by copying the
-
Defining Environment Variables: π§
-
In the
.env
file, define the following variables for your API calls:# API credentials APPLICATION_ID=your_application_id API_KEY=your_api_key # Base URL for the API BASE_URL=https://api.yourservice.com/v1/flights
-
Or you can use json web token and db
# API credentials ACCESS_SECRET_TOKEN=your_access_token REFRESH_SECRET_TOKEN=your_refresh_token DATABASE_URL=your_db_url
This section outlines the steps to store user-uploaded photos in a Google Cloud Storage bucket within your application.
- Go to the Google Cloud Console.
- Create a new project or select an existing one.
- Navigate to APIs & Services > Library.
- Search for Cloud Storage and enable the API.
- Go to Cloud Storage > Buckets.
- Click on Create Bucket.
- Choose a globally unique name and select the desired location and storage class.
- Under Permissions, set the necessary roles for your application to access the bucket (e.g.,
Storage Object Admin
). - If using service accounts, create one and download the JSON key.
-
In your Node.js project, run:
npm install @google-cloud/storage
-
Set the environment variable for Google credentials:
export GOOGLE_APPLICATION_CREDENTIALS="path/to/your/service-account-file.json"
- Use Multer to handle file uploads in your Express app:
import multer = from 'multer';
import { Storage } from "@google-cloud/storage";
const storage = new Storage();
const bucket = storage.bucket('your-bucket-name');
const upload = multer({ storage: multer.memoryStorage() });
app.post('/upload', upload.single('photo'), (req, res) => {
const blobStream = bucket.file(req.file.originalname).createWriteStream({ resumable: false });
blobStream
.on('error', (err) => res.status(500).send(err))
.on('finish', () => res.status(200).send('File uploaded successfully.'))
.end(req.file.buffer);
});
- Files can be accessed via their public URLs if set, or programmatically through the Google Cloud Storage client.
-
User Registration and Login π: To use the application, you need to create an account first. After registering, you can log in to access personalized features.
-
Flight Search
βοΈ : From the homepage, you can search for available flights and view detailed information. You can filter search results by airport, date, time, and number of layovers. -
Reservation Management ποΈ: After making a flight reservation, you can view your bookings on the "My Flights" page.
-
Responsive Design π±: The application adapts to different screen sizes, providing a seamless experience on mobile devices.
-
Notifications π: You will receive error and success notifications for actions such as registration, login, filtering, and reservation.