Skip to content

Welcome to the Car Rental System repository! This project provides a comprehensive solution for managing a car rental service. It offers features for customers to browse, reserve, and manage rentals, and for administrators to manage vehicles, reservations, and payments.

Notifications You must be signed in to change notification settings

TECH-OPSS/car-rental-website-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Car Rental System

Welcome to the Car Rental System repository! This project provides a comprehensive solution for managing a car rental service. It offers features for customers to browse, reserve, and manage rentals, and for administrators to manage vehicles, reservations, and payments. Built using ReactJS and NextJS, this system provides a highly interactive and scalable solution for modern web applications.

Features

Customer:

  • 🚗 Browse available cars: Customers can view available cars with detailed information.
  • 🗓️ Make reservations: Customers can choose their rental dates and book a car.
  • 📝 Manage personal account: Update profile, view rental history, and track bookings.
  • 🔄 Cancel reservations: If needed, customers can cancel their reservations.

Admin:

  • 🛠️ Manage car inventory: Add, update, or remove cars from the rental fleet.
  • 📈 Reservation management: View and manage customer reservations and booking details.
  • 💳 Process payments: Integrated payment gateway for processing payments.
  • 📊 Generate reports: Admin can generate detailed reports for all transactions.

System Architecture

The Car Rental System is built on a ReactJS and NextJS framework, utilizing a modern serverless architecture. The system is divided into distinct layers for clear separation of concerns and better maintainability.

1. Frontend (ReactJS & NextJS)

The frontend is built using ReactJS and NextJS, providing a responsive, fast, and dynamic user experience. It is optimized for both performance and scalability, with server-side rendering (SSR) in NextJS to improve SEO and loading times.

  • ReactJS: Handles the UI and client-side logic, including dynamic car listings, reservation forms, and user authentication.
  • NextJS: Provides SSR for optimized page loading, routing, and SEO benefits. It also offers API routes for handling backend operations.

Frontend Layers:

  • UI Components: Built using ReactJS with reusable components such as car cards, reservation forms, and admin panels.
  • Pages: Each page, like Home, Car Listings, Reservations, etc., is a NextJS page that dynamically renders content.
  • State Management: Utilizes React Context API or Redux to manage global state across the application (e.g., user authentication, reservation status).

2. Backend (Node.js & Express.js)

The backend is powered by Node.js and Express.js, which provides RESTful APIs for handling business logic like reservation processing, car inventory management, and payment handling.

Backend Responsibilities:

  • REST API: Handles requests related to car rental (adding cars, checking availability, etc.), customer reservations, and payment processing.
  • Database Integration: Interacts with the database to fetch, store, and update data related to users, cars, and reservations.

Key Backend Routes:

  • /api/cars: Retrieves all available cars, allows adding new cars, and updating car details.
  • /api/reservations: Handles creating, updating, and deleting reservations.
  • /api/users: User authentication and profile management.
  • /api/payments: Integrates with a payment gateway (e.g., Stripe) to process payments.

3. Database (MySQL / MongoDB)

The database stores essential information about customers, cars, reservations, and transactions. You can choose between MySQL (relational database) or MongoDB (NoSQL database) depending on the complexity of your data model and scalability needs.

Database Schema Example:

  1. Cars Table (MySQL):

    • car_id (Primary Key)
    • model
    • brand
    • price_per_day
    • availability_status
    • image_url
  2. Reservations Table (MySQL):

    • reservation_id (Primary Key)
    • car_id (Foreign Key)
    • user_id (Foreign Key)
    • start_date
    • end_date
    • status
  3. Users Table (MySQL):

    • user_id (Primary Key)
    • name
    • email
    • password_hash
    • address
    • phone_number

Alternative: MongoDB: Use MongoDB if you want a flexible, document-based data structure, especially if your application needs to handle unstructured or semi-structured data.


4. Payment Integration (Stripe)

The Car Rental System integrates with Stripe to handle payment processing. Customers can securely pay for their car rentals through the Stripe payment gateway.

Payment Flow:

  1. Customer selects a car and booking dates.
  2. Stripe payment is processed.
  3. Reservation is confirmed upon successful payment.

5. Authentication and Authorization (JWT)

JSON Web Tokens (JWT) are used for secure authentication and authorization. The user logs in, and a JWT is generated and sent to the client for use in future requests. Admins and customers are authenticated separately based on roles, ensuring the appropriate access controls are applied.


System Design

1. Client-Side Architecture

The frontend is designed to be lightweight, responsive, and fast. It makes use of NextJS's automatic code splitting and server-side rendering (SSR) to optimize page load times. The application’s core logic is divided into reusable React components.

  • Home Page: Displays available cars, rental details, and CTA buttons for customers to browse or make reservations.
  • Car Listings Page: Shows all cars with details and filters to search by category, price, or availability.
  • Reservation Page: Allows customers to enter their details, pick up and drop off dates, and finalize their booking.
  • Admin Panel: An interface to manage car inventory, view reservations, and manage payments.

2. Backend Architecture

The backend is organized as a RESTful API in Express.js, with clearly defined routes for different resources (cars, reservations, users). It uses JWT for authentication and Stripe for payment processing.

Backend Key Components:

  • Express Routes: Each route handles CRUD operations for different entities (cars, reservations, etc.).
  • Payment Gateway Integration: Stripe is used for secure payment processing.
  • Admin Panel Logic: The admin dashboard provides functionality for adding/removing cars, viewing all reservations, and processing payments.

3. Database Design

The database is designed with normalized tables in MySQL or a flexible schema in MongoDB. Relationships between entities such as users, cars, and reservations are clearly defined to ensure smooth data flow.

  • One-to-many relationship: One user can have multiple reservations.
  • One-to-one relationship: Each reservation corresponds to exactly one car.

Installation

Prerequisites:

  • Node.js (v14 or higher)
  • MySQL or MongoDB (depending on configuration)
  • Stripe API Key (for payment integration)

Setup:

  1. Clone this repository to your local machine:

    git clone https://github.com/yourusername/car-rental-system.git
    cd car-rental-system
  2. Install the necessary dependencies:

    npm install
  3. Configure your MySQL or MongoDB database credentials in the config.js file.

  4. Set up the database:

    • For MySQL: Run the SQL script located in /database/initialize.sql to create the required tables.
    • For MongoDB: Set up collections in MongoDB as per your design.
  5. Set up Stripe API keys in your .env file for payment processing.

  6. Run the application:

    npm run dev
  7. Visit http://localhost:3000 to access the Car Rental System.


Contributing

We welcome contributions to improve the Car Rental System! If you have any suggestions, bug fixes, or enhancements, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your changes.
  3. Commit your changes with a detailed description.
  4. Push your changes and create a pull request.

License

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


We hope this Car Rental System provides a great experience for both customers and admins. Feel free to open issues or contribute enhancements as needed!

About

Welcome to the Car Rental System repository! This project provides a comprehensive solution for managing a car rental service. It offers features for customers to browse, reserve, and manage rentals, and for administrators to manage vehicles, reservations, and payments.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published