MAZ Realty
Saturday 24 August 2024

Table of Contents

Introduction

This is the source code for the website of Maz Realty, a real estate based in Egypt. The application is based on client/server architecture, where the client is a web browser and mobile device, and the server is a Node.js server. The server is responsible for serving the client with the website’s content and handling the requests from the client.
Live
https://mazrealty.live

Core Features

  • User can register and login.
  • User can view the properties.
  • Users can search for properties with advanced search options.
  • User can contact the property owner via WhatsApp, email and phone.
  • User can view the property location on Google Maps.
  • Users can view the property images in a gallery.
  • User can view the property details.
  • User can chat with the property owner via MAZ Realty chat.
  • The user can book lawyer services to check the property documents.
  • The user can upload his property for sale or rent.
  • The user receives a welcome email when registering.
  • The user receives an email when booking lawyer services.
  • User receives email for lawyer services feedback about the property documents.

Installation

 1# Clone the repository
 2git clone https://github.com/Adosh74/mazrealty.live
 3
 4# Change the directory
 5cd mazrealty.live
 6
 7# Install the dependencies
 8npm install
 9
10# Install the client and server dependencies
11npm run build
12
13# Create .env file in the root directory like .env.example file
14
15# Start the whole application
16npm run start
17
18# Now the application is running on http://localhost:<the port in the .env file> 

Technologies

  • Node.js
  • Express.js
  • TypeScript
  • MongoDB
  • Mongoose
  • Validator
  • Redis (for caching)
  • JWT (for authentication)
  • multer (for file uploading)
  • sharp (for image processing)
  • nodemailer (for sending emails)
  • Pino (for logging)
  • React.js
  • Vite
  • Axios
  • SCSSk
  • Flutter
  • Dart
  • WhatsApp API

APIs

users:

  • POST /api/v1/users/ - Create a new user
  • GET /api/v1/users/ - Get all users
  • GET /api/v1/users/:id - Get a user
  • PATCH /api/v1/users/:id - Update a user (only for admin)
  • DELETE /api/v1/users/:id - Delete a user (only for admin)
  • GET /api/v1/users/me - Get the current user (only for authenticated users)
  • PATCH /api/v1/users/updateMe - Update the current user (only for authenticated users)
  • PATCH /api/v1/users/updateMyPassword - Update the current user’s password (only for authenticated users)

auth:

  • POST /api/v1/auth/signup - Sign up and get a token
  • POST /api/v1/auth/login - Log in and get a token
  • GET /api/v1/auth/logout - Log out and clear the token from the cookie

properties:

  • POST /api/v1/properties/ - Create a new property

  • GET /api/v1/properties/ - Get all properties

  • GET /api/v1/properties/:id - Get a property

  • PATCH /api/v1/properties/:id - Update a property (only for admin and property owner)

  • DELETE /api/v1/properties/:id - Delete a property

  • PATCH api/v1/properties/add-images/:id - Add images to a property (only for admin and property owner)

  • PATCH /api/v1/properties/delete-image/:id - Delete an image from a property (only for admin and property owner)

  • get all properties query options:

    • GET /api/v1/properties/?sort=-price - Sort by price descending
    • GET /api/v1/properties/?fields=name,price - Select only name and price fields
    • GET /api/v1/properties/?limit=5 - Limit the number of results to 5
    • GET /api/v1/properties/?page=2&limit=5 - Pagination, get the second page with 5 results

user favorites:

  • POST /api/v1/users/favorites/:id - Add a property to favorites (only for authenticated users)
  • DELETE /api/v1/users/favorites/:id - Remove a property from favorites (only for authenticated users)
  • GET /api/v1/users/favorites - Get all favorite properties of the current user (only for authenticated users)

lawyer:

  • GET /api/v1/lawyers/not-approved - Get all lawyers that are not approved (only for lawyer and admin)
  • PATCH api/v1/lawyers/approve-property/:id - Approve a lawyer (only for lawyer and admin)

cities:

  • GET /api/v1/cities/ - Get all cities

socket events:

newUser - when is connected and authenticated (pass the userId)

sendMessage - when a user sends a message (
pass the object having {
receiverId: receiverId from response,
data: all response
}

)

Documentation

Class Diagram

Authentication Process

Property Management Process

Chat Process

Contract Validation Process

Lawyer Services Process

projects
nodejs

Backlinks

See Also