# lunks41/aemsweb architecture

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

- Interactive diagram: https://gitdiagram.com/lunks41/aemsweb
- Repository: https://github.com/lunks41/aemsweb

## Overview

##### Main Components
- Authentication & Access Control: Represent components responsible for branch-wise logins and role-based permissions. This includes controllers and models in the Account area (e.g., AccountController.cs, Login views, and associated models).
- Dashboard & Navigation: A centralized dashboard that manages branch selection; include the NavigationViewComponent and DashboardControllers (like Controllers/DashboardController.cs and Views in the Shared/Dashboard folder).
– Master Module (under Areas/Master): Handles core entities like Customers, Suppliers, Banks, and Accounts.
– Account Module (under Areas/Account): Manages financial transactions including invoicing, receipts, adjustments, etc.
– HRMS Module (under Areas/HRM): Manages employee records, attendance, payroll, etc.
– Admin Module (under Areas/Admin): Covers system-wide administration features like user and role management, audit logs, and document numbering.
– Project Module (under Areas/Project): Manages job orders, quotations, tariffs, and project workflows.
– Setting Module (under Areas/Setting): For configurations and preferences.
- Data & Persistence Layers: Include the Data folder (e.g., Data/AppDbContext.cs), Entities (the detailed hierarchical folders for Accounts, Masters, Project, etc.) and the Repository/Services layers. This represents the business logic and data access layers.
- External Libraries & Assets: The wwwroot folder, which contains CSS, JavaScript, images, and third-party libraries (Bootstrap, jQuery, Kendo UI), should be depicted as part of the Frontend/UI/Resources.

##### Layers and their Relationships
- Presentation Layer (Web / UI): ASP.NET MVC controllers (located in top-level Controllers and within each Area), Views (cshtml files in each module's Views folders), and ViewModels (in the ViewModels folder).
- Business Logic & Service Layer: Services (under Services and its subdirectories), Repository pattern implementations (Repository folder), and Data Access (Data and Entities folders).
- Data Persistence Layer: Database interactions through AppDbContext and Entity Framework with models in the Entities folder.
- Infrastructure: Supporting components such as Helpers, Extensions, and Hubs (e.g., NotificationHub.cs) that allow real-time communication and utility operations.
- Configuration & Deployment: Configuration files (appsettings.json, launchSettings.json) and solution/project files (.sln, .csproj) are also worth noting.

- For a full-stack application like this one, clearly separate the web front-end (controllers/views) from the business logic and data access layers.
- Branch selection and role-based access control by adding annotations describing that each module’s operations are filtered using branch-specific identifiers and user roles.
- Optionally, use rounded rectangles for modules and standard rectangles for lower-level services.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer (Controllers/Views)"
        A["Authentication & Access"]:::presentation
        A1["Account Controller"]:::presentation
        A2["Login Page"]:::presentation

        B["Dashboard & Navigation"]:::presentation
        B1["Dashboard Controller"]:::presentation
        B2["Dashboard Views"]:::presentation
        B3["Navigation Component"]:::presentation
        B4["Navigation Partial"]:::presentation

        C["Modules"]:::presentation
        C1["Master Module"]:::presentation
        C2["Account Module"]:::presentation
        C3["HRMS Module"]:::presentation
        C4["Admin Module"]:::presentation
        C5["Project Module"]:::presentation
        C6["Setting Module"]:::presentation
        C_note["Branch-Specific Data Isolation"]:::note
    end

    %% Business Logic & Service Layer
    subgraph "Business Logic & Service Layer"
        D1["Services"]:::business
        D2["Repository"]:::business
        D_note["Role-based Access Control"]:::note
    end

    %% Data Persistence Layer
    subgraph "Data Persistence Layer"
        E["AppDbContext"]:::data
        F["Entities"]:::data
    end

    %% External Libraries & Assets
    subgraph "External Libraries & Assets"
        G["wwwroot"]:::external
    end

    %% Connections within Presentation Layer
    A --> A1
    A --> A2
    A -->|"applies-to"| C
    B --> B1
    B --> B2
    B --> B3
    B --> B4
    B -->|"guides"| C

    %% Connections from Presentation to Business Logic
    A -->|"triggers"| D1
    A --> D2
    C -->|"invokes"| D1
    C -->|"invokes"| D2

    %% Connections from Business Logic to Data Persistence
    D1 -->|"queries"| E
    D1 -->|"queries"| F
    D2 -->|"accesses"| E
    D2 -->|"accesses"| F

    %% External Assets providing resources to Presentation
    G -->|"supplies"| A

    %% Styles
    classDef presentation fill:#AED6F1,stroke:#2980B9,stroke-width:2px;
    classDef business fill:#ABEBC6,stroke:#27AE60,stroke-width:2px;
    classDef data fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef external fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
    classDef note fill:#D2B4DE,stroke:#8E44AD,stroke-width:2px;

    %% Click Events for Presentation Layer
    click A1 "https://github.com/lunks41/aemsweb/blob/master/Controllers/AccountController.cs"
    click A2 "https://github.com/lunks41/aemsweb/blob/master/Views/Account/Login.cshtml"
    click B1 "https://github.com/lunks41/aemsweb/blob/master/Controllers/DashboardController.cs"
    click B2 "https://github.com/lunks41/aemsweb/tree/master/Views/Shared/Dashboard"
    click B3 "https://github.com/lunks41/aemsweb/blob/master/Components/NavigationViewComponent.cs"
    click B4 "https://github.com/lunks41/aemsweb/tree/master/Views/Shared/Components/Navigation"
    click C1 "https://github.com/lunks41/aemsweb/tree/master/Areas/Master/Controllers"
    click C2 "https://github.com/lunks41/aemsweb/tree/master/Areas/Account/Controllers"
    click C3 "https://github.com/lunks41/aemsweb/tree/master/Areas/HRM/Controllers"
    click C4 "https://github.com/lunks41/aemsweb/tree/master/Areas/Admin/Controllers"
    click C5 "https://github.com/lunks41/aemsweb/tree/master/Areas/Project/Controllers"
    click C6 "https://github.com/lunks41/aemsweb/tree/master/Areas/Setting/Controllers"

    %% Click Events for Business Logic & Service Layer
    click D1 "https://github.com/lunks41/aemsweb/tree/master/Services/Services"
    click D2 "https://github.com/lunks41/aemsweb/blob/master/Repository/Repository.cs"

    %% Click Events for Data Persistence Layer
    click E "https://github.com/lunks41/aemsweb/blob/master/Data/AppDbContext.cs"
    click F "https://github.com/lunks41/aemsweb/tree/master/Entities"

    %% Click Event for External Libraries & Assets
    click G "https://github.com/lunks41/aemsweb/tree/master/wwwroot"
```
