A full-stack MERN application for managing property rentals, bookings, and communications between property owners and guests.
Smart Rent is a modern property rental platform that enables users to list properties, make bookings, manage reservations, and communicate with hosts. The application features real-time messaging, review systems, and a comprehensive admin panel.
- Runtime: Node.js
- Framework: Express.js
- Database: MongoDB with Mongoose ODM
- Authentication: JWT + Passport.js
- File Storage: Cloudinary
- Real-time: Socket.io
- Email: Nodemailer
- Validation: Joi
- Security: Helmet, Express Mongo Sanitize
- Library: React 18
- Routing: React Router v7
- Styling: Tailwind CSS + PostCSS
- Maps: Leaflet
- Icons: React Icons, Heroicons, Lucide React
- HTTP Client: Axios
- Build Tool: Create React App
- Authentication: Secure registration and login with JWT
- Property Listings: Browse and search available properties
- Bookings: Reserve properties with date selection
- Trip Management: Track active bookings and booking history
- Messaging: Real-time messaging with property hosts
- Reviews: Leave and view property reviews
- Wishlist: Save favorite properties
- Profile Management: Update user profile and preferences
- List Properties: Create and manage property listings
- Booking Management: View and manage guest bookings
- Communication: Direct messaging with guests
- Analytics: Track bookings and reviews
- User Management: Manage user accounts
- Property Moderation: Review and manage listings
- Booking Oversight: Monitor all bookings
- Report Handling: Manage user concerns and reports
smart-rent/
├── backend/
│ ├── controllers/ # Business logic for routes
│ ├── middleware/ # Auth, validation, error handling
│ ├── models/ # MongoDB schemas
│ ├── routes/ # API endpoints
│ ├── services/ # Email service
│ ├── app.js # Express configuration
│ ├── server.js # Server entry point
│ ├── schema.js # Mongoose schemas
│ └── package.json
│
├── frontend/
│ ├── public/ # Static files
│ ├── src/
│ │ ├── components/ # Reusable React components
│ │ ├── pages/ # Page components
│ │ ├── contexts/ # React context (Auth, Settings)
│ │ ├── hooks/ # Custom React hooks
│ │ ├── services/ # API services
│ │ ├── utils/ # Utility functions
│ │ ├── config/ # API configuration
│ │ ├── data/ # Static data
│ │ ├── App.js # Main app component
│ │ └── index.js # React entry point
│ ├── build/ # Production build
│ └── package.json
│
├── middleware.js # Global middleware configuration
├── build.js # Build configuration
└── README.md
- Node.js (v14 or higher)
- MongoDB (local or Atlas)
- Cloudinary account (for image uploads)
- SMTP credentials (for email service)
- Navigate to backend directory:
cd backend- Install dependencies:
npm install- Create
.envfile:
PORT=8000
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key
CLOUDINARY_NAME=your_cloudinary_name
CLOUDINARY_KEY=your_cloudinary_key
CLOUDINARY_SECRET=your_cloudinary_secret
EMAIL_USER=[email protected]
EMAIL_PASS=your_email_password
NODE_ENV=development- Start server:
npm run devServer runs on http://localhost:8000
- Navigate to frontend directory:
cd frontend- Install dependencies:
npm install- Start development server:
npm startFrontend runs on http://localhost:3000
npm start- Start production servernpm run dev- Start with nodemon (auto-reload)npm run server- Run server
npm start- Start development servernpm run build- Create production buildnpm run dev- Start with hot reloadnpm test- Run tests
POST /api/auth/register- Register new userPOST /api/auth/login- Login userPOST /api/auth/logout- Logout user
GET /api/properties- Get all propertiesGET /api/properties/:id- Get property detailsPOST /api/properties- Create property (host only)PUT /api/properties/:id- Update propertyDELETE /api/properties/:id- Delete property
GET /api/bookings- Get user bookingsPOST /api/bookings- Create bookingGET /api/bookings/:id- Get booking detailsPUT /api/bookings/:id- Update bookingDELETE /api/bookings/:id- Cancel booking
GET /api/messages- Get conversationsGET /api/messages/:conversationId- Get messages in conversationPOST /api/messages- Send messagePOST /api/messages/create-conversation- Create conversation
GET /api/reviews/:propertyId- Get property reviewsPOST /api/reviews- Create reviewPUT /api/reviews/:id- Update reviewDELETE /api/reviews/:id- Delete review
GET /api/users/:id- Get user profilePUT /api/users/:id- Update user profileGET /api/users/:id/reviews- Get user reviews
Layout- Main layout wrapperNavbar- Navigation barFooter- Footer componentProtectedRoute- Route protection for authenticated usersErrorBoundary- Error handlingPropertyImage- Image display componentStaticMap- Map display
- User - User account and profile data
- Property - Property listings
- Booking - Reservation records
- Review - Property reviews
- Message - Conversation messages
- Conversation - Message threads
- JWT-based authentication
- Password hashing with bcryptjs
- Input validation with Joi
- CORS enabled
- Helmet for HTTP headers
- Mongo sanitization against injection
- Protected routes for authenticated users
- Session management with express-session
PORT # Server port (default: 8000)
MONGODB_URI # MongoDB connection string
JWT_SECRET # JWT secret key
CLOUDINARY_NAME # Cloudinary account name
CLOUDINARY_KEY # Cloudinary API key
CLOUDINARY_SECRET # Cloudinary API secret
EMAIL_USER # Email for sending notifications
EMAIL_PASS # Email password
NODE_ENV # development or productionREACT_APP_API_URL # Backend API URL (default: http://localhost:8000)- Deploy to Heroku, Railway, or Render
- Set environment variables in hosting platform
- Ensure MongoDB Atlas connection string is set
- Build production:
npm run build - Deploy to Netlify, Vercel, or GitHub Pages
- Update API proxy in
package.jsonif needed
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
ISC
- Fork repository
- Create feature branch
- Commit changes
- Push to branch
- Create Pull Request
For issues or questions, please create a GitHub issue or contact the development team.