StayWise is a full-stack web application inspired by Airbnb, designed to facilitate property listings and bookings. It allows users to browse unique accommodations, create their own listings, and leave reviews. Built with a robust Node.js backend and a MongoDB database, it features secure user authentication, image uploads, and interactive maps.
- User Authentication & Authorization: Secure signup and login functionality using Passport.js. Users must be logged in to create listings or leave reviews.
- CRUD Operations for Listings: Users can create, read, update, and delete property listings.
- Reviews & Ratings: Users can leave reviews and star ratings for properties.
- Image Uploads: Seamless image uploading and storage using Cloudinary.
- Interactive Maps: Integration with Leaflet to display property locations on a map.
- Responsive Design: Fully responsive user interface built with Bootstrap 5, ensuring a great experience on desktop and mobile.
- Flash Messages: Instant feedback for user actions (success/error messages).
- MVC Architecture: Clean and organized code structure following the Model-View-Controller pattern.
Frontend:
- HTML5, CSS3, JavaScript
- EJS (Embedded JavaScript): Templating engine for dynamic content.
- Bootstrap 5: CSS framework for responsive design.
- Leaflet: JavaScript library for interactive maps.
Backend:
- Node.js: JavaScript runtime environment.
- Express.js: Web application framework for Node.js.
Database:
- MongoDB: NoSQL database for storing listings, reviews, and users.
- Mongoose: ODM (Object Data Modeling) library for MongoDB and Node.js.
Authentication:
- Passport.js: Authentication middleware for Node.js.
Cloud Services:
- Cloudinary: Cloud-based image and video management services.
- MongoDB Atlas: Cloud-hosted MongoDB service.
Before running this project, ensure you have the following installed:
- Node.js (v14 or higher)
- npm (Node Package Manager)
- A Cloudinary account (for image storage)
- A MongoDB Atlas account (or a local MongoDB instance)
-
Clone the repository:
git clone https://github.com/aay-zee/StayWise.git cd StayWise -
Install dependencies:
npm install
-
Configure Environment Variables:
Create a
.envfile in the root directory of the project and add the following variables:CLOUD_NAME=your_cloudinary_cloud_name CLOUD_API_KEY=your_cloudinary_api_key CLOUD_API_SECRET=your_cloudinary_api_secret ATLASDB_URL=your_mongodb_connection_string SECRET=your_session_secret_key
- Replace the values with your actual credentials.
ATLASDB_URLcan be your local MongoDB URL (e.g.,mongodb://127.0.0.1:27017/staywise) for local development.
-
Initialize the Database (Optional):
If you want to seed the database with some sample data, run:
node init/index.js
-
Run the Application:
node app.js
- Or if you have
nodemoninstalled:nodemon app.js
- Or if you have
-
Access the App:
Open your browser and navigate to
http://localhost:5000.
StayWise/ ├── controllers/ # Route controllers (logic) ├── init/ # Database initialization scripts ├── models/ # Mongoose models (Schema) ├── public/ # Static files (CSS, JS, Images) ├── routes/ # Express routes ├── utils/ # Utility functions (Error handling, etc.) ├── views/ # EJS templates │ ├── layouts/ # Layout templates (boilerplate) │ ├── listings/ # Listing-related views │ ├── users/ # User-related views │ └── includes/ # Partials (navbar, footer, flash) ├── app.js # Main application entry point ├── cloudConfig.js # Cloudinary configuration ├── middleware.js # Custom middleware ├── schema.js # Joi validation schemas └── package.json # Project dependencies and scripts Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the ISC License.