# houxxam/inventorymanagementsystem architecture

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

- Interactive diagram: https://gitdiagram.com/houxxam/inventorymanagementsystem
- Repository: https://github.com/houxxam/inventorymanagementsystem

## Overview

##### Project Type and Purpose
- This is a monolithic full-stack web application built on ASP NET Core MVC for inventory management.
- It combines server-side rendered Razor views (UI), controller logic (backend), and Entity Framework Core (data access) targeting a relational database.

##### File-Structure Analysis
- Controllers/ – MVC controllers (AdminController, HomeController, UsersController, plus a REST-style MaterielsApi).
- Views/ – Razor pages organized by feature area (Views/Users, Views/Materiels, Views/Shared, etc.).
- Data/ – AppDbContext (EF Core), Migrations/ for database schema changes.
- wwwroot/ – Static assets (CSS, JS, images, third-party libs like Bootstrap/jQuery).
- Program.cs + appsettings.json – Configure Kestrel, middleware pipeline, connection strings, and environment settings.
- PublishProfiles – deployment targets (FTP, folder).

##### Key Architecture and Design Patterns
- Model-View-Controller (separation of concerns).
- Layered architecture:
- Presentation layer (Razor views + static files)
- Application layer (Controllers + DTO mapping via UserExtension)
- Data access layer (EF Core DbContext, Migrations)
- Relational database (e.g., SQL Server or SQLite via inventorydatabase.sql)
- Optional REST API endpoint for Materiel resources (MaterielsApi).

##### Main Components
a. Client / Browser
- Sends HTTP/HTTPS requests, downloads HTML, CSS, JS.
b. Web Server / ASP NET Core Application
- Kestrel (or IIS reverse proxy) running Program.cs/startup logic.
- Middleware pipeline: Static File Middleware, Routing, Authorization, MVC.
- Controllers:
- MVC Controllers (Home, Admin, Users, Services, etc.)
- API Controller (MaterielsApi)
c. Business Logic / Services
- Controller actions invoke any custom service code or extensions (UserExtention).
d. Data Access Layer
- AppDbContext (EF Core) encapsulating DbSets for User, Materiel, Service, Categorie, etc.
- Migrations for schema management.
e. Database
- Relational store (configured via appsettings.json).
- Populated/updated via inventorydatabase.sql or EF migrations.
f. Static Assets & Third-Party Libraries
- CSS/JS under wwwroot, Bootstrap, jQuery loaded by views.

##### Relationships and Data Flows
1. Browser → (HTTP) → Kestrel/Middleware
2. Middleware → Controller → Business logic → DbContext → Database
3. Database → query results → DbContext → Controller → View/JSON → Browser
4. Browser → (static content request) → Static File Middleware → CSS/JS served

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client/UI Layer
    subgraph "Client / Browser" 
        direction TB
        Browser["Browser"]:::client
        StaticAssets["Static Assets\n(wwwroot/css/, wwwroot/js/, wwwroot/lib/)"]:::client
    end

    %% Infrastructure Layer
    subgraph "Web Server / ASP.NET Core App"
        direction TB
        Kestrel["Kestrel / IIS Reverse Proxy"]:::infra
        Middleware["Middleware Pipeline\n(Static Files, Routing, Authorization, MVC)"]:::infra
        Startup["Startup & Configuration\n(Program.cs, appsettings.json, launchSettings.json, InvWebApp.csproj)"]:::infra
    end

    %% Presentation & Application Layer
    subgraph "Presentation Layer"
        direction TB
        Views["Razor Views\n(Views/)"]:::server
    end

    subgraph "Controllers"
        direction TB
        HomeCtrl["HomeController"]:::server
        AdminCtrl["AdminController"]:::server
        UsersCtrl["UsersController"]:::server
        CategoriesCtrl["CategoriesController"]:::server
        ServiceGroupsCtrl["ServiceGroupsController"]:::server
        ServicesCtrl["ServicesController"]:::server
        LogListCtrl["LogListController"]:::server
        MaterielsCtrl["MaterielsController"]:::server
        MaterielsApi["MaterielsApi (REST API)"]:::server
    end

    %% Business Logic
    BusinessLogic["Business Logic / DTO Mapping\n(Extentions/UserExtention.cs)"]:::server

    %% Data Access Layer
    subgraph "Data Access Layer"
        direction TB
        AppDbContext["AppDbContext (EF Core)"]:::data
        Migrations["EF Core Migrations\n(Migrations/)"]:::data
    end

    %% Database & Scripts
    Database["Relational Database\n(SQL Server / SQLite)"]:::db
    Scripts["Database Scripts\n(inventorydatabase.sql, trigger.sql)"]:::scripts

    %% Deployment
    PublishProfiles["Publish Profiles\n(Properties/PublishProfiles/)"]:::infra

    %% Connections
    Browser -->|"HTTP Request"| Kestrel
    Browser -->|"Static File Request"| Middleware
    StaticAssets --> Middleware
    Kestrel --> Middleware
    Middleware --> Views
    Middleware --> HomeCtrl
    HomeCtrl --> Views
    Middleware --> AdminCtrl
    Middleware --> UsersCtrl
    Middleware --> CategoriesCtrl
    Middleware --> ServiceGroupsCtrl
    Middleware --> ServicesCtrl
    Middleware --> LogListCtrl
    Middleware --> MaterielsCtrl
    Middleware --> MaterielsApi
    HomeCtrl --> BusinessLogic
    AdminCtrl --> BusinessLogic
    UsersCtrl --> BusinessLogic
    CategoriesCtrl --> BusinessLogic
    ServiceGroupsCtrl --> BusinessLogic
    ServicesCtrl --> BusinessLogic
    LogListCtrl --> BusinessLogic
    MaterielsCtrl --> BusinessLogic
    MaterielsApi --> BusinessLogic
    BusinessLogic --> AppDbContext
    AppDbContext --> Database
    Migrations --> Database
    Scripts --> Database
    Startup -.->|Configuration| Middleware
    Startup -.->|Configuration| AppDbContext
    PublishProfiles -.->|Deploy| Kestrel

    %% Click Events
    click StaticAssets "https://github.com/houxxam/inventorymanagementsystem/tree/main/wwwroot/css/"
    click StaticAssets "https://github.com/houxxam/inventorymanagementsystem/tree/main/wwwroot/js/"
    click StaticAssets "https://github.com/houxxam/inventorymanagementsystem/tree/main/wwwroot/lib/"
    click Views "https://github.com/houxxam/inventorymanagementsystem/tree/main/Views/"
    click Startup "https://github.com/houxxam/inventorymanagementsystem/blob/main/Program.cs"
    click Startup "https://github.com/houxxam/inventorymanagementsystem/blob/main/appsettings.json"
    click Startup "https://github.com/houxxam/inventorymanagementsystem/blob/main/appsettings.Development.json"
    click Startup "https://github.com/houxxam/inventorymanagementsystem/blob/main/Properties/launchSettings.json"
    click Startup "https://github.com/houxxam/inventorymanagementsystem/blob/main/InvWebApp.csproj"
    click Middleware "https://github.com/houxxam/inventorymanagementsystem/blob/main/Program.cs"
    click HomeCtrl "https://github.com/houxxam/inventorymanagementsystem/blob/main/Controllers/HomeController.cs"
    click AdminCtrl "https://github.com/houxxam/inventorymanagementsystem/blob/main/Controllers/AdminController.cs"
    click UsersCtrl "https://github.com/houxxam/inventorymanagementsystem/blob/main/Controllers/UsersController.cs"
    click CategoriesCtrl "https://github.com/houxxam/inventorymanagementsystem/blob/main/Controllers/CategoriesController.cs"
    click ServiceGroupsCtrl "https://github.com/houxxam/inventorymanagementsystem/blob/main/Controllers/ServiceGroupsController.cs"
    click ServicesCtrl "https://github.com/houxxam/inventorymanagementsystem/blob/main/Controllers/ServicesController.cs"
    click LogListCtrl "https://github.com/houxxam/inventorymanagementsystem/blob/main/Controllers/LogListController.cs"
    click MaterielsCtrl "https://github.com/houxxam/inventorymanagementsystem/blob/main/Controllers/MaterielsController.cs"
    click MaterielsApi "https://github.com/houxxam/inventorymanagementsystem/blob/main/Controllers/MaterielsApi.cs"
    click BusinessLogic "https://github.com/houxxam/inventorymanagementsystem/blob/main/Extentions/UserExtention.cs"
    click AppDbContext "https://github.com/houxxam/inventorymanagementsystem/blob/main/Data/AppDbContext.cs"
    click Migrations "https://github.com/houxxam/inventorymanagementsystem/tree/main/Migrations/"
    click Scripts "https://github.com/houxxam/inventorymanagementsystem/blob/main/inventorydatabase.sql"
    click Scripts "https://github.com/houxxam/inventorymanagementsystem/blob/main/trigger.sql"
    click PublishProfiles "https://github.com/houxxam/inventorymanagementsystem/blob/main/Properties/PublishProfiles/FTPProfile.pubxml"
    click PublishProfiles "https://github.com/houxxam/inventorymanagementsystem/blob/main/Properties/PublishProfiles/FolderProfile.pubxml"

    %% Styles
    classDef client fill:#b6e7a7,stroke:#4a7c59,color:#000
    classDef infra fill:#d3d3d3,stroke:#888,color:#000
    classDef server fill:#add8e6,stroke:#217a9e,color:#000
    classDef data fill:#ffd59e,stroke:#d87f03,color:#000
    classDef db fill:#ffa07a,stroke:#d14f1c,color:#000
    classDef scripts fill:#e0bbe4,stroke:#8e44ad,color:#000
```
