Skip to content

A full-stack vacation rental platform where users can browse, list, and review properties - similar to Airbnb. Built with Node.js, Express, and MongoDB.

Notifications You must be signed in to change notification settings

prathampmp23/Wanderlust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

32 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌍 WanderLust

A full-stack vacation rental platform where users can browse, list, and review properties - similar to Airbnb. Built with Node.js, Express, and MongoDB.

Node.js Express MongoDB License

πŸš€ Features

  • 🏠 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

πŸ› οΈ Tech Stack

Backend

  • Node.js - Runtime environment
  • Express.js - Web application framework
  • MongoDB Atlas - Cloud database
  • Mongoose - MongoDB object modeling

Authentication

  • Passport.js - Authentication middleware
  • Passport-Local - Local authentication strategy
  • Passport-Local-Mongoose - Mongoose plugin for user authentication

Storage & APIs

  • Cloudinary - Image hosting and management
  • Mapbox SDK - Maps and location services
  • Multer - File upload handling

Templating & Session

  • EJS - Embedded JavaScript templating
  • EJS-Mate - Layout support for EJS
  • Express-Session - Session management
  • Connect-Mongo - MongoDB session store
  • Connect-Flash - Flash messages

Validation & Utilities

  • Joi - Schema validation
  • Method-Override - HTTP verb support (PUT, DELETE)
  • Dotenv - Environment variable management

πŸ“ Project Structure

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

πŸ—οΈ Architecture

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

πŸ”§ Installation & Setup

Prerequisites

  • Node.js (v20 or higher)
  • MongoDB Atlas account
  • Cloudinary account
  • Mapbox account

Environment Variables

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

Installation Steps

  1. Clone the repository

    git clone https://github.com/prathampmp23/Wanderlust
    cd WanderLust
  2. Install dependencies

    npm install
  3. Set up environment variables

    • Create .env file with required variables
  4. Initialize database (optional)

    node init/index.js
  5. Run the application

    For development:

    npm run dev

    For production:

    npm start
  6. Access the application

    http://localhost:8080
    

🎯 How It Works

User Flow

  1. Registration/Login: Users create an account or log in
  2. Browse Listings: View all properties with filters by category
  3. View Details: Click on a listing to see full details, location on map, and reviews
  4. Create Listing: Authenticated users can add new properties with images
  5. Leave Reviews: Users can rate and review properties
  6. Manage Listings: Owners can edit or delete their own listings
  7. Manage Reviews: Users can delete their own reviews

Key Features Implementation

Authentication Flow

  • Uses Passport.js with local strategy
  • Passwords hashed using passport-local-mongoose
  • Session-based authentication with MongoDB store

Image Upload

  • Multer handles multipart/form-data
  • Images stored in Cloudinary cloud storage
  • Automatic format validation (png, jpg, jpeg)

Map Integration

  • Mapbox SDK for geocoding addresses
  • Interactive maps on listing detail pages
  • Location markers for each property

Authorization

  • Custom middleware checks ownership
  • Users can only edit/delete their own listings/reviews
  • Logged-in requirement for certain routes

Validation

  • Client-side: HTML5 form validation
  • Server-side: Joi schema validation
  • Error handling with custom ExpressError class

πŸš€ Deployment

The project is configured for deployment on Vercel:

  • vercel.json contains deployment configuration
  • Environment variables must be set in Vercel dashboard
  • MongoDB Atlas provides cloud database
  • Cloudinary hosts images

πŸ“¦ Available Scripts

  • npm start - Run production server
  • npm run dev - Run development server with nodemon
  • npm test - Run tests (not configured yet)

πŸ”’ Security Features

  • Password hashing with salt
  • Session secret protection
  • CSRF protection via Express session
  • Input validation and sanitization
  • Secure HTTP headers
  • MongoDB injection prevention

🎨 Categories Available

  • Trending
  • Rooms
  • Cities
  • Beach
  • Cabins
  • Castles
  • Mountain
  • View
  • Pool
  • Farm
  • Arctic
  • Golfing
  • Boat

πŸ“„ License

This project is licensed under the ISC License.

🀝 Contributing

Contributions, issues, and feature requests are welcome!


Made with ❀️ by Pratham Potdar

About

A full-stack vacation rental platform where users can browse, list, and review properties - similar to Airbnb. Built with Node.js, Express, and MongoDB.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published