A full-stack vacation rental platform where users can browse, list, and review properties - similar to Airbnb. Built with Node.js, Express, and MongoDB.
- π Property Listings: Create, read, update, and delete vacation rental listings
- π User Authentication: Secure signup/login with Passport.js
- β Reviews & Ratings: Users can leave reviews and ratings for properties
- πΊοΈ Interactive Maps: Mapbox integration for location visualization
- πΌοΈ Image Upload: Cloud-based image storage with Cloudinary
- π·οΈ Categories: Filter properties by categories (Beach, Mountain, Castles, etc.)
- π± Responsive Design: Mobile-friendly UI
- π Authorization: Owner-only edit/delete permissions
- π¬ Flash Messages: User-friendly notifications
- β Data Validation: Server-side validation with Joi
- Node.js - Runtime environment
- Express.js - Web application framework
- MongoDB Atlas - Cloud database
- Mongoose - MongoDB object modeling
- Passport.js - Authentication middleware
- Passport-Local - Local authentication strategy
- Passport-Local-Mongoose - Mongoose plugin for user authentication
- Cloudinary - Image hosting and management
- Mapbox SDK - Maps and location services
- Multer - File upload handling
- EJS - Embedded JavaScript templating
- EJS-Mate - Layout support for EJS
- Express-Session - Session management
- Connect-Mongo - MongoDB session store
- Connect-Flash - Flash messages
- Joi - Schema validation
- Method-Override - HTTP verb support (PUT, DELETE)
- Dotenv - Environment variable management
WanderLust/
βββ app.js # Main application entry point
βββ package.json # Dependencies and scripts
βββ cloudConfig.js # Cloudinary configuration
βββ middleware.js # Custom middleware functions
βββ schema.js # Joi validation schemas
βββ vercel.json # Vercel deployment config
β
βββ controllers/ # Route controllers (MVC)
β βββ listings.js # Listing CRUD logic
β βββ reviews.js # Review logic
β βββ users.js # User authentication logic
β
βββ models/ # Database models
β βββ listing.js # Listing schema
β βββ review.js # Review schema
β βββ user.js # User schema
β
βββ Router/ # Express routes
β βββ listing.js # Listing routes
β βββ review.js # Review routes
β βββ user.js # User routes
β
βββ views/ # EJS templates
β βββ layouts/ # Layout templates
β βββ listing/ # Listing views
β βββ users/ # Auth views
β βββ includes/ # Reusable components
β
βββ public/ # Static assets
β βββ CSS/ # Stylesheets
β βββ JS/ # Client-side scripts
β βββ images/ # Static images
β
βββ Utils/ # Utility functions
β βββ ExpressError.js # Custom error handler
β βββ wrapAsync.js # Async error wrapper
β
βββ init/ # Database initialization
βββ data.js # Sample data
βββ index.js # Data seeding script
The project follows the MVC (Model-View-Controller) pattern:
- Models: Define data structure using Mongoose schemas
- Views: EJS templates for rendering HTML
- Controllers: Business logic for handling requests
- Routes: Define API endpoints and map to controllers
- Node.js (v20 or higher)
- MongoDB Atlas account
- Cloudinary account
- Mapbox account
Create a .env file in the root directory:
# MongoDB
ATLASDB_URL=your_mongodb_atlas_connection_string
# Cloudinary
CLOUD_NAME=your_cloudinary_cloud_name
CLOUD_API_KEY=your_cloudinary_api_key
CLOUD_API_SECRET=your_cloudinary_api_secret
# Mapbox
MAP_TOKEN=your_mapbox_access_token
# Session Secret
SECRET=your_session_secret_key-
Clone the repository
git clone https://github.com/prathampmp23/Wanderlust cd WanderLust -
Install dependencies
npm install
-
Set up environment variables
- Create
.envfile with required variables
- Create
-
Initialize database (optional)
node init/index.js
-
Run the application
For development:
npm run dev
For production:
npm start
-
Access the application
http://localhost:8080
- Registration/Login: Users create an account or log in
- Browse Listings: View all properties with filters by category
- View Details: Click on a listing to see full details, location on map, and reviews
- Create Listing: Authenticated users can add new properties with images
- Leave Reviews: Users can rate and review properties
- Manage Listings: Owners can edit or delete their own listings
- Manage Reviews: Users can delete their own reviews
- Uses Passport.js with local strategy
- Passwords hashed using passport-local-mongoose
- Session-based authentication with MongoDB store
- Multer handles multipart/form-data
- Images stored in Cloudinary cloud storage
- Automatic format validation (png, jpg, jpeg)
- Mapbox SDK for geocoding addresses
- Interactive maps on listing detail pages
- Location markers for each property
- Custom middleware checks ownership
- Users can only edit/delete their own listings/reviews
- Logged-in requirement for certain routes
- Client-side: HTML5 form validation
- Server-side: Joi schema validation
- Error handling with custom ExpressError class
The project is configured for deployment on Vercel:
vercel.jsoncontains deployment configuration- Environment variables must be set in Vercel dashboard
- MongoDB Atlas provides cloud database
- Cloudinary hosts images
npm start- Run production servernpm run dev- Run development server with nodemonnpm test- Run tests (not configured yet)
- Password hashing with salt
- Session secret protection
- CSRF protection via Express session
- Input validation and sanitization
- Secure HTTP headers
- MongoDB injection prevention
- Trending
- Rooms
- Cities
- Beach
- Cabins
- Castles
- Mountain
- View
- Pool
- Farm
- Arctic
- Golfing
- Boat
This project is licensed under the ISC License.
Contributions, issues, and feature requests are welcome!
Made with β€οΈ by Pratham Potdar