# sirajahmed047/integration_hub_v2 architecture

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

- Interactive diagram: https://gitdiagram.com/sirajahmed047/integration_hub_v2
- Repository: https://github.com/sirajahmed047/integration_hub_v2

## Overview

##### Main Components
- Backend API Service:
- Represented by the “api” directory. This contains Python modules categorized into integration-specific APIs (e.g., ApiExcel, ApiWebhook, ApiInvoice, ApiTurbo, etc.), processing modules (excel, excelpro, invoice, utilitybill, webhook), and various utilities.
- This service is responsible for receiving, processing, and transforming input data (from Excel sheets, webhook callbacks, etc.) into a unified format (UDC).
- It also interacts with an S3 component (e.g., via modules like S3Main.py and ExcelProS3.py) to dispatch the data to the IBM Envizi ESG Suite.
- Frontend Web Application:
- Located in the “web” directory, built with Next.js. This component likely provides user interfaces (pages, components, and API proxies) to monitor integrations, configure endpoints, and trigger or review processing steps.
- Data Storage:
- “api/data-store” holds snapshots of JSON files (from excelpro and webhook events) that likely serve as both test data and persistent storage for incoming integrations.
- External Systems and Data Sources:
- These include Excel data exports, webhooks, Turbonomic integrations, invoices, and utility bills. They are the “producers” of data that the Integration Hub receives.
- IBM Envizi ESG Suite (S3 Bucket):
- The final destination for processed, unified data as mentioned in the project’s README. It might be represented as an external server or service that receives the final data payload.
- Deployment/Containerization:
- Dockerfiles included in both “api” and “web” directories along with a variety of scripts for building, pushing, running, and stopping containers. This highlights the containerized deployment architecture.

##### Component Relationships and Data Flow
- Input Data Flow:
- Backend Processing:
- The “api” service component should be centrally positioned. Within it, you might even illustrate sub-components (e.g., Excel Processor, Webhook Processor, Invoice Handler, etc.) to reflect the modular design. Indicate that each processor module (e.g., ApiExcel, ApiWebhook, ApiInvoice, ApiTurbo) receives the external data.
- How processed data flows into service modules that send data to the S3 bucket (via ExcelProS3 or S3Main).
- Frontend Interaction:
- Integration with External Services:
- Optionally, show external management/control planes or monitoring tools if needed.

##### Architectural Patterns and Key Design Principles
- Separation of Concerns:
- The integration-related logic is clearly separated into different API modules (REST endpoints for different types of integrations) and a dedicated frontend UI.
- Microservice-like Modules:
- Within the API, different modules (excel, webhook, invoice, etc.) handle specific integration channels.
- Containerization:
- Dockerfiles and deployment scripts suggest that each major component (API, Web) is containerized, facilitating deployment across various environments.
- Use of Configuration and Utility Libraries:
- The “util” folders and configuration files (common-constants, config utilities) hint at a design that emphasizes modularity and reusability.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "External Data Sources"
        EX1["Excel Files"]:::external
        EX2["Webhook Events"]:::external
        EX3["Turbonomic"]:::external
        EX4["Invoices"]:::external
        EX5["Utility Bills"]:::external
    end

    subgraph "Backend API Service"
        API_Service["Backend API Service"]:::backend
        API_Main["Main Processor (main.py)"]:::backend
        API_Folder["API Modules (src/api/)"]:::backend
        subgraph "API Modules"
            A1["ApiExcel"]:::backend
            A2["ApiWebhook"]:::backend
            A3["ApiInvoice"]:::backend
            A4["ApiTurbo"]:::backend
            A5["ApiUtilityBill"]:::backend
        end
        Data_Storage["Data Storage (JSON snapshots)"]:::storage
        S3_Integration["S3 Integration Module"]:::s3
    end

    Frontend["Frontend Web Application"]:::frontend

    subgraph "Deployment/Containerization"
         API_Docker["API Dockerfile"]:::deployment
         Web_Docker["Web Dockerfile"]:::deployment
         Deploy_Scripts["Deployment Scripts"]:::deployment
    end

    S3_Bucket["IBM Envizi ESG Suite (S3 Bucket)"]:::s3

    %% Data flow from external sources to API modules
    EX1 -->|"sendsData"| A1
    EX2 -->|"sendsData"| A2
    EX3 -->|"sendsData"| A4
    EX4 -->|"sendsData"| A3
    EX5 -->|"sendsData"| A5

    %% Backend API internal processing flow
    API_Service --> API_Main
    API_Service --> API_Folder
    API_Main --> A1
    API_Main --> A2
    API_Main --> A3
    API_Main --> A4
    API_Main --> A5

    %% API modules dispatch data to S3 Integration module
    A1 -->|"dispatchData"| S3_Integration
    A2 -->|"dispatchData"| S3_Integration
    A3 -->|"dispatchData"| S3_Integration
    A4 -->|"dispatchData"| S3_Integration
    A5 -->|"dispatchData"| S3_Integration

    %% API modules storing snapshot data
    A1 -->|"storesData"| Data_Storage
    A2 -->|"storesData"| Data_Storage

    %% S3 Integration sends unified data to IBM Envizi ESG Suite
    S3_Integration -->|"sendsUnifiedData"| S3_Bucket

    %% Frontend interacts bidirectionally with Backend API
    Frontend <-->|"APICalls"| API_Service

    %% Deployment components linked to API and Frontend
    API_Service --- API_Docker
    Frontend --- Web_Docker
    API_Service --- Deploy_Scripts
    Frontend --- Deploy_Scripts

    %% Click Events
    click API_Service "https://github.com/sirajahmed047/integration_hub_v2/tree/hub_v3/api/"
    click API_Main "https://github.com/sirajahmed047/integration_hub_v2/blob/hub_v3/api/src/main.py"
    click API_Folder "https://github.com/sirajahmed047/integration_hub_v2/tree/hub_v3/api/src/api/"
    click Frontend "https://github.com/sirajahmed047/integration_hub_v2/tree/hub_v3/web/"
    click Data_Storage "https://github.com/sirajahmed047/integration_hub_v2/tree/hub_v3/api/data-store/"
    click S3_Integration "https://github.com/sirajahmed047/integration_hub_v2/blob/hub_v3/api/src/s3/S3Main.py"
    click S3_Integration "https://github.com/sirajahmed047/integration_hub_v2/blob/hub_v3/api/src/excelpro/ExcelProS3.py"
    click API_Docker "https://github.com/sirajahmed047/integration_hub_v2/tree/hub_v3/api/Dockerfile"
    click Web_Docker "https://github.com/sirajahmed047/integration_hub_v2/tree/hub_v3/web/Dockerfile"
    click Deploy_Scripts "https://github.com/sirajahmed047/integration_hub_v2/tree/hub_v3/scripts/"

    %% Class Definitions for styling
    classDef external fill:#f9d5e5,stroke:#d3a4ac,stroke-width:2px;
    classDef backend fill:#d2e8ff,stroke:#7b99f2,stroke-width:2px;
    classDef frontend fill:#dfffd6,stroke:#a3d9a5,stroke-width:2px;
    classDef storage fill:#fef1c4,stroke:#e5c07b,stroke-width:2px;
    classDef s3 fill:#ffefd5,stroke:#dcbf8c,stroke-width:2px;
    classDef deployment fill:#e6e6fa,stroke:#b6b6d6,stroke-width:2px;
```
