# deboraj-roy/asp.net-core-mvc-net-8 architecture

> Architecture diagram of the GitHub repository deboraj-roy/asp.net-core-mvc-net-8, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/deboraj-roy/asp.net-core-mvc-net-8
- Repository: https://github.com/deboraj-roy/asp.net-core-mvc-net-8

## Overview

##### Main Components
- Frontend/Web UI: Represented by the BulkyWeb project. It contains the MVC controllers, Views (separated by Areas such as Admin, Customer, and Identity), view components (e.g., the ShoppingCartViewComponent), static assets (CSS, JavaScript, images in wwwroot), and configuration (appsettings and Program.cs).
- Backend/Data Access Layer: Shown by the Bulky.DataAccess project. It includes the Entity Framework Core DbContext (ApplicationDbContext.cs), migrations, repository implementations (Repository and UnitOfWork patterns), and initializing the database (DbInitializer).
- Domain/Models: The Bulky.Models folder contains all the core domain objects (e.g., Product, Category, Company, ShoppingCart, OrderHeader, etc.) and view models that represent the data structure for views.
- Utility/Supporting Services: The Bulky.Utility project holds utilities such as EmailSender, StripeSettings (for payment integrations), and a static definitions class (SD.cs).

##### Establish Relationships and Data Flow
- The Web UI (BulkyWeb) interacts with the Domain Models to process user input and display data. Controllers (in Admin and Customer areas) serve as the entry point for user requests.
- Data flow from the Web UI is routed to the Data Access layer. Repositories (e.g., ProductRepository, CategoryRepository) encapsulate EF Core operations and abstract database operations. The DbContext ties everything together for persistence.
- Utility functions (e.g., for sending emails or payment processing) are invoked by controllers or services within Web UI.
- The ASP.NET Core Identity system (located in Areas/Identity) is integrated within the BulkyWeb project; this component ensures authentication and authorization across the application.

##### Architectural Patterns and Design Principles
- MVC (Model-View-Controller): Clearly visible in the separation between BulkyWeb Controllers, Views (Razor pages), and the Domain Models.
- Repository and Unit of Work Patterns: Evident from the structure of Bulky.DataAccess in the subfolders for Repository, including interfaces and concrete classes. They abstract the database operations and enable cleaner unit testing.
- Code-First Migrations with EF Core: Shown by the Migrations folder and DbInitializer.
- Separation of Concerns by splitting the solution into multiple projects (DataAccess, Models, Utility, Web) for clarity and maintainability.

##### Detail Relevant Technologies
- ASP.NET Core MVC (.NET 8)
- Entity Framework Core (including code-first migrations)
- ASP.NET Core Identity for authentication/authorization
- Bootstrap v5 for UI design and responsiveness
- Stripe for payment processing
- Social login integrations (Google, Facebook)
- Deployment on Microsoft Azure

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "UI Layer"
        UI1["BulkyWeb (MVC UI)"]:::ui
        UI2["Admin Area (Controllers/Views)"]:::ui
        UI3["Customer Area (Controllers/Views)"]:::ui
        UI4["Identity (Auth)"]:::ui
        subgraph "Static Assets & Config"
            UI5A["wwwroot"]:::ui
            UI5B["appsettings.json"]:::ui
            UI5C["Program.cs"]:::ui
        end
    end

    %% Data Access Layer
    subgraph "Data Access Layer (EF Core & Repositories)"
        DA1["Repository & UnitOfWork"]:::data
        DA2["EF Core DbContext"]:::data
        DA3["Migrations"]:::data
        DA4["DbInitializer"]:::data
    end

    %% Domain Model Layer
    subgraph "Domain Model"
        subgraph "Domain Structures"
            DM1A["Domain Entities"]:::domain
            DM1B["ViewModels"]:::domain
        end
    end

    %% Utility/Supporting Services
    subgraph "Utility Services"
        UT1A["EmailSender"]:::utility
        UT1B["StripeSettings"]:::utility
        UT1C["SD Definitions"]:::utility
    end

    %% External Integrations
    subgraph "External Integrations"
        EX1["Stripe Payment"]:::external
        EX2["Social Logins"]:::external
        EX3["Azure Deployment"]:::external
    end

    %% Relationships
    %% UI interactions with Domain and Data layers
    UI2 -->|"invokesRepo"| DA1
    UI3 -->|"invokesRepo"| DA1
    UI2 -->|"usesModels"| DM1A
    UI3 -->|"usesModels"| DM1B

    %% Data layer internal flow
    DA1 -->|"usesEFCore"| DA2
    DA2 -->|"migration"| DA3
    DA2 -->|"initDB"| DA4
    DA1 ---|"CRUD"| DM1A
    DA1 ---|"CRUD"| DM1B

    %% UI interactions with Utility services
    UI2 -->|"callsUtilities"| UT1A
    UI3 -->|"callsUtilities"| UT1B

    %% Utility services communicate with External systems
    UT1B -->|"processPayment"| EX1
    UI4 -->|"integrates"| EX2
    UI1 -->|"deploysVia"| EX3

    %% Styles
    classDef ui fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef data fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef domain fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef utility fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef external fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;

    %% Click Events for UI Layer
    click UI2 "https://github.com/deboraj-roy/asp.net-core-mvc-net-8/tree/main/Bulky/BulkyWeb/Areas/Admin"
    click UI3 "https://github.com/deboraj-roy/asp.net-core-mvc-net-8/tree/main/Bulky/BulkyWeb/Areas/Customer"
    click UI4 "https://github.com/deboraj-roy/asp.net-core-mvc-net-8/tree/main/Bulky/BulkyWeb/Areas/Identity"
    click UI5A "https://github.com/deboraj-roy/asp.net-core-mvc-net-8/tree/main/Bulky/BulkyWeb/wwwroot"
    click UI5B "https://github.com/deboraj-roy/asp.net-core-mvc-net-8/blob/main/Bulky/BulkyWeb/appsettings.json"
    click UI5C "https://github.com/deboraj-roy/asp.net-core-mvc-net-8/blob/main/Bulky/BulkyWeb/Program.cs"

    %% Click Events for Data Access Layer
    click DA2 "https://github.com/deboraj-roy/asp.net-core-mvc-net-8/blob/main/Bulky/Bulky.DataAccess/Data/ApplicationDbContext.cs"
    click DA4 "https://github.com/deboraj-roy/asp.net-core-mvc-net-8/blob/main/Bulky/Bulky.DataAccess/DbInitializer/DbInitializer.cs"
    click DA3 "https://github.com/deboraj-roy/asp.net-core-mvc-net-8/tree/main/Bulky/Bulky.DataAccess/Migrations"
    click DA1 "https://github.com/deboraj-roy/asp.net-core-mvc-net-8/tree/main/Bulky/Bulky.DataAccess/Repository"

    %% Click Events for Domain Models
    click DM1A "https://github.com/deboraj-roy/asp.net-core-mvc-net-8/blob/main/Bulky/Bulky.Models"
    click DM1B "https://github.com/deboraj-roy/asp.net-core-mvc-net-8/tree/main/Bulky/Bulky.Models/ViewModels"

    %% Click Events for Utility Services
    click UT1A "https://github.com/deboraj-roy/asp.net-core-mvc-net-8/blob/main/Bulky/Bulky.Utility/EmailSender.cs"
    click UT1B "https://github.com/deboraj-roy/asp.net-core-mvc-net-8/blob/main/Bulky/Bulky.Utility/StripeSettings.cs"
    click UT1C "https://github.com/deboraj-roy/asp.net-core-mvc-net-8/blob/main/Bulky/Bulky.Utility/SD.cs"
```
