A full-stack web application for property listings and reviews, built with Node.js, Express, MongoDB, and EJS. Users can browse accommodations, create listings, leave reviews, and manage their bookings in a secure, user-friendly environment.
- Secure Registration & Login - Powered by Passport.js with local strategy
- Password Hashing - Secure password storage using passport-local-mongoose
- Session Management - Persistent login sessions with express-session
- Role-based Access Control - Users can only edit/delete their own listings and reviews
- Browse Listings - View all available properties with images and details
- Create Listings - Property owners can add new accommodations
- Edit/Update - Modify listing details, images, and pricing
- Delete Listings - Remove properties with automatic review cleanup
- Image Uploads - Cloudinary integration for high-quality image storage
- Star Ratings - 1-5 star rating system with visual feedback
- Written Reviews - Detailed comments and experiences
- Review Management - Authors can edit/delete their own reviews
- Average Ratings - Calculated ratings displayed for each listing
- Responsive Design - Mobile-friendly Bootstrap interface
- Flash Messages - Success and error notifications
- Form Validation - Client and server-side input validation using Joi
- Error Handling - Comprehensive error pages and graceful fallbacks
- Node.js - Runtime environment
- Express.js - Web application framework
- MongoDB - NoSQL database with Mongoose ODM
- Passport.js - Authentication middleware
- Cloudinary - Image storage and optimization
- Multer - File upload handling
- EJS - Templating engine with EJS Mate for layouts
- Bootstrap - CSS framework for responsive design
- Starability.js - Interactive star rating component
- Joi - Schema validation
- Method Override - HTTP verb support
- Connect Flash - Flash message middleware
- dotenv - Environment variable management
Roomsy/
├── src/
│ ├── controllers/ # Business logic layer
│ │ ├── listing.controller.js
│ │ ├── review.controller.js
│ │ └── user.controller.js
│ ├── routes/ # API routes
│ │ ├── listing.routes.js
│ │ ├── review.routes.js
│ │ └── user.routes.js
│ ├── middleware/ # Custom middleware
│ │ ├── middleware.js # Auth & authorization
│ │ └── validation.js # Input validation
│ ├── utils/ # Utility functions
│ ├── config/ # Configuration files
│ ├── app.js # Express app setup
│ └── server.js # Server entry point
├── models/ # MongoDB schemas
│ ├── listing.js
│ ├── review.js
│ └── user.js
├── views/ # EJS templates
│ ├── layouts/
│ ├── listings/
│ ├── users/
│ └── components/
├── public/ # Static assets
│ ├── css/
│ └── javascript/
└── init/ # Database initialization
- Node.js (v14 or higher)
- MongoDB (local or Atlas)
- Cloudinary account (for image uploads)
git clone https://github.com/yourusername/roomsy.git
cd roomsynpm installCreate a .env file in the root directory:
# Database
MONGO_URI=your_mongodb_connection_string
# Session Secret
SESSION_SECRET=your_super_secret_session_key
# Cloudinary Configuration
CLOUD_NAME=your_cloudinary_cloud_name
CLOUD_API_KEY=your_cloudinary_api_key
CLOUD_API_SECRET=your_cloudinary_api_secret
# Environment
NODE_ENV=developmentnode init/index.js# Development mode
npm run dev
# Production mode
npm startVisit http://localhost:3000 to access the application.
GET /signup- Registration formPOST /signup- Create new userGET /login- Login formPOST /login- Authenticate userGET /logout- Logout user
GET /- View all listingsGET /new- New listing form (auth required)POST /- Create listing (auth required)GET /:id- View single listingGET /:id/edit- Edit form (owner only)PATCH /:id- Update listing (owner only)DELETE /:id- Delete listing (owner only)
POST /- Create review (auth required)DELETE /:reviewId- Delete review (author only)
- Input Validation - Joi schemas prevent malicious data
- XSS Protection - Input sanitization and output encoding
- Authentication - Secure login system with session management
- Authorization - Resource-level access control
- CSRF Protection - Method override for secure form submissions
- Secure Headers - Production-ready security configurations
- Booking System - Calendar integration and reservation management
- Payment Integration - Stripe/PayPal payment processing
- Map Integration - Interactive maps for property locations
- Advanced Search - Filter by price, location, amenities
- Messaging System - Direct communication between users
- Mobile App - React Native companion app
- Admin Dashboard - Administrative control panel
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Express.js - Web framework
- MongoDB - Database
- Cloudinary - Image management
- Bootstrap - CSS framework
- Passport.js - Authentication
⭐ Star this repository if you found it helpful!