A modern rental marketplace platform built with React and MongoDB, featuring subscription-based product rentals with support for three user personas: Renter, User, and Admin.
- 🎨 Dark/Light Theme Toggle - Seamless theme switching
- 👥 Multi-Persona Support - Renter, User, and Admin views
- 📦 Product Listings - MongoDB-backed product catalog
- 💳 Subscription Management - Monthly subscription plans
- 🔄 Real-time Data - Fetch products from MongoDB API
- React 18
- Vite
- Lucide React (Icons)
- Custom CSS with CSS Variables
- Node.js
- Express.js
- MongoDB with Mongoose
- RESTful API
- Node.js (v18 or higher)
- MongoDB (local or MongoDB Atlas)
-
Clone and install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env
Edit
.envand add your MongoDB connection string:MONGODB_URI=mongodb://localhost:27017/renter-olx # Or for MongoDB Atlas: # MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/renter-olx PORT=3000 -
Start MongoDB:
- Local MongoDB: Make sure MongoDB is running on your machine
- MongoDB Atlas: Use your connection string in
.env
-
Run the application:
Option 1: Run both frontend and backend together:
npm run dev:all
Option 2: Run separately:
# Terminal 1 - Backend server npm run server # Terminal 2 - Frontend npm run dev
-
Access the application:
- Frontend: http://localhost:5173
- Backend API: http://localhost:3000
- Health Check: http://localhost:3000/api/health
GET /api/products- Get all productsGET /api/products/:id- Get single productPOST /api/products- Create productPUT /api/products/:id- Update productDELETE /api/products/:id- Delete product
GET /api/users- Get all usersGET /api/users/:id- Get single userPOST /api/users- Create userPUT /api/users/:id- Update userDELETE /api/users/:id- Delete user
GET /api/subscriptions- Get all subscriptionsGET /api/subscriptions/:id- Get single subscriptionPOST /api/subscriptions- Create subscriptionPUT /api/subscriptions/:id- Update subscriptionPATCH /api/subscriptions/:id/cancel- Cancel subscription
- name, price, duration, status, category
- features (array), description, images
- renterId (reference to User)
- location, isActive
- name, email, password, role (renter/user/admin)
- phone, address, isVerified, kycStatus
- userId, productId (references)
- planType, monthlyPrice
- startDate, endDate, status
- paymentStatus, nextBillingDate
renter-olx/
├── server/
│ ├── index.js # Express server entry
│ ├── models/ # MongoDB models
│ │ ├── Product.js
│ │ ├── User.js
│ │ └── Subscription.js
│ └── routes/ # API routes
│ ├── products.js
│ ├── users.js
│ └── subscriptions.js
├── src/
│ ├── App.jsx # Main React component
│ ├── main.jsx # React entry point
│ └── styles.css # Global styles
├── .env # Environment variables
├── package.json
└── vite.config.js
- Frontend runs on port 5173 (Vite dev server)
- Backend runs on port 3000 (Express server)
- Vite proxy configured to forward
/api/*to backend
- Add authentication (JWT)
- Implement user registration/login
- Add product image uploads
- Create subscription checkout flow
- Add admin dashboard
- Implement payment integration
MIT