Airbnb Clone

A full-stack Airbnb-style booking application built with Node.js, Express, EJS, and MongoDB β€” allowing hosts to list homes and guests to browse and reserve them.

Live Demo: airbnb-sooty-eight.vercel.app


Features

  • 🏠 Host dashboard β€” add, edit, and delete home listings
  • πŸ” User authentication (signup/login) with session-based auth
  • πŸ“Έ Image and PDF uploads via Cloudinary (cloud storage)
  • πŸ—ΊοΈ Browse and reserve listed homes
  • πŸ’… Responsive UI styled with Tailwind CSS
  • ☁️ Deployed as a serverless app on Vercel

Tech Stack

Layer Technology
Backend Node.js, Express.js
Templating EJS
Database MongoDB (Mongoose ODM)
Sessions express-session + connect-mongodb-session
File Uploads Multer + Cloudinary
Styling Tailwind CSS
Deployment Vercel (serverless functions)

Project Structure

airbnb/
β”œβ”€β”€ app.js                  # App entry point
β”œβ”€β”€ vercel.json              # Vercel serverless config
β”œβ”€β”€ controllers/             # Route handlers (auth, host, store, errors)
β”œβ”€β”€ models/                  # Mongoose schemas (Home, User)
β”œβ”€β”€ routes/                  # Express routers
β”œβ”€β”€ utils/                   # Helper utilities (path resolution, etc.)
β”œβ”€β”€ views/                   # EJS templates
β”‚   β”œβ”€β”€ auth/
β”‚   β”œβ”€β”€ host/
β”‚   └── store/
β”œβ”€β”€ public/                  # Static assets (CSS, images)
└── package.json

Getting Started (Local Setup)

Prerequisites

  • Node.js (v18+ recommended)
  • A MongoDB Atlas account (or local MongoDB instance)
  • A Cloudinary account (free tier works)

1. Clone the repository

git clone https://github.com/raushandeveloper/airbnb.git
cd airbnb

2. Install dependencies

npm install

3. Configure environment variables

Create a .env file in the project root:

MONGO_URI=your_mongodb_connection_string
SESSION_SECRET=your_session_secret
CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret

4. Run the app locally

npm start

This runs the Express server (via nodemon) alongside the Tailwind CSS watcher. The app will be available at http://localhost:3001.


Deployment (Vercel)

This project is configured for serverless deployment on Vercel:

  • vercel.json routes all requests through app.js and explicitly includes the views/ and public/ folders (required since EJS templates aren't traced by Vercel's default bundler).
  • File uploads (photos and PDFs) are stored on Cloudinary, since Vercel's serverless filesystem is read-only except for the temporary /tmp directory.
  • MongoDB connection is cached across function invocations to avoid reconnecting on every request.

To deploy your own copy:

  1. Push the repo to GitHub
  2. Import the project into Vercel
  3. Add the environment variables listed above under Project Settings β†’ Environment Variables
  4. Deploy πŸš€

Known Limitations

  • Uploaded files rely on Cloudinary; there is no local fallback in production.
  • Session store is MongoDB-backed, so a valid MONGO_URI is required for login to work.

License

ISC

Share this project:

Updates