A full-stack car rental web application built with React, Node.js, Express, and MongoDB. Users can browse, search, and book luxury cars, while car owners can list and manage their vehicles...
- π Browse Cars - View all available luxury cars with detailed information
- π Search by Date & Location - Find cars available for specific dates and pickup locations
- π Car Details - View comprehensive car information including features, specifications, and pricing
- π Easy Booking - Simple booking process with date selection
- π My Bookings - Track all your car rentals and booking status
- π Dashboard - Overview of your car listings and bookings
- β Add Cars - List your luxury cars for rent with images and details
- π Manage Cars - Edit, toggle availability, or remove car listings
- π Manage Bookings - Approve, confirm, or cancel booking requests
- π User Authentication - Secure login and registration system
- π¨ Responsive Design - Beautiful UI that works on all devices
- β‘ Smooth Animations - Enhanced UX with Framer Motion animations
- π Toast Notifications - Real-time feedback for user actions
- React 18 - UI library
- React Router DOM - Client-side routing
- Tailwind CSS - Utility-first styling
- Framer Motion - Animations
- Axios - HTTP client
- React Hot Toast - Notifications
- Vite - Build tool
- Node.js - Runtime environment
- Express.js - Web framework
- MongoDB - Database
- Mongoose - ODM
- JWT - Authentication
- ImageKit - Image storage and optimization
- Multer - File uploads
Car Rental/
βββ client/ # Frontend React application
β βββ public/ # Static assets
β βββ src/
β β βββ assets/ # Images and static data
β β βββ components/ # Reusable UI components
β β β βββ owner/ # Owner-specific components
β β βββ context/ # React Context (AppContext)
β β βββ pages/ # Page components
β β βββ owner/ # Owner dashboard pages
β βββ index.html
β βββ package.json
β βββ vite.config.js
β
βββ server/ # Backend Node.js application
βββ configs/ # Database and ImageKit config
βββ controllers/ # Route handlers
βββ middleware/ # Auth and file upload middleware
βββ models/ # Mongoose schemas
βββ routes/ # API routes
βββ uploads/ # Temporary file uploads
βββ package.json
βββ server.js # Entry point
- Node.js (v18 or higher)
- MongoDB (local or Atlas)
- ImageKit account (for image uploads)
VITE_BASE_URL=http://localhost:5000
VITE_CURRENCY=βΉPORT=5000
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key
IMAGEKIT_PUBLIC_KEY=your_imagekit_public_key
IMAGEKIT_PRIVATE_KEY=your_imagekit_private_key
IMAGEKIT_URL_ENDPOINT=your_imagekit_url_endpoint-
Clone the repository
git clone https://github.com/mdashad0/car-rental.git cd car-rental -
Install server dependencies
cd server npm install -
Install client dependencies
cd ../client npm install -
Set up environment variables
- Create
.envfiles in bothclientandserverdirectories - Add the required environment variables as shown above
- Create
-
Start the development servers
In the server directory:
npm run server
In the client directory:
npm run dev
-
Open your browser
- Frontend: http://localhost:5173
- Backend API: http://localhost:5000
| Method | Endpoint | Description |
|---|---|---|
| POST | /register |
Register new user |
| POST | /login |
User login |
| GET | /data |
Get user data |
| GET | /cars |
Get all available cars |
| Method | Endpoint | Description |
|---|---|---|
| POST | /change-role |
Upgrade to owner role |
| POST | /add-car |
Add new car listing |
| GET | /cars |
Get owner's cars |
| POST | /toggle-availability |
Toggle car availability |
| DELETE | /delete-car |
Delete car listing |
| POST | /update-image |
Update profile image |
| Method | Endpoint | Description |
|---|---|---|
| POST | /check-availability |
Check car availability |
| POST | /create |
Create new booking |
| GET | /user |
Get user's bookings |
| GET | /owner |
Get owner's bookings |
| POST | /change-status |
Update booking status |
- Users register/login with email and password
- JWT tokens are stored in localStorage
- Protected routes require valid tokens
- Owners can upgrade their role to list cars
- Users select pickup and return dates
- System checks car availability for the date range
- Price is calculated based on daily rate Γ number of days
- Owners can confirm or cancel bookings
- Car images are uploaded via ImageKit
- Optimized delivery with automatic transformations
- Owner profile images supported
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
MD ASHAD
- GitHub: @mdashad0
β Star this repository if you found it helpful!






