# owskar/real_estate_management_system architecture

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

- Interactive diagram: https://gitdiagram.com/owskar/real_estate_management_system
- Repository: https://github.com/owskar/real_estate_management_system

## Overview

##### Project Type & Purpose
- This is a full-stack web application built with ReactJS for the frontend and Spring Boot for the backend.
- The application serves multiple user roles (admin, agent, client) for managing real estate properties, including functionalities like user authentication, property listing management, transactions, and role-based dashboards.
- Additionally, it integrates with a MySQL database for data persistence.

##### Breakdown of the File Structure & Architectural Insight
- The project is clearly divided into two main codebases:
- The Spring Boot backend is contained within the "RSE" directory, including its domain-specific layers such as controllers, models, repositories, and services.
- The ReactJS frontend is represented by files in the "src", "public", and associated directories which host components, pages, styles, and configuration for the user interface.
- Build and configuration files like 'pom.xml' (for Maven) are present in the backend directory, while client-side dependencies are managed via 'package.json' (with npm scripts and axios for HTTP communication) in the frontend.
- This naturally lends itself to a layered (or even microservices-inspired) architecture, emphasizing separation of concerns:
- Presentation Layer (React components & pages)
- API/Business Logic Layer (Spring Boot controllers and services)
- Data Access Layer (Spring Boot repositories interfacing with MySQL)

a. Main Components:
- Frontend (React):
- Components (e.g., Header, Footer, AddPropertyForm, PropertyCard, etc.)
- Pages (e.g., HomePage, LoginPage, RegistrationPage, AgentDashboard, etc.)
- Static assets (public folder with index.html, images, manifest, etc.)
- Backend (Spring Boot):
- Controllers (AdminController, AgentController, PropertyController, TransactionController, UserController)
- Services (PropertyService, TransactionService, UserService) which process business logic
- Models & Repositories (domain objects like Property, User, Transaction, and their JPA/repository components)
- Application Entry via RseApplication.java in the main package
- Database Layer:
- MySQL (as indicated in the README, handling storage for user data, property listings, transactions etc.)
- External Components:
- Third-party libraries like axios in the frontend for API communication
- Maven & Spring Boot dependencies for backend operations

b. Relationships & Interactions:
- The React frontend is the consumer of the backend’s exposed REST APIs.
- Client requests flow from the browser (frontend) to the Spring Boot backend.
- Backend controllers interact with service layers to process business logic, which in turn accesses the repository/data layer.
- Data flows back from the backend to the frontend as responses.
- That axios is the client library used for making HTTP calls from frontend to backend.

c. Architectural Patterns & Design Principles:
- Use a layered architecture:
- The Controller layer handles HTTP requests.
- The Service layer encapsulates business logic.
- The Repository/Data Access layer interfaces with the database.
- For the frontend, components are organized into reusable units and pages, following component-driven design (common in ReactJS projects).
- Clearly denote the separation between roles (admin, agent, client) which may have distinct UI views and corresponding backend endpoints.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Nodes
    Browser["User Browser"]:::browserStyle

    %% Frontend Layer
    subgraph "Frontend (React)"
        Components["Components"]:::frontend
        Pages["Pages"]:::frontend
        Assets["Static Assets"]:::frontend
        Axios["HTTP Client (axios)"]:::frontend
        PackageJSON["Build & Dependency Management"]:::build
    end

    %% Backend Layer
    subgraph "Backend (Spring Boot)"
        RseApp["Application Entry (RseApplication)"]:::backend
        Controllers["Controllers"]:::backend
        Services["Services"]:::backend
        Repositories["Repositories"]:::backend
        Models["Models"]:::backend
        PomXML["Build Configuration (pom.xml)"]:::build
    end

    %% Database Layer
    DB["MySQL Database"]:::db

    %% Connections Flow
    Browser -->|"sends request"| Axios
    Axios -->|"calls API"| Controllers
    RseApp --> Controllers
    Controllers -->|"processes"| Services
    Services -->|"data access"| Repositories
    Repositories -->|"CRUD operations"| DB
    Repositories ---|"uses"| Models

    %% Click Events
    click Components "https://github.com/owskar/real_estate_management_system/tree/main/src/components"
    click Pages "https://github.com/owskar/real_estate_management_system/tree/main/src/pages"
    click Assets "https://github.com/owskar/real_estate_management_system/tree/main/public"
    click Axios "https://github.com/owskar/real_estate_management_system/blob/main/src/axios.js"
    click PackageJSON "https://github.com/owskar/real_estate_management_system/blob/main/package.json"
    click RseApp "https://github.com/owskar/real_estate_management_system/blob/main/RSE/src/main/java/com/example/rse/RseApplication.java"
    click Controllers "https://github.com/owskar/real_estate_management_system/tree/main/RSE/src/main/java/com/example/rse/controller"
    click Services "https://github.com/owskar/real_estate_management_system/tree/main/RSE/src/main/java/com/example/rse/service"
    click Repositories "https://github.com/owskar/real_estate_management_system/tree/main/RSE/src/main/java/com/example/rse/repository"
    click Models "https://github.com/owskar/real_estate_management_system/tree/main/RSE/src/main/java/com/example/rse/model"
    click PomXML "https://github.com/owskar/real_estate_management_system/blob/main/RSE/pom.xml"

    %% Styles
    classDef browserStyle fill:#f9c,stroke:#333,stroke-width:2px;
    classDef frontend fill:#bbf,stroke:#333,stroke-width:2px;
    classDef backend fill:#9f9,stroke:#333,stroke-width:2px;
    classDef db fill:#ff9,stroke:#333,stroke-width:2px;
    classDef build fill:#ffc,stroke:#333,stroke-width:2px;
```
