A Full-Stack Travel Accommodation Platform
Wanderlust is a feature-rich web application inspired by Airbnb, built with Node.js and Express.js. It allows users to explore, create, and review travel accommodations worldwide, complete with interactive maps, image uploads, and secure user authentication.
- Listing Management: Create, read, update, and delete travel accommodation listings
- Review System: Users can leave reviews and ratings for properties
- User Authentication: Secure login/signup using Passport.js with local strategy
- Interactive Maps: Integration with Mapbox API for location visualization and geocoding
- Image Upload: Cloud-based image storage using Cloudinary
- Authorization: Owner-based permissions for editing and deleting listings
- Data Validation: Server-side validation using Joi schema
- Flash Messages: Real-time user feedback for actions
- Responsive Design: Mobile-friendly UI with Bootstrap/CSS
- Dynamic Templating: EJS templates with layouts using ejs-mate
- Session Management: Persistent sessions stored in MongoDB
- Node.js - JavaScript runtime
- Express.js - Web application framework
- MongoDB Atlas - Cloud database
- Mongoose - MongoDB object modeling
- Passport.js - Authentication middleware
- Passport-Local - Username and password authentication
- Passport-Local-Mongoose - Mongoose plugin for user authentication
- Express-Session - Session middleware
- Connect-Mongo - MongoDB session store
- Cloudinary - Image storage and management
- Mapbox SDK - Geocoding and mapping services
- Joi - Schema validation
- Custom Error Handler - Centralized error management
- EJS - Templating engine
- EJS-Mate - Layout support for EJS
- CSS - Custom styling
- JavaScript - Client-side interactivity
- Multer - File upload handling
- Method-Override - HTTP method override
- Connect-Flash - Flash messages
- Dotenv - Environment variable management
Wanderlust/
├── app.js # Main application entry point
├── package.json # Dependencies and scripts
├── cloudConfig.js # Cloudinary configuration
├── middleware.js # Custom middleware (auth, validation)
├── schema.js # Joi validation schemas
├── controllers/
│ ├── listings.js # Listing business logic
│ ├── reviews.js # Review business logic
│ └── users.js # User authentication logic
├── models/
│ ├── listing.js # Listing schema
│ ├── review.js # Review schema
│ └── user.js # User schema
├── routes/
│ ├── listing.js # Listing routes
│ ├── review.js # Review routes
│ └── user.js # User routes
├── views/
│ ├── layouts/ # EJS layouts
│ ├── listings/ # Listing views
│ ├── users/ # Authentication views
│ └── includes/ # Reusable components (navbar, footer, flash)
├── public/
│ ├── css/ # Stylesheets
│ └── js/ # Client-side JavaScript (map, scripts)
├── utils/
│ ├── ExpressError.js # Custom error class
│ └── wrapAsync.js # Async error wrapper
└── init/
├── data.js # Sample data
└── index.js # Database initialization script
- Node.js (v24.0.2 or higher)
- MongoDB Atlas account
- Cloudinary account
- Mapbox account
-
Clone the repository
git clone https://github.com/Rajendra0309/Wanderlust.git cd Wanderlust -
Install dependencies
npm install
-
Set up environment variables
Create a
.envfile in the root directory with the following variables:ATLASDB_URL=your_mongodb_atlas_connection_string SECRET=your_session_secret_key # Cloudinary Configuration CLOUD_NAME=your_cloudinary_cloud_name CLOUD_API_KEY=your_cloudinary_api_key CLOUD_API_SECRET=your_cloudinary_api_secret # Mapbox Configuration MAP_TOKEN=your_mapbox_access_token # Environment NODE_ENV=development
-
Initialize the database (optional)
To populate the database with sample data:
node init/index.js
-
Start the development server
npm start
or with nodemon for auto-restart:
npx nodemon app.js
-
Access the application
Open your browser and navigate to:
http://localhost:3000
- Sign Up/Login: Create an account or log in to access full features
- Browse Listings: View all available accommodations on the homepage
- View Details: Click on any listing to see detailed information, reviews, and location map
- Add Review: Leave ratings and reviews for properties you've visited
- Create Listing: Share your own property by creating a new listing with images and location
- Manage Listings: Edit or delete your own property listings
- Upload Images: Add professional photos using the integrated Cloudinary upload
- Set Location: Automatic geocoding converts addresses to map coordinates
| Variable | Description | Example |
|---|---|---|
ATLASDB_URL |
MongoDB Atlas connection string | mongodb+srv://<username>:<password>@cluster.mongodb.net/wanderlust |
SECRET |
Session secret key for encryption | your-secret-key-here |
CLOUD_NAME |
Cloudinary cloud name | your-cloud-name |
CLOUD_API_KEY |
Cloudinary API key | your-api-key |
CLOUD_API_SECRET |
Cloudinary API secret | your-api-secret |
MAP_TOKEN |
Mapbox public access token | pk.eyJ1IjoiZXhhbXBsZSIsImEiOiJja... |
NODE_ENV |
Environment mode | development or production |
GET /listings- View all listingsGET /listings/new- Show create listing form (auth required)POST /listings- Create new listing (auth required)GET /listings/:id- View single listing detailsGET /listings/:id/edit- Show edit form (owner only)PUT /listings/:id- Update listing (owner only)DELETE /listings/:id- Delete listing (owner only)
POST /listings/:id/reviews- Add review to listing (auth required)DELETE /listings/:id/reviews/:reviewId- Delete review (author only)
GET /signup- Show signup formPOST /signup- Register new userGET /login- Show login formPOST /login- Authenticate userGET /logout- Logout user
- Password Hashing: User passwords are hashed using passport-local-mongoose
- Session Management: Secure sessions with httpOnly cookies
- CSRF Protection: Session-based authentication
- Input Validation: Joi schema validation on all inputs
- Authorization Checks: Middleware ensures users can only modify their own content
- Environment Variables: Sensitive data stored securely in .env file
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is open source and available under the ISC License.
Rajendra Guttedar
- GitHub: @Rajendra0309
- LinkedIn: Connect with me
- Inspired by Airbnb's user experience
- Mapbox for mapping services
- Cloudinary for image management
- MongoDB Atlas for cloud database hosting