# rishan99/hbmvp architecture

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

- Interactive diagram: https://gitdiagram.com/rishan99/hbmvp
- Repository: https://github.com/rishan99/hbmvp

## Overview

##### Main Components

A. API Layer (Presentation)
- Controllers Package
- AuthController
- PropertyController
- PropertyTypeController
- RoleController

B. Business Layer
- Services Package
- AuthService
- PropertyService
- PropertyTypeService
- RoleService
- DTOs Package
- LoginDto
- PropertyDto
- PropertyTypeDto
- RegisterDto
- etc.
- Mappers Package

C. Core Layer
- Entities
- ApplicationUser
- Property
- PropertyImage
- PropertyType
- Interfaces/Repositories
- IAuthRepository
- IPropertyRepository
- IPropertyTypeRepository
- Context
- AppDbContext

D. Infrastructure Layer
- Repository Implementations
- AuthRepository
- PropertyRepository
- PropertyTypeRepository

**┌─────────────────────────────────────────────────────────┐**
- Client Applications                   │
- ┘
- ↓ HTTP
**┌─────────────────────────────────────────────────────────┐**
- API Layer                          │
- ┌─────────────┐  ┌──────────────┐  ┌──────────────┐   │
- Auth     │  │   Property   │  │PropertyType  │   │
- Controller  │  │  Controller  │  │ Controller   │   │
- ┘  └──────────────┘  └──────────────┘   │
- ┘
- ↓
**┌─────────────────────────────────────────────────────────┐**
- Business Layer                       │
- ┌─────────────┐  ┌──────────────┐  ┌──────────────┐   │
- Services   │  │     DTOs     │  │   Mappers    │   │
- ┘  └──────────────┘  └──────────────┘   │
- ┘
- ↓
**┌─────────────────────────────────────────────────────────┐**
- Core Layer                          │
- ┌─────────────┐  ┌──────────────┐  ┌──────────────┐   │
- Entities   │  │ Repositories │  │   Context    │   │
- ┘  └──────────────┘  └──────────────┘   │
- ┘
- ↓
**┌─────────────────────────────────────────────────────────┐**
- Infrastructure Layer                      │
- ┌─────────────────────┐  ┌──────────────────────┐     │
- Repository Impl      │  │  External Services   │     │
- ┘  └──────────────────────┘     │
- ┘
- ↓
**┌─────────────────────────────────────────────────────────┐**
- Database                            │
- ┘

##### Additional Elements

A. Cross-Cutting Concerns:
- Authentication/Authorization
- Logging
- Exception Handling

B. External Services:
- File Storage for Property Images
- JWT Token Service

##### Important Notes
- Dependency direction (always pointing inward)
- Clean architecture boundaries
- Notes about the authentication flow
- Database relationships between entities

##### Technical Details to Highlight
- .NET 7.0 Framework
- Entity Framework Core
- JWT Authentication
- RESTful API endpoints
- CRUD operations for Properties and PropertyTypes
- Image handling capabilities

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef api fill:#e1f5fe,stroke:#01579b
    classDef business fill:#e8f5e9,stroke:#1b5e20
    classDef core fill:#fff3e0,stroke:#e65100
    classDef infra fill:#fbe9e7,stroke:#bf360c
    classDef database fill:#f5f5f5,stroke:#212121
    classDef external fill:#f3e5f5,stroke:#4a148c

    %% Client Layer
    Client[Client Applications]

    %% API Layer
    subgraph API
        AuthC["Auth Controller"]:::api
        PropC["Property Controller"]:::api
        PropTypeC["Property Type Controller"]:::api
        RoleC["Role Controller"]:::api
    end

    %% Business Layer
    subgraph Business
        Services["Services Package"]:::business
        DTOs["DTOs Package"]:::business
        Mappers["Mappers Package"]:::business
    end

    %% Core Layer
    subgraph Core
        Entities["Entities"]:::core
        IRepo["Repository Interfaces"]:::core
        Context["AppDbContext"]:::core
    end

    %% Infrastructure Layer
    subgraph Infrastructure
        RepoImpl["Repository Implementations"]:::infra
        DI["Dependency Injection"]:::infra
    end

    %% Database
    DB[(Database)]:::database

    %% External Services
    FileStorage["File Storage"]:::external
    JWTService["JWT Service"]:::external

    %% Relationships
    Client --> AuthC & PropC & PropTypeC & RoleC
    AuthC & PropC & PropTypeC & RoleC --> Services
    Services --> DTOs
    Services --> Mappers
    Services --> IRepo
    IRepo --> RepoImpl
    RepoImpl --> Context
    Context --> DB
    PropC --> FileStorage
    AuthC --> JWTService

    %% Click Events
    click AuthC "https://github.com/Rishan99/HBMVP/blob/main/HouseBrokerMVP.API/Controllers/AuthController.cs"
    click PropC "https://github.com/Rishan99/HBMVP/blob/main/HouseBrokerMVP.API/Controllers/PropertyController.cs"
    click PropTypeC "https://github.com/Rishan99/HBMVP/blob/main/HouseBrokerMVP.API/Controllers/PropertyTypeController.cs"
    click RoleC "https://github.com/Rishan99/HBMVP/blob/main/HouseBrokerMVP.API/Controllers/RoleController.cs"
    click Services "https://github.com/Rishan99/HBMVP/tree/main/HouseBrokerMVP.Business/Services/"
    click DTOs "https://github.com/Rishan99/HBMVP/tree/main/HouseBrokerMVP.Business/DTO/"
    click Mappers "https://github.com/Rishan99/HBMVP/tree/main/HouseBrokerMVP.Business/Mapper/"
    click Entities "https://github.com/Rishan99/HBMVP/tree/main/HouseBrokerMVP.Core/Entities/"
    click IRepo "https://github.com/Rishan99/HBMVP/tree/main/HouseBrokerMVP.Core/Repositories/"
    click Context "https://github.com/Rishan99/HBMVP/blob/main/HouseBrokerMVP.Core/Context/AppDbContext.cs"
    click RepoImpl "https://github.com/Rishan99/HBMVP/tree/main/HouseBrokerMVP.Infrastructure/Repository/"
    click DI "https://github.com/Rishan99/HBMVP/blob/main/HouseBrokerMVP.Infrastructure/DependencyInjection.cs"

    %% Legend
    subgraph Legend
        L1["API Layer"]:::api
        L2["Business Layer"]:::business
        L3["Core Layer"]:::core
        L4["Infrastructure Layer"]:::infra
        L5["Database"]:::database
        L6["External Services"]:::external
    end
```
