# arshc0der/inventory-management-system architecture

> Architecture diagram of the GitHub repository arshc0der/inventory-management-system, 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/arshc0der/inventory-management-system
- Repository: https://github.com/arshc0der/inventory-management-system

## Overview

##### Main Components
- User Interface Layer: This is built with Qt and consists of the various UI forms (.ui files) for functionalities like dashboard, registration, product management (add, update, delete), employee management, notifications, and more.
- Business Logic / Application Layer: Represented by the C++ source files (e.g., add_supplier.cpp, addorders.cpp, register.cpp, etc.) that implement the functionality for each module.
- Database Layer: The presence of database files and headers (i_m_s.db, DatabaseManager.h, DatabaseSchema.h) indicates that the system interacts with a local database. This layer manages data persistence and query execution.
- Security and Global Utilities: Global functions (globalfunctions.cpp/h) and SHA-256 based authentication (as noted in the README, though not explicitly in the file names) are key to ensuring data integrity and secure access.

##### Relationships and Interactions
- The UI layer interacts directly with the business logic layer. Each UI form (defined in a .ui file) is connected to a corresponding C++ file that handles events and data flows.
- Business logic modules call upon the database layer through the database manager and schema definitions for reading or updating data.
- Authentication and security modules (coded within global functions or settings classes) ensure that user credentials (using SHA-256) are validated before granting access.
- Notifications and activity tracking likely operate as a cross-cutting concern, with modules broadcasting events to update the dashboard and user interface.

##### Architectural Patterns and Design Principles
- The project follows a structure that is typical for desktop applications with clear separation between UI and core logic. It uses the Model-View approach inherent in Qt development (UI forms as the View, and the C++ classes as the Controller/Model).
- Even though it is a desktop application, the design leans towards the layered architecture pattern—UI / Application Logic / Data Persistence—so be sure to illustrate these layers.

##### Technologies and Frameworks
- Qt C++: Emphasize that all UI components are built with Qt.
- SHA-256: Note the advanced security feature used for credential verification.
- Local Database: The i_m_s.db file implies usage of a SQLite or similar embedded database engine.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    subgraph "User Interface Layer"
        UI1["MainWindow UI"]:::ui
        UI2["Dashboard UI"]:::ui
        UI3["Register UI"]:::ui
        UI4["Add Supplier UI"]:::ui
        UI5["Add Product UI"]:::ui
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        BL1["Add Supplier Module"]:::business
        BL2["Add Product Module"]:::business
        BL3["Add Orders Module"]:::business
        BL4["Add Employee Module"]:::business
        BL5["Manage Activity Module"]:::business
    end

    %% Database Layer
    subgraph "Database Layer"
        DB1["Database Manager"]:::database
        DB2["Database Schema"]:::database
        DB3["Inventory Database"]:::database
    end

    %% Security and Global Utilities
    S1["Global Functions (Security)"]:::security

    %% Resources
    R1["Resources File"]:::resources
    R2["Resources Directory"]:::resources

    %% UI Layer Relationships
    UI1 -->|"navigates to"| UI2
    UI2 -->|"opens"| UI4
    UI2 -->|"triggers"| BL5
    UI3 -->|"authenticates via"| S1
    UI4 -->|"processes"| BL1
    UI5 -->|"processes"| BL2

    %% Business Logic to Database Relationships
    BL1 -->|"queries/upd"| DB1
    BL2 -->|"queries/upd"| DB2
    BL3 -->|"queries/upd"| DB1
    BL4 -->|"queries/upd"| DB1
    BL5 -->|"queries/upd"| DB2

    %% Security Interactions
    S1 -->|"grants access to"| UI2

    %% Resource Dependencies
    R1 -->|"supplies assets to"| UI2
    R2 -->|"supplies assets to"| UI2
    R1 -->|"supplies assets to"| UI4
    R2 -->|"supplies assets to"| UI5

    %% Click Events for User Interface Layer
    click UI1 "https://github.com/arshc0der/inventory-management-system/blob/main/mainwindow.ui"
    click UI2 "https://github.com/arshc0der/inventory-management-system/blob/main/dashboard.ui"
    click UI3 "https://github.com/arshc0der/inventory-management-system/blob/main/register.ui"
    click UI4 "https://github.com/arshc0der/inventory-management-system/blob/main/add_supplier.ui"
    click UI5 "https://github.com/arshc0der/inventory-management-system/blob/main/addproduct.ui"

    %% Click Events for Business Logic Layer
    click BL1 "https://github.com/arshc0der/inventory-management-system/blob/main/add_supplier.cpp"
    click BL2 "https://github.com/arshc0der/inventory-management-system/blob/main/addproduct.cpp"
    click BL3 "https://github.com/arshc0der/inventory-management-system/blob/main/addorders.cpp"
    click BL4 "https://github.com/arshc0der/inventory-management-system/blob/main/addemployee.cpp"
    click BL5 "https://github.com/arshc0der/inventory-management-system/blob/main/manageactivity.cpp"

    %% Click Events for Database Layer
    click DB1 "https://github.com/arshc0der/inventory-management-system/blob/main/DatabaseManager.h"
    click DB2 "https://github.com/arshc0der/inventory-management-system/blob/main/DatabaseSchema.h"
    click DB3 "https://github.com/arshc0der/inventory-management-system/blob/main/i_m_s.db"

    %% Click Event for Security and Global Utilities
    click S1 "https://github.com/arshc0der/inventory-management-system/blob/main/globalfunctions.cpp"

    %% Click Events for Resources
    click R1 "https://github.com/arshc0der/inventory-management-system/blob/main/resources.qrc"
    click R2 "https://github.com/arshc0der/inventory-management-system/tree/main/resources"

    %% Styles
    classDef ui fill:#C8E6C9,stroke:#333,stroke-width:2px;
    classDef business fill:#BBDEFB,stroke:#333,stroke-width:2px;
    classDef database fill:#FFCCBC,stroke:#333,stroke-width:2px;
    classDef security fill:#E1BEE7,stroke:#333,stroke-width:2px;
    classDef resources fill:#FFF9C4,stroke:#333,stroke-width:2px;
```
