A full-stack web application for listing and discovering travel accommodations built with Node.js, Express, MongoDB, and EJS.
- User Authentication: Sign up, login, and logout functionality
- Listing Management: Create, read, update, and delete accommodation listings
- Image Upload: Cloudinary integration for image storage
- Reviews & Ratings: Star-based rating system with comments
- Interactive Maps: Mapbox integration to show listing locations
- Responsive Design: Bootstrap-based responsive UI
- Search & Filter: Filter listings by various criteria
- Backend: Node.js, Express.js
- Database: MongoDB with Mongoose ODM
- Authentication: Passport.js with Local Strategy
- Template Engine: EJS
- File Upload: Multer with Cloudinary
- Maps: Mapbox GL JS
- Styling: Bootstrap 5, Custom CSS
- Validation: Joi for server-side validation
- Node.js (v14 or higher)
- MongoDB (local or cloud)
- Cloudinary account
- Mapbox account
-
Clone the repository
git clone <repository-url> cd wanderlust
-
Install dependencies
npm install
-
Set up environment variables Create a
.envfile in the root directory with the following variables:MONGODB_URI=mongodb://localhost:27017/wanderlust CLOUD_NAME=your_cloudinary_cloud_name CLOUD_API_KEY=your_cloudinary_api_key CLOUD_API_SECRET=your_cloudinary_api_secret MAP_TOKEN=your_mapbox_token SESSION_SECRET=your_session_secret NODE_ENV=development PORT=8080 -
Initialize the database (optional)
node init/index.js
-
Start the application
# Development mode npm run dev # Production mode npm start
-
Access the application Open your browser and navigate to
http://localhost:8080
wanderlust/
├── app.js # Main application file
├── cloudConfig.js # Cloudinary configuration
├── middleware.js # Custom middleware functions
├── schema.js # Joi validation schemas
├── controllers/ # Route controllers
├── models/ # Mongoose models
├── routes/ # Express routes
├── utils/ # Utility functions
├── views/ # EJS templates
├── public/ # Static assets
│ ├── css/ # Stylesheets
│ └── js/ # Client-side JavaScript
└── init/ # Database initialization
GET /signup- Sign up pagePOST /signup- Create new userGET /login- Login pagePOST /login- Authenticate userGET /logout- Logout user
GET /listings- View all listingsGET /listings/new- Create new listing formPOST /listings- Create new listingGET /listings/:id- View specific listingGET /listings/:id/edit- Edit listing formPUT /listings/:id- Update listingDELETE /listings/:id- Delete listing
POST /listings/:id/reviews- Create new reviewDELETE /listings/:id/reviews/:reviewId- Delete review
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the ISC License.
- Bootstrap for the UI framework
- Mapbox for mapping services
- Cloudinary for image storage
- Unsplash for sample images