A fully functional, productionβready Car Rental Booking Website built using the MERN Stack (MongoDB, Express.js, React.js, Node.js) with ImageKit integration for media storage.
- User Registration & Login (JWTβbased authentication)
- Browse cars with filters
- Select pickup location & date
- View car details
- Make a booking
- View "My Bookings" page
- Secure Admin Login
- Add new cars
- Manage all bookings
- Manage car inventory including images
- Image upload handled via ImageKit
- Auto optimization, fast delivery
- Frontend deployed (e.g., on Vercel or Netlify)
- Backend deployed (e.g., on Render or Railway)
- Connected to MongoDB Atlas
- React.js
- React Router
- Axios
- Context API
- CSS / Tailwind (optional)
- Node.js
- Express.js
- MongoDB & Mongoose
- JWT Authentication
- ImageKit SDK
- Frontend β Vercel / Netlify
- Backend β Render / Railway / VPS
- Database β MongoDB Atlas
- Media β ImageKit
car-rental-app/
β
βββ client/ # React Frontend
β βββ src/
β β βββ components/
β β βββ pages/
β β βββ context/
β β βββ assets/
β β βββ App.js
β β βββ index.js
β βββ package.json
β
βββ server/ # Node Backend
β βββ controllers/
β βββ routes/
β βββ models/
β βββ middleware/
β βββ .env
β βββ index.js
β βββ package.json
β
βββ README.md
Make sure you have:
- Node.js installed
- MongoDB Atlas account
- ImageKit account
https://github.com/pratikdevelops/car-rental-mern.git
cd car-rental-merncd client
npm installcd ../server
npm installCreate a .env file in the server folder and add:
MONGO_URI=your_mongo_atlas_url
JWT_SECRET=your_jwt_secret
IMAGEKIT_PUBLIC_KEY=
IMAGEKIT_PRIVATE_KEY=
IMAGEKIT_URL_ENDPOINT=
cd server
npm startcd client
npm run devYour project will be live at:
- Frontend: http://localhost:5173
- Backend: http://localhost:4000
cd client
npm run buildThis generates a production-ready build inside /dist.
- Connect GitHub repo
- Select the
clientfolder - Build Command β
npm run build - Output Directory β
dist
- Create new web service
- Use
serverfolder - Add environment variables
- Deploy
- Create a new ImageKit project
- Copy API Keys to
.env - Use
.upload()method to upload car images
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register | Register user |
| POST | /api/auth/login | Login user |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/cars | List all cars |
| GET | /api/cars/:id | Get car details |
| POST | /api/cars | Add car (Admin) |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/bookings | Create booking |
| GET | /api/bookings/me | Get user bookings |
- User logs in β Backend generates JWT
- Frontend stores token in localStorage
- Token added in every protected request header
- Admin routes are protected using middleware
- Payment gateway (Razorpay / Stripe)
- Advanced car filters (price, brand, fuel type)
- Reviews & ratings
- Coupon/discount system
- Admin analytics dashboard
- OTP login
This project is open source and free to use.
Feel free to fork the project, raise issues, or suggest improvements!