StaySuite is a property rental platform similar offering key features such as user authentication, booking management, saving travelling history and favurite listings for guests while enabling host to manange listings via dashboard and seamlessly handle reservations made on there listings. It supports secure authentication using JWT
, real-time updates for both guests and hosts with Socket.io
, and image uploads of listings with Multer
. Built with Nuxt.js
for the frontend,Nest.js
for the backend, and MongoDB
for data storage, the platform ensures a seamless and efficient user experience.
This repository contains the backend for the StaySuite
property rental platform, built with Nest.js, MongoDB, JWT, Socket.io, and Multer. It handles user authentication, booking management, real-time updates, and secure file uploads, ensuring a scalable and efficient system.
Nest.js, with its modular architecture and TypeScript support, is ideal for this project as it enhances maintainability, enforces best practices, and provides built-in support for WebSockets, making real-time features seamless. MongoDB ensures flexible data handling, while JWT secures authentication. Socket.io enables instant communication between guests and hosts, and Multer efficiently manages media uploads.
- Check out the latest demo of Project StaySuite-Site.
- Find the Client Repository of this Project Here StaySuite-Client.
Clone the project using the following command:
git clone https://github.com/BazilSuhail/StaySuite-Server.git
Go to the project directory
cd StaySuite-Server
Then Run this command in your terminal to install all required dependancies:
npm install
In the project directory, you can run:
npm run start:dev
Runs the app in the development mode. Your server will be running at port 3001, Open http://localhost:3001 or also you can modify it in the .env file.
- Signup Page: A registration api for new users to get register themselves as a Guest or Host.
- Login Page: A login api for existing users allowing them to log into there accounts.
- Listings Management: Admin api enabling him to view, add, and remove property listings.
- Bookings Management: Admin api enabling him to view all bookings, including user and property details.
- User Profile: User api enabling him to view his information and .
- Admin Panel: Accessible api's only to Host users.
- Booking history: Guests api's enabling them to can view there booking history.
- Redirection for Unauthenticated Users: Users attempting to access protected routes are redirected to the login page.
- Booking Page: Users api enabling them to submit bookings, which are saved to the backend.
- Reserved Bookings for Guests Page: Displaying reserved bookings api for each user.
- Reserved Bookings for Host Page: Displaying api for reserved bookings on Hosts Listings.
- Listings Management: Api for Host to add new listings with property details and images, and list view for displaying and deleting existing listings.
- Bookings Management: Admin's api to overview of all bookings with details for each booking, including user and property information.
- Role-Based Access Control: Routes are protected based on user roles (e.g., admin).
- JWT Middleware: Secures routes that require authentication.
- Password Hashing: Passwords are hashed using bcrypt before being saved to the database.
- Controllers: Handles API logic (e.g., authentication, listings, bookings).
- Services: Business logic for interacting with the database.
- Middleware: JWT authentication and role-based access control.
- Models: MongoDB schemas for listings, bookings, and users.