The Airline Booking System is a web application that allows users to manage flights and passengers. It provides functionalities for creating, retrieving, updating, and deleting (CRUD) operations for both flights and passengers. The application is built using Django for the backend and React for the frontend.
- User registration and login
- Role-based access control (admin and user roles)
- CRUD operations for flights and passengers
- Flight and passenger management through a user-friendly interface
- Responsive design using Bootstrap
- Backend: Django, Django Rest Framework
- Frontend: React, Axios, Bootstrap
- Database: SQLite (default for Django)
-
Clone the repository:
git clone <repository-url> cd airline_booking_system
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install dependencies:
pip install -r requirements.txt
-
Run migrations:
python manage.py makemigrations python manage.py migrate
-
Create a superuser (for accessing the admin panel):
python manage.py createsuperuser
-
Run the Django server:
python manage.py runserver
-
Navigate to the frontend directory:
cd frontend
-
Install frontend dependencies:
npm install
-
Run the React application:
npm start
- Access the application at
http://localhost:3000
for the frontend. - Access the Django admin panel at
http://localhost:8000/admin
to manage flights and passengers. - Use the application to register users, log in, and manage flight and passenger data.
-
Flights:
GET /api/flights/
- List all flightsPOST /api/flights/
- Create a new flightGET /api/flights/{id}/
- Retrieve a flight by IDPUT /api/flights/{id}/
- Update a flight by IDDELETE /api/flights/{id}/
- Delete a flight by ID
-
Passengers:
GET /api/passengers/
- List all passengersPOST /api/passengers/
- Create a new passengerGET /api/passengers/{id}/
- Retrieve a passenger by IDPUT /api/passengers/{id}/
- Update a passenger by IDDELETE /api/passengers/{id}/
- Delete a passenger by ID
Contributions are welcome! Please feel free to submit a pull request or open an issue for any suggestions or improvements.
This project is licensed under the MIT License - see the LICENSE file for details.
This project is a simplified airline booking system built using Django and React. It provides an API for managing flights and passengers and a front-end interface for users to interact with the system.
- Django Backend
- Models for flights and passengers.
- RESTful API endpoints for CRUD operations.
- Filtering and pagination for enhanced user experience.
- React Frontend
- View available flights and passengers.
- Add passengers to specific flights.
- View detailed flight information, including associated passengers.
- Backend: Django, Django Rest Framework
- Frontend: React, Axios, Bootstrap
- Database: SQLite (default for Django)
-
Clone the repository:
git clone <repository-url> cd airline-system
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Configure the database:
- Update
settings.py
to include your database credentials underDATABASES
. - Apply migrations:
python manage.py makemigrations python manage.py migrate
- Update
-
Create a superuser:
python manage.py createsuperuser
-
Run the development server:
python manage.py runserver
-
Navigate to the React project:
cd airline-frontend
-
Install dependencies:
npm install
-
Start the React development server:
npm start
-
Open your browser and go to
http://localhost:3000
.
Represents a flight in the airline system.
- Fields:
flight_number
: Unique identifier for the flight.departure
: Date and time of departure.arrival
: Date and time of arrival.origin
: Origin airport.destination
: Destination airport.capacity
: Total number of seats available on the flight.
Represents a passenger in the system.
- Fields:
first_name
: First name of the passenger.last_name
: Last name of the passenger.email
: Unique email address of the passenger.phone_number
: Contact number of the passenger.flight
: ForeignKey to theFlight
model.
- Converts the
Flight
model instances into JSON format. - Includes all fields of the flight model.
- Converts the
Passenger
model instances into JSON format. - Includes a nested representation of the associated flight.
- Handles CRUD operations for the
Flight
model. - Endpoints:
GET /flights/
: List all flights.GET /flights/<id>/
: Retrieve details of a specific flight.POST /flights/
: Create a new flight.PUT /flights/<id>/
: Update an existing flight.DELETE /flights/<id>/
: Delete a flight.
- Handles CRUD operations for the
Passenger
model. - Endpoints:
GET /passengers/
: List all passengers.GET /passengers/<id>/
: Retrieve details of a specific passenger.POST /passengers/
: Create a new passenger.PUT /passengers/<id>/
: Update an existing passenger.DELETE /passengers/<id>/
: Delete a passenger.
- Additional Features:
- Filter passengers by flight using query parameters (e.g.,
?flight=<flight_id>
).
- Filter passengers by flight using query parameters (e.g.,
-
Django REST Framework
- Used for rapid development of API endpoints.
- Leveraged ViewSets for CRUD operations to minimize boilerplate code.
-
ForeignKey Relationship
- Enforced a
Passenger
to always be associated with aFlight
.
- Enforced a
-
Frontend-Backend Integration
- Used Axios in React for making HTTP requests to the Django API.
-
Filtering and Pagination
- Implemented filtering on passengers to improve usability.
- Added pagination to list views for scalability.
- Seat Availability Check: Prevent booking if the flight is at full capacity.
- User Authentication: Secure APIs and provide role-based access (e.g., admin vs. user).
- Styling: Use a modern UI library (e.g., Material-UI) for an improved user interface.
- Deployment: Deploy the application on platforms like Heroku or AWS.
To run the backend tests:
python manage.py test
This project demonstrates a simplified airline booking system with robust API endpoints and a user-friendly interface. It can be extended with additional features such as payment integration, real-time notifications, and advanced filtering options.
For any questions or issues, feel free to contact the project maintainer.