Skip to content

Dumplingisabeast/fake_flight_app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Flight Booking App

Overview

The Flight Booking App is a web application that allows users to search for flights, book tickets, and manage their bookings. The application is built using React for the frontend and FastAPI for the backend, providing a seamless experience for users.

Repository Structure

The project is organized into two main directories: frontend and backend.

flight-booking-app/
├── backend/
│   ├── main.py
│   ├── models.py
│   ├── routes/
│   │   ├── flight_routes.py
│   │   └── user_routes.py
│   ├── test_data.py
│   ├── requirements.txt  # Add this file if needed
│   └── README.md  # Consolidated README for backend
├── frontend/
│   ├── public/
│   │   └── index.html
│   ├── src/
│   │   ├── components/
│   │   │   ├── Header/
│   │   │   │   ├── Header.js
│   │   │   │   └── Header.css
│   │   │   ├── Footer/
│   │   │   │   ├── Footer.js
│   │   │   │   └── Footer.css
│   │   │   ├── FlightSearch/
│   │   │   │   ├── FlightSearch.js
│   │   │   │   └── FlightSearch.css
│   │   │   ├── FlightResults/
│   │   │   │   ├── FlightResults.js
│   │   │   │   └── FlightResults.css
│   │   │   ├── BookingForm/
│   │   │   │   ├── BookingForm.js
│   │   │   │   └── BookingForm.css
│   │   │   └── Confirmation/
│   │   │       ├── Confirmation.js
│   │   │       └── Confirmation.css
│   │   ├── pages/
│   │   │   ├── Home/
│   │   │   │   ├── Home.js
│   │   │   │   └── Home.css
│   │   │   ├── SearchResults/
│   │   │   │   ├── SearchResults.js
│   │   │   │   └── SearchResults.css
│   │   │   ├── Booking/
│   │   │   │   ├── Booking.js
│   │   │   │   └── Booking.css
│   │   │   └── Confirmation/
│   │   │       ├── Confirmation.js
│   │   │       └── Confirmation.css
│   │   ├── hooks/
│   │   │   ├── useFetchFlights.js
│   │   │   ├── useBookingForm.js
│   │   │   └── useAuth.js
│   │   ├── utils/
│   │   │   ├── api.js
│   │   │   ├── helpers.js
│   │   │   └── constants.js
│   │   ├── App.js
│   │   ├── index.js
│   │   └── styles/
│   │       └── global.css
└── README.md  # Main README for the entire project.

Functionalities

Frontend

  • Header Component: Displays the app title and navigation links.
  • Footer Component: Contains copyright information and links.
  • FlightSearch Component: Allows users to input search criteria for flights.
  • FlightResults Component: Displays the list of available flights based on the search criteria.
  • BookingForm Component: Collects user information for booking a flight.
  • Confirmation Component: Shows booking confirmation details.
  • Home Page: The landing page of the app.
  • SearchResults Page: Displays the results of flight searches.
  • Booking Page: Manages the booking process.
  • Confirmation Page: Displays booking confirmation.

Backend

  • main.py: Entry point for the FastAPI backend, initializes the app and includes middleware, CORS settings, and routes.
  • models.py: Defines data models for flights and users using Pydantic for data validation.
  • flight_routes.py: Contains API endpoints for searching flights, retrieving flight details, and booking flights, utilizing fake data from test_data.py.
  • user_routes.py: Contains API endpoints for user registration and login, utilizing fake data from test_data.py.
  • test_data.py: Contains fake test data for flights and users to simulate a database.

Hooks

  • useFetchFlights: Custom hook for fetching flight data from the backend API, managing loading and error states.
  • useBookingForm: Custom hook for managing the state of the booking form, including validation and submission logic.
  • useAuth: Custom hook for handling user authentication, including login and registration logic.

Utilities

  • api.js: Functions for making API calls to the backend, handling requests and responses.
  • helpers.js: Helper functions that can be reused across components, such as formatting dates or validating input.
  • constants.js: Constant values used throughout the application, such as API endpoints or default values.

Getting Started

To get started with the Flight Booking App, follow these steps:

  1. Clone the repository:
    git clone https://github.com/yourusername/flight-booking-app.git
    cd flight-booking-app
  2. Set up the backend:
    • Navigate to the backend directory and install the required dependencies:
      cd backend
      pip install -r requirements.txt
    • Run the FastAPI server:
      uvicorn main:app --reload
  3. Set up the frontend:
    • Navigate to the frontend directory and install the required dependencies:
      cd frontend
      npm install
    • Start the React app:
      npm start
  4. Open your browser and go to http://localhost:3000 to view the app.

Contributing

Contributions are welcome! Please open an issue or submit a pull request if you have suggestions or improvements.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Thanks to the FastAPI and React communities for their amazing frameworks and resources.

About

Building a fake flight-booking app with AI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published