Skip to content

ujjawalsingh30/CarRental

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

34 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš— Car Rental Website (MERN Stack)

Car Rental Homepage Screenshot

A full-stack *Car Rental Web Application built using the MERN Stack (MongoDB, Express.js, React.js, Node.js). This platform allows users to browse cars, book rentals, and manage bookings, while the admin can manage cars and reservations.

🌐 Live Website: https://car-rental-gamma-lime.vercel.app/

πŸ“¦ Repository: https://github.com/ujjawalsingh30/CarRental


✨ Features

πŸ‘€ User Features

  • User Registration & Login
  • JWT Authentication with Cookies
  • Browse available cars
  • View booking history
  • Contact support
  • Responsive UI with Toast Notifications

πŸ› Product Management

  • Product Listing
  • Product Images Upload
  • Cloudinary Media Storage
  • Stock & Price Handling

πŸ” Security & Payments

  • Password Hashing with bcrypt
  • JWT-based Authentication
  • Secure Cookie Handling
  • Stripe Checkout Integration

GreenCart is built as a real-world e-commerce system, not a UI-only demo.


πŸ›  Tech Stack

🌐 Frontend

React Tailwind CSS Axios React Router React Hot Toast


πŸ–₯ Backend

Node.js Express MongoDB Mongoose JWT


πŸ”Œ Utilities & Services

Multer bcrypt dotenv CORS


πŸ“ Project Structure


carrental/
β”‚
β”œβ”€β”€ client/                     # Frontend (React + Vite)
β”‚   β”œβ”€β”€ node_modules/           # Project dependencies
β”‚   β”œβ”€β”€ public/                 # Static files
β”‚   β”‚
β”‚   β”œβ”€β”€ src/                    # Main source folder
β”‚   β”‚   β”œβ”€β”€ assets/             # Images, icons, and static assets
β”‚   β”‚   β”œβ”€β”€ components/         # Reusable React components
β”‚   β”‚   β”œβ”€β”€ context/            # Global state management (React Context)
β”‚   β”‚   β”œβ”€β”€ pages/              # Application pages
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ App.jsx             # Main App component
β”‚   β”‚   β”œβ”€β”€ main.jsx            # React entry point
β”‚   β”‚   └── index.css           # Global styles
β”‚   β”‚
β”‚   β”œβ”€β”€ .env                    # Frontend environment variables
β”‚   β”œβ”€β”€ .gitignore              # Git ignored files
β”‚   β”œβ”€β”€ eslint.config.js        # ESLint configuration
β”‚   β”œβ”€β”€ index.html              # Root HTML file
β”‚   β”œβ”€β”€ package.json            # Frontend dependencies
β”‚   β”œβ”€β”€ README.md               # Frontend documentation
β”‚   β”œβ”€β”€ vercel.json             # Vercel deployment config
β”‚   └── vite.config.js          # Vite configuration
β”‚
β”œβ”€β”€ server/                     # Backend (Node.js + Express)
β”‚   β”œβ”€β”€ configs/                # Database and external service configurations
β”‚   β”œβ”€β”€ controllers/            # Business logic for APIs
β”‚   β”œβ”€β”€ middleware/             # Authentication and custom middleware
β”‚   β”œβ”€β”€ models/                 # MongoDB schemas (Mongoose)
β”‚   β”œβ”€β”€ routes/                 # API route definitions
β”‚   β”œβ”€β”€ node_modules/           # Backend dependencies
β”‚   β”‚
β”‚   β”œβ”€β”€ .env                    # Backend environment variables
β”‚   β”œβ”€β”€ .gitignore              # Git ignored files
β”‚   β”œβ”€β”€ package.json            # Backend dependencies
β”‚   β”œβ”€β”€ package-lock.json       # Dependency lock file
β”‚   └── server.js               # Main backend entry point
β”‚
└── README.md                   # Project documentation


🧠 How Car Rantel Works

πŸ” Authentication

  • Passwords hashed using bcrypt
  • JWT tokens stored in HTTP-only cookies
  • Protected routes using middleware

Cars Data

  • Product data stored in MongoDB
  • Images uploaded using Multer
  • Media hosted on ImageKit

πŸ‘€ User APIs

These APIs handle user registration, login, and user-related operations.

Method Endpoint Description
POST /api/user/register Register a new user
POST /api/user/login Login user
GET /api/user/profile Get logged-in user profile

πŸš— Owner APIs

These APIs allow car owners/admins to manage cars in the system.

Method Endpoint Description
POST /api/owner/add-car Add a new car
GET /api/owner/cars Get all cars added by owner
PUT /api/owner/update-car/:id Update car details
DELETE /api/owner/delete-car/:id Delete a car

βš™οΈ Environment Variables

Create a .env file inside server/:


##################################
# Database
##################################
MONGO_URI=your_mongodb_connection_string

##################################
# Authentication
##################################
JWT_SECRET=your_jwt_secret

##################################
# ImageKit
##################################
IMAGEKIT_PUBLIC_KEY = your_imagekit_public_key
IMAGEKIT_PRIVATE_KEY = your_imagekit_private_key
IMAGEKIT_URL_ENDPOINT = your_imagekit_url_endpoint
##################################


⚠️ Never commit .env files to GitHub.


πŸš€ Getting Started

Backend

cd server
npm install
npm run server 

Frontend

cd client
npm install
npm run dev

πŸ“ˆ Future Improvements

  • Admin Dashboard
  • Add new cars
  • Update car details -Delete cars
  • View all bookings
  • Manage cars
  • Role-based Access (Admin / User)

Project Screenshots

πŸ—‚ Cars

This page displays all available cars for rent in a card-based layout. Each card shows important details such as

  • Car brand and model
  • Rental price per day
  • Seating capacity
  • Transmission type
  • Fuel type
  • Location

Car Rental Homepage Screenshot

πŸ›’ My-Booking

The My Bookings page allows users to track all their reservations. It shows:

  • Booking ID
  • Rental period
  • Pickup location
  • Booking status (Pending / Confirmed / Cancelled)
  • Total price This helps users easily manage and review their bookings.

Car Rental Homepage Screenshot

πŸ› Admin-Dashboard

The Admin Dashboard provides an overview of the platform's activity including:

  • Total number of cars
  • Total bookings
  • Pending requests
  • Confirmed bookings
  • Recent booking activities
  • Monthly revenue It helps administrators monitor platform performance efficiently.

Car Rental Homepage Screenshot

βž• Add New Car

Admins can add new vehicles to the platform by filling in detailed information such as:

  • Brand and model
  • Year of manufacture
  • Daily rental price
  • Transmission type
  • Fuel type
  • Seating capacity
  • Location
  • Vehicle description
  • Car image upload This ensures that all necessary vehicle details are available for customers.

Car Rental Homepage Screenshot

πŸ“‹ Manage Bookings

The Manage Bookings section allows administrators to control all customer reservations. Admins can:

  • View all booking records
  • Check payment status
  • Approve or cancel bookings
  • Update booking status This functionality ensures smooth booking management for the platform.

Car Rental Homepage Screenshot


🏁 Conclusion

CarRental is a production-style vehicle booking platform built with the MERN stack, featuring user authentication, car management, booking functionality, and secure backend APIs.

About

A full-stack Car Rental Web Application built using the MERN Stack (MongoDB, Express.js, React.js, Node.js). This platform allows users to browse cars, book rentals, and manage bookings, while the admin can manage cars and reservations.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages