# ibrhmahmd/realestate architecture

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

- Interactive diagram: https://gitdiagram.com/ibrhmahmd/realestate
- Repository: https://github.com/ibrhmahmd/realestate

## Overview

##### Project type and purpose
- This is a full-stack web application: a Real Estate Property Management System
- Built with ASP.NET Core MVC, Entity Framework Core, SQL Server
- Purpose: allow property managers to CRUD properties, tenants, leases; tenants to view lease info, make payments, report issues; role-based authentication

##### File structure
- Top-level solution (DEPI_REAL_Managment.sln) contains:
– PresentationLayer: ASP.NET Core MVC project (.csproj, Controllers, Views, ViewModels, wwwroot assets, appsettings.json)
– sinessLayer (BusinessLayer): DTOs, AutoMapping, Repositories + Interfaces, Services + Interfaces, UnitOfWork + Interface
– DataAccessLayer: EF Core Entities folder, DbContext & ContextFactory, GenericRepository base classes + interfaces, Migrations, appsettings.json, Program.cs
– BusinessLayerTests: unit tests for GenericRepository and specific Repos
- Key patterns:
– Layered architecture (Presentation, Business, Data Access)
– Repository pattern + Unit of Work
– AutoMapper for DTO ↔ Entity mapping
– EF Core Code-First migrations

##### README for additional insights
- Confirms 4-week sprint goals, core features (property management, tenant management, lease agreements, payments, reporting)
- Specifies role-based user authentication

##### Detail
- Sub-component: controllers, services, repos, unit of work, DbContext, migrations
- Don’t over-aggregate: represent important classes or folders, especially where cross-cutting concerns (authentication, mapping) occur
- Both synchronous flows (request → response) and asynchronous/background jobs if any (e.g., seed roles on startup)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Layers and Components
    Client["Web Browser / Client UI"]:::ui

    subgraph "Presentation Layer"
        ProgramEntryPL["Program.cs"]:::presentation
        Controllers["Controllers"]:::presentation
        ViewModelsPL["ViewModels"]:::presentation
        ViewsPL["Views (Razor)"]:::presentation
        PDFHelper["PDFHelper"]:::presentation
        StaticAssets["Static Assets"]:::presentation
    end

    subgraph "Business Layer"
        BusinessLayerProj["BusinessLayer.csproj"]:::business
        DTOs["DTO Models"]:::business
        Profiles["AutoMapper Profiles"]:::business
        ServicesIntf["Service Interfaces"]:::business
        ServicesImpl["Service Implementations"]:::business
        ReposIntfBL["Repository Interfaces"]:::business
        ReposImplBL["Repository Implementations"]:::business
        UoWIntf["Unit of Work Interface"]:::business
        UoWImpl["Unit of Work Implementation"]:::business
    end

    subgraph "Data Access Layer"
        DataAccessProj["DataAccessLayer.csproj"]:::data
        Entities["Entities & DbContext"]:::data
        ReposIntfDAL["Generic Repository Interfaces"]:::data
        RepoBaseDAL["Generic Repository Base"]:::data
        RepoExt["Repo Extensions & Paging"]:::data
        Migrations["Migrations"]:::data
        ProgramEntryDAL["Program.cs"]:::data
        ConfigDAL["appsettings.json"]:::data
    end

    SQL["SQL Server Database"]:::db
    SMTP["SMTP Email Service"]:::external

    %% Connections
    Client -->|HTTP GET/POST| Controllers
    Controllers -->|call IService methods| ServicesIntf
    ServicesIntf -->|implemented by| ServicesImpl
    ServicesImpl -->|map Entities ↔ DTOs| Profiles
    ServicesImpl -->|use Repository Interfaces| ReposIntfBL
    ReposIntfBL -->|implemented by| ReposImplBL
    ServicesImpl -->|use UnitOfWork Interface| UoWIntf
    UoWIntf -->|implemented by| UoWImpl
    ReposImplBL -->|use GenericRepository Base| RepoBaseDAL
    RepoBaseDAL -->|implements| ReposIntfDAL
    ReposImplBL -->|operate on| Entities
    RepoBaseDAL -->|use DbContext| Entities
    Entities -->|apply migrations| Migrations
    Entities -->|connects| SQL
    UoWImpl -->|commit transactions| SQL
    Controllers -->|generate documents| PDFHelper
    Controllers -->|serve assets| StaticAssets
    ServicesImpl -->|send emails| SMTP

    %% Click Events
    click ProgramEntryPL "https://github.com/ibrhmahmd/realestate/blob/master/PresentationLayer/Program.cs"
    click Controllers "https://github.com/ibrhmahmd/realestate/blob/master/PresentationLayer/Controllers/*.cs"
    click ViewModelsPL "https://github.com/ibrhmahmd/realestate/blob/master/PresentationLayer/Models/*.cs"
    click ViewsPL "https://github.com/ibrhmahmd/realestate/tree/master/PresentationLayer/Views/**"
    click PDFHelper "https://github.com/ibrhmahmd/realestate/blob/master/PresentationLayer/helper/PDFHelper.cs"
    click StaticAssets "https://github.com/ibrhmahmd/realestate/tree/master/PresentationLayer/wwwroot/**"
    click BusinessLayerProj "https://github.com/ibrhmahmd/realestate/blob/master/sinessLayer/BusinessLayer.csproj"
    click DTOs "https://github.com/ibrhmahmd/realestate/blob/master/sinessLayer/DTOModels/*.cs"
    click Profiles "https://github.com/ibrhmahmd/realestate/blob/master/sinessLayer/AutoMapping/MappingProfile.cs"
    click ServicesIntf "https://github.com/ibrhmahmd/realestate/blob/master/sinessLayer/Services/*.cs"
    click ServicesImpl "https://github.com/ibrhmahmd/realestate/blob/master/sinessLayer/Services/*Service.cs"
    click ReposIntfBL "https://github.com/ibrhmahmd/realestate/blob/master/sinessLayer/Repositories/Interface/IRepository.cs"
    click ReposImplBL "https://github.com/ibrhmahmd/realestate/blob/master/sinessLayer/Repositories/*.cs"
    click UoWIntf "https://github.com/ibrhmahmd/realestate/blob/master/sinessLayer/Unit_Of_Work/Interface/IUnitOfWork.cs"
    click UoWImpl "https://github.com/ibrhmahmd/realestate/blob/master/sinessLayer/Unit_Of_Work/UnitOfWork.cs"
    click DataAccessProj "https://github.com/ibrhmahmd/realestate/blob/master/DataAccessLayer/DataAccessLayer.csproj"
    click Entities "https://github.com/ibrhmahmd/realestate/blob/master/DataAccessLayer/Entities/*.cs"
    click ReposIntfDAL "https://github.com/ibrhmahmd/realestate/blob/master/DataAccessLayer/GenericRepository/IRepositoryBase.cs"
    click RepoBaseDAL "https://github.com/ibrhmahmd/realestate/blob/master/DataAccessLayer/GenericRepository/RepositoryBase.cs"
    click RepoExt "https://github.com/ibrhmahmd/realestate/blob/master/DataAccessLayer/GenericRepository/Extensions.cs"
    click Migrations "https://github.com/ibrhmahmd/realestate/tree/master/DataAccessLayer/Migrations/**"
    click ProgramEntryDAL "https://github.com/ibrhmahmd/realestate/blob/master/DataAccessLayer/Program.cs"
    click ConfigDAL "https://github.com/ibrhmahmd/realestate/blob/master/DataAccessLayer/appsettings.json"

    %% Styles
    classDef ui fill:#f2f2f2,stroke:#333,stroke-width:1px
    classDef presentation fill:#cce5ff,stroke:#2a579a,stroke-width:1px
    classDef business fill:#d4edda,stroke:#27632a,stroke-width:1px
    classDef data fill:#fff3cd,stroke:#7f6000,stroke-width:1px
    classDef db fill:#e2e3e5,stroke:#3b3f45,stroke-width:1px,stroke-dasharray: 5 5
    classDef external fill:#f8d7da,stroke:#842029,stroke-width:1px,stroke-dasharray: 2 2
```
