# amanmahat0/online-rental-system- architecture

> Architecture diagram of the GitHub repository amanmahat0/online-rental-system-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/amanmahat0/online-rental-system-
- Repository: https://github.com/amanmahat0/online-rental-system-

## Overview

##### Project type and purpose
- This is a full-stack “Online Rental System” comprising:
- A React single-page application (client/) delivering role-based UIs for end users, agents, owners, and admins.
- A Node.js/Express REST API (server/) implementing MVC (models, controllers, routes) with authentication, payment processing, and property management.
- A database (referenced in server/db_conn/db.js) for persisting users, properties, payments, etc.
- An external payment gateway (invoked by paymentController) and a file-uploads area for property images.

##### File structure
- client/ subdivides by roles:
- user/ – public pages (landing, booking, login/register) + user dashboard components
- agent/, owners/, admin/ – each has Routes, Sidebar, Pages and Context for state
- Payment and Payment History modules under client/src/Payment
- Global routes in client/src/Routes and client/src/user/Routes
- server/ follows MVC:
- model/ – Mongoose (or similar) schemas for users, agents, owners, properties, payments
- controller/ – business logic for each resource
- routes/ – Express routers mapping HTTP verbs & paths to controllers
- auth/ – JWT or session middleware
- db_conn/ – DB connection setup
- EncoderDecoder – password hashing utilities
- uploads/ – static store for file uploads

##### README
- Minimal title “Online-Rental-System” confirming the above architecture and use case.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        HTML["index.html"]:::ui
        App["App.js"]:::ui
        subgraph "User Module"
            direction TB
            UC["UserContext.jsx"]:::ui
            UR["Routes.jsx"]:::ui
            UP["User Pages/Components"]:::ui
        end
        subgraph "Agent Module"
            direction TB
            ARd["AgentDashboard.jsx"]:::ui
            ASb["AgentSidebar.jsx"]:::ui
            AReq["BookingRequest.jsx"]:::ui
            AList["MyListingsAgent.jsx"]:::ui
            AProf["AgentProfile.jsx"]:::ui
            ABook["AgentBookings.jsx"]:::ui
        end
        subgraph "Owner Module"
            direction TB
            ORd["OwnerDashboard.jsx"]:::ui
            OSb["OwnerSidebar.jsx"]:::ui
            OList["MyListingsOwner.jsx"]:::ui
            OProf["OwnerProfile.jsx"]:::ui
        end
        subgraph "Admin Module"
            direction TB
            ACt["AdminContext.jsx"]:::ui
            ARo["AdminRoutes.jsx"]:::ui
            ACpComp["Admin Components"]:::ui
            ACpPage["AdminLogin.jsx"]:::ui
        end
        GR["Global Routes"]:::ui
        subgraph "Payment Module"
            direction TB
            PF["PaymentForm.jsx"]:::ui
            PGWComp["PaymentGateway.jsx"]:::ui
            POpt["PaymentOptions.jsx"]:::ui
            PSum["PaymentSummary.jsx"]:::ui
            PRc["Receipt.jsx"]:::ui
            PHist["PaymentHistory.jsx"]:::ui
        end
    end

    %% Backend Layer
    subgraph "Backend Layer"
        direction TB
        Server["server.js"]:::backend
        subgraph "Auth & Util"
            direction TB
            Auth["auth.js"]:::backend
            Enc["passwordEncoderDecoder.js"]:::backend
        end
        subgraph "MVC"
            direction TB
            subgraph "Models"
                direction TB
                MUser["userModel.js"]:::backend
                MAgt["agentModel.js"]:::backend
                MOwn["ownerModel.js"]:::backend
                MProp["propertyModel.js"]:::backend
                MPay["paymentModel.js"]:::backend
                MAdm["adminModel.js"]:::backend
            end
            subgraph "Controllers"
                direction TB
                CU["userController.js"]:::backend
                CA["agentController.js"]:::backend
                CO["ownerController.js"]:::backend
                CAD["adminController.js"]:::backend
                CP["propertyController.js"]:::backend
                CPC["paymentController.js"]:::backend
            end
            subgraph "Routes"
                direction TB
                RU["userRoute.js"]:::backend
                RA["agentRoute.js"]:::backend
                RO["ownerRoute.js"]:::backend
                RAd["adminRoute.js"]:::backend
                RP["propertyRoute.js"]:::backend
                RPay["paymentRoute.js"]:::backend
            end
        end
        DB["Database"]:::db
        File["File Store"]:::external
    end

    %% External Services
    EGW["Payment Gateway"]:::external

    %% Relationships
    App -->|"uses UI modules"| GR
    GR -->|"HTTPS/JSON"| Server
    Server -->|"loads"| Auth
    Server -->|"uses"| Enc
    Server -->|"mounts"| RU
    Server -->|"mounts"| RA
    Server -->|"mounts"| RO
    Server -->|"mounts"| RAd
    Server -->|"mounts"| RP
    Server -->|"mounts"| RPay
    RU -->|"calls"| CU
    RA -->|"calls"| CA
    RO -->|"calls"| CO
    RAd -->|"calls"| CAD
    RP -->|"calls"| CP
    RPay -->|"calls"| CPC
    CU -->|"reads/writes"| MUser
    CA -->|"reads/writes"| MAgt
    CO -->|"reads/writes"| MOwn
    CAD -->|"reads/writes"| MAdm
    CP -->|"reads/writes"| MProp
    CPC -->|"reads/writes"| MPay
    MUser -->|"persist"| DB
    MAgt -->|"persist"| DB
    MOwn -->|"persist"| DB
    MAdm -->|"persist"| DB
    MProp -->|"persist"| DB
    MPay -->|"persist"| DB
    CPC -.->|"SDK/API"| EGW
    PF -->|"form submits"| Server
    PF -->|"uploads images"| File
    File -->|"stores refs"| DB

    %% Click Events
    click App "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/App.js"
    click HTML "https://github.com/amanmahat0/online-rental-system-/blob/main/client/public/index.html"
    click UC "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/user/Context/UserContext.jsx"
    click UR "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/user/Routes/Routes.jsx"
    click ARd "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/agent/Routes/AgentDashboard.jsx"
    click ASb "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/agent/Sidebar/AgentSidebar.jsx"
    click AReq "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/agent/BookingRequest/BookingRequest.jsx"
    click AList "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/agent/My Listings/MyListingsAgent.jsx"
    click AProf "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/agent/My Profile/AgentProfile.jsx"
    click ABook "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/agent/MyBookings/AgentBookings.jsx"
    click ORd "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/owners/Routes/OwnerDashboard.jsx"
    click OSb "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/owners/Sidebar/OwnerSidebar.jsx"
    click OList "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/owners/My Listings/MyListingsOwner.jsx"
    click OProf "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/owners/My Profile/OwnerProfile.jsx"
    click ACt "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/admin/adminContext/AdminContext.jsx"
    click ARo "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/admin/routes/AdminRoutes.jsx"
    click ACpComp "https://github.com/amanmahat0/online-rental-system-/tree/main/client/src/admin/components/"
    click ACpPage "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/admin/pages/AdminLogin.jsx"
    click GR "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/Routes/Routes.jsx"
    click PF "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/Payment/PaymentForm.jsx"
    click PGWComp "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/Payment/PaymentGateway.jsx"
    click POpt "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/Payment/PaymentOptions.jsx"
    click PSum "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/Payment/PaymentSummary.jsx"
    click PRc "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/Payment/Receipt.jsx"
    click PHist "https://github.com/amanmahat0/online-rental-system-/blob/main/client/src/Payment History/PaymentHistory.jsx"
    click Server "https://github.com/amanmahat0/online-rental-system-/blob/main/server/server.js"
    click Auth "https://github.com/amanmahat0/online-rental-system-/blob/main/server/auth/auth.js"
    click Enc "https://github.com/amanmahat0/online-rental-system-/blob/main/server/EncoderDecoder/passwordEncoderDecoder.js"
    click DB "https://github.com/amanmahat0/online-rental-system-/blob/main/server/db_conn/db.js"
    click File "https://github.com/amanmahat0/online-rental-system-/tree/main/server/uploads"
    click MUser "https://github.com/amanmahat0/online-rental-system-/blob/main/server/model/userModel.js"
    click MAgt "https://github.com/amanmahat0/online-rental-system-/blob/main/server/model/agentModel.js"
    click MOwn "https://github.com/amanmahat0/online-rental-system-/blob/main/server/model/ownerModel.js"
    click MProp "https://github.com/amanmahat0/online-rental-system-/blob/main/server/model/propertyModel.js"
    click MPay "https://github.com/amanmahat0/online-rental-system-/blob/main/server/model/paymentModel.js"
    click MAdm "https://github.com/amanmahat0/online-rental-system-/blob/main/server/model/adminModel.js"
    click CU "https://github.com/amanmahat0/online-rental-system-/blob/main/server/controller/userController.js"
    click CA "https://github.com/amanmahat0/online-rental-system-/blob/main/server/controller/agentController.js"
    click CO "https://github.com/amanmahat0/online-rental-system-/blob/main/server/controller/ownerController.js"
    click CAD "https://github.com/amanmahat0/online-rental-system-/blob/main/server/controller/adminController.js"
    click CP "https://github.com/amanmahat0/online-rental-system-/blob/main/server/controller/propertyController.js"
    click CPC "https://github.com/amanmahat0/online-rental-system-/blob/main/server/controller/paymentController.js"
    click RU "https://github.com/amanmahat0/online-rental-system-/blob/main/server/routes/userRoute.js"
    click RA "https://github.com/amanmahat0/online-rental-system-/blob/main/server/routes/agentRoute.js"
    click RO "https://github.com/amanmahat0/online-rental-system-/blob/main/server/routes/ownerRoute.js"
    click RAd "https://github.com/amanmahat0/online-rental-system-/blob/main/server/routes/adminRoute.js"
    click RP "https://github.com/amanmahat0/online-rental-system-/blob/main/server/routes/propertyRoute.js"
    click RPay "https://github.com/amanmahat0/online-rental-system-/blob/main/server/routes/paymentRoute.js"

    %% Styles
    classDef ui fill:#cfe2ff,stroke:#084298,color:#084298
    classDef backend fill:#d1e7dd,stroke:#0f5132,color:#0f5132
    classDef external fill:#fff3cd,stroke:#664d03,color:#664d03
    classDef db fill:#e2e3e5,stroke:#41464b,color:#41464b
```
