# avijan711/pogv4 architecture

> Architecture diagram of the GitHub repository avijan711/pogv4, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/avijan711/pogv4
- Repository: https://github.com/avijan711/pogv4

## Overview

##### Main Components

a) Frontend Layer (React Application):
- Core Components (Dashboard, Navigation)
- Inventory Management Components
- Inquiry Management Components
- Reference Management Components
- File Upload Components
- Supplier Response Components
- Shared Components/Utilities

b) Backend Layer (Node.js Server):
- REST API Routes
- Middleware Layer
- Services Layer
- Models Layer
- Database Queries
- File Processing Utilities

c) Database Layer:
- Inventory Items
- Inquiries
- Supplier Responses
- Reference Changes
- Price History
- Settings
- Promotions

##### Component Relationships

- Client → Server: REST API calls
- Server → Database: Data operations
- File Upload Flow: Client → Server → File Processing → Database
- Reference Change Flow: Multiple entry points (Excel Upload, Supplier Response) → Processing → Database

##### Key Architectural Patterns to Highlight

a) Frontend Architecture:
- React component hierarchy
- Shared components and hooks
- State management flow
- Dialog system architecture

b) Backend Architecture:
- Middleware chain
- Service layer abstraction
- Database access patterns
- File processing pipeline

##### Additional Elements

Supporting elements:
- Version information
- Technology stack list
- Data flow indicators
- Security boundaries
- Error handling paths

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        FE[Frontend Application]
        
        subgraph CoreComponents
            DC["Dashboard"]:::frontend
            NC["Navigation"]:::frontend
        end
        
        subgraph InventoryManagement
            IL["Inventory List"]:::frontend
            ID["Item Details Dialog"]:::frontend
        end
        
        subgraph InquiryManagement
            IQD["Inquiry Dialogs"]:::frontend
            IQT["Inquiry Items Table"]:::frontend
        end
        
        subgraph SupplierComponents
            SR["Supplier Response"]:::frontend
            SRL["Supplier Response List"]:::frontend
        end
        
        SC["Shared Components"]:::frontend
    end
    
    subgraph Server
        API["REST API Layer"]
        
        subgraph Middleware
            EH["Error Handler"]:::backend
            IU["Image Upload"]:::backend
            FU["File Upload"]:::backend
        end
        
        subgraph Services
            PHS["Price History Service"]:::backend
            PS["Promotion Service"]:::backend
            SRS["Supplier Response Service"]:::backend
        end
        
        subgraph Models
            IM["Inquiry Model"]:::backend
            ITM["Item Model"]:::backend
            SM["Supplier Model"]:::backend
        end
        
        subgraph Utils
            EP["Excel Processor"]:::backend
        end
        
        DQ["Database Queries"]:::backend
    end
    
    subgraph Database
        direction TB
        DB[(SQLite Database)]
        
        subgraph Schema
            MT["Migrations"]:::db
            SC1["Schema SQL"]:::db
            ID1["Init Database SQL"]:::db
        end
    end
    
    %% Relationships
    FE --> API
    API --> Middleware
    Middleware --> Services
    Services --> Models
    Models --> DQ
    DQ --> DB
    
    %% Click Events
    click DC "https://github.com/avijan711/POGv4/blob/master/client/src/components/Dashboard.js"
    click NC "https://github.com/avijan711/POGv4/blob/master/client/src/components/Navigation.js"
    click IL "https://github.com/avijan711/POGv4/tree/master/client/src/components/InventoryList"
    click ID "https://github.com/avijan711/POGv4/tree/master/client/src/components/ItemDetailsDialog"
    click IQD "https://github.com/avijan711/POGv4/tree/master/client/src/components/InquiryDialogs"
    click IQT "https://github.com/avijan711/POGv4/tree/master/client/src/components/InquiryItemsTable"
    click SR "https://github.com/avijan711/POGv4/tree/master/client/src/components/SupplierResponse"
    click SRL "https://github.com/avijan711/POGv4/tree/master/client/src/components/SupplierResponseList"
    click SC "https://github.com/avijan711/POGv4/tree/master/client/src/components/shared"
    click EH "https://github.com/avijan711/POGv4/blob/master/server/middleware/errorHandler.js"
    click IU "https://github.com/avijan711/POGv4/blob/master/server/middleware/imageUpload.js"
    click FU "https://github.com/avijan711/POGv4/blob/master/server/middleware/itemFileUpload.js"
    click PHS "https://github.com/avijan711/POGv4/blob/master/server/services/priceHistoryService.js"
    click PS "https://github.com/avijan711/POGv4/blob/master/server/services/promotionService.js"
    click SRS "https://github.com/avijan711/POGv4/blob/master/server/services/supplierResponseService.js"
    click IM "https://github.com/avijan711/POGv4/tree/master/server/models/inquiry"
    click ITM "https://github.com/avijan711/POGv4/blob/master/server/models/item.js"
    click SM "https://github.com/avijan711/POGv4/blob/master/server/models/supplier.js"
    click DQ "https://github.com/avijan711/POGv4/tree/master/server/models/queries"
    click EP "https://github.com/avijan711/POGv4/tree/master/server/utils/excelProcessor"
    click MT "https://github.com/avijan711/POGv4/tree/master/server/migrations"
    click SC1 "https://github.com/avijan711/POGv4/blob/master/server/schema.sql"
    click ID1 "https://github.com/avijan711/POGv4/blob/master/server/init_database.sql"
    
    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef db fill:#f1c40f,stroke:#f39c12,color:black
    
    %% Legend
    subgraph Legend
        F[Frontend]:::frontend
        B[Backend]:::backend
        D[Database]:::db
    end
```
