A full-stack web application for listing and exploring rental properties around the world. Built with Node.js, Express, MongoDB, and EJS templating.
- Features
- Tech Stack
- Prerequisites
- Installation
- Environment Variables
- Running the Application
- Database Setup
- Deployment
- Project Structure
- API Routes
- Contributing
- License
- 🏡 Browse Listings - View a collection of rental properties from around the world
- ➕ Create Listings - Add new properties with details, images, and pricing
- ✏️ Edit Listings - Update existing property information
- 🗑️ Delete Listings - Remove unwanted listings
- 📝 Detailed Views - See comprehensive information about each property
- 🌍 Location-based - Properties organized by location and country
- 💰 Price Display - Clear pricing information in local currency
- 📱 Responsive Design - Works seamlessly on desktop and mobile devices
- ✅ Form Validation - Client and server-side validation using Joi
Frontend:
- EJS (Embedded JavaScript Templates)
- Bootstrap 4
- Font Awesome Icons
- Custom CSS
Backend:
- Node.js
- Express.js
- MongoDB with Mongoose ODM
- Method Override (for PUT and DELETE requests)
Additional Tools:
- dotenv (Environment variable management)
- Joi (Schema validation)
- EJS Mate (Layout support for EJS)
Before you begin, ensure you have the following installed:
- Node.js (v14 or higher)
- MongoDB Atlas Account or local MongoDB
- Git
- Clone the repository
git clone https://github.com/A2rjav/Wanderlust.git
cd Wanderlust- Install dependencies
npm install- Create environment file
Create a .env file in the root directory:
touch .envAdd the following environment variables to your .env file:
NODE_ENV=development
MONGODB_URL=your_mongodb_connection_string_here
PORT=3000- Go to MongoDB Atlas
- Create a cluster (free tier available)
- Click "Connect" → "Connect your application"
- Copy the connection string
- Replace
<password>with your database user password - Replace
<dbname>withwanderlust
Example:
mongodb+srv://username:password@cluster0.xxxxx.mongodb.net/wanderlust?retryWrites=true&w=majority
npm run devnpm startThe application will be available at http://localhost:3000
To populate your database with sample listings:
node init/index.jsThis will:
- Connect to your MongoDB database
- Clear existing data
- Insert 29 sample property listings
If using MongoDB Atlas, ensure you:
- Go to Network Access in Atlas
- Add IP Address → Allow Access from Anywhere (0.0.0.0/0)
- This allows your application to connect from any location
This project is configured for deployment on Vercel.
- Install Vercel CLI
npm install -g vercel- Login to Vercel
vercel login- Deploy
vercel --prod- Add Environment Variables
In Vercel Dashboard:
- Go to your project → Settings → Environment Variables
- Add
MONGODB_URL,NODE_ENV, andPORT - Redeploy the application
- Push your code to GitHub
- Import repository in Vercel Dashboard
- Add environment variables
- Deploy automatically on every push
Wanderlust/
├── init/
│ ├── data.js # Sample listing data
│ └── index.js # Database initialization script
├── models/
│ ├── listing.js # Listing model schema
│ └── review.js # Review model schema
├── public/
│ ├── css/
│ │ └── style.css # Custom styles
│ └── js/
│ └── script.js # Client-side JavaScript
├── services/
│ └── aiService.js # AI service integration
├── utils/
│ ├── ExpressError.js # Custom error handler
│ └── wrapasync.js # Async error wrapper
├── views/
│ ├── includes/
│ │ ├── footer.ejs # Footer partial
│ │ └── navbar.ejs # Navigation bar partial
│ ├── layouts/
│ │ └── boilerplate.ejs # Main layout template
│ └── listings/
│ ├── edit.ejs # Edit listing page
│ ├── error.ejs # Error page
│ ├── index.ejs # All listings page
│ ├── new.ejs # Create new listing page
│ └── show.ejs # Single listing detail page
├── .env # Environment variables (not in repo)
├── .gitignore # Git ignore rules
├── app.js # Main application file
├── package.json # Dependencies and scripts
├── schema.js # Joi validation schemas
└── vercel.json # Vercel deployment config
| Method | Route | Description |
|---|---|---|
| GET | / |
Redirect to listings page |
| GET | /listings |
Display all listings |
| GET | /listings/new |
Show form to create new listing |
| POST | /listings |
Create a new listing |
| GET | /listing/:id |
Show single listing details |
| GET | /listings/:id/edit |
Show form to edit listing |
| PUT | /listings/:id |
Update a listing |
| DELETE | /listings/:id |
Delete a listing |
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature/YourFeature) - Commit your changes (
git commit -m 'Add some feature') - Push to the branch (
git push origin feature/YourFeature) - Open a Pull Request
This project is open source and available under the MIT License.
Aarjav
- GitHub: @A2rjav
- Project Link: Wanderlust
- Sample images from Unsplash
- Icons from Font Awesome
- UI framework by Bootstrap
⭐ If you found this project helpful, please give it a star!