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!