# shahparthiv/rh architecture

> Architecture diagram of the GitHub repository shahparthiv/rh, 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/shahparthiv/rh
- Repository: https://github.com/shahparthiv/rh

## Overview

##### Main Components

a) External Interface Layer:
- REST API Controller (IntegrationController)
- YAML Configuration Files
- Client Applications

b) Core Processing Components:
- Integration Engine
- Temporal Server
- Worker Nodes
- Task Queue

c) Workflow Components:
- Workflow Definitions
- Activity Implementations
- Step Executors

**[Client Applications] → [REST API (IntegrationController)] → [YAML Configs]**

**[Integration Engine] ↔ [Temporal Server] ↔ [Task Queue]**

**[Worker Nodes] → [Step Execution Framework]**

##### Step Execution Framework Detail

**[Step Interface]**
- [Authentication Step]
- API Key Auth
- OAuth Auth
- [HTTP Request Step]
- [Data Transformation Step]
- [Action Step]
- Send Email
- Send Slack

##### Important Elements to Highlight

a) Factory Pattern Implementation:
**[StepFactory] → [Step Implementations]**
- AuthenticationFactory
- ActionFactory
- StepFactory

b) Strategy Pattern Implementation:
**[Authentication Strategy]**
- APIKeyAuthentication
- OAuthAuthentication

**[Action Strategy]**
- SendEmailAction
- SendSlackAction

##### Technical Details

- Java 17 requirement
- Spring Boot framework
- Temporal.io integration points
- YAML configuration parsing
- Activity execution flow

##### Specific Implementation Notes

Workflow execution sequence:

##### Infrastructure Components

Supporting infrastructure:
- Temporal Server (Port 8233)
- Application Server (Port 8080)
- Worker Processes
- Configuration Storage

Remember to indicate the scalability aspects, showing how multiple workers can process tasks from the queue and how the system handles concurrent workflow executions.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef api fill:#2196F3,stroke:#1565C0,color:white
    classDef core fill:#4CAF50,stroke:#2E7D32,color:white
    classDef worker fill:#FFC107,stroke:#FFA000,color:black
    classDef config fill:#9E9E9E,stroke:#616161,color:white
    classDef step fill:#FF9800,stroke:#F57C00,color:white
    classDef factory fill:#E91E63,stroke:#C2185B,color:white
    classDef strategy fill:#673AB7,stroke:#512DA8,color:white

    %% Client Layer
    subgraph ClientLayer
        Client["Client Applications"]
        API["REST API Controller"]:::api
        Config["YAML Configuration"]:::config
    end

    %% Core Layer
    subgraph CoreLayer
        Engine["Integration Engine"]:::core
        TemporalServer["Temporal Server"]:::core
        TaskQueue["Task Queue"]:::config
    end

    %% Execution Layer
    subgraph ExecutionLayer
        Worker["Worker Nodes"]:::worker
        Executor["Integration Executor"]:::worker
    end

    %% Step Framework
    subgraph StepFramework
        StepInterface["Step Interface"]:::step
        AuthStep["Authentication Step"]:::step
        HttpStep["HTTP Request Step"]:::step
        DataStep["Data Transform Step"]:::step
        ActionStep["Action Step"]:::step
    end

    %% Factory Pattern
    subgraph FactoryPattern
        StepFactory["Step Factory"]:::factory
        AuthFactory["Authentication Factory"]:::factory
        ActionFactory["Action Factory"]:::factory
    end

    %% Strategy Pattern
    subgraph AuthStrategies
        APIAuth["API Key Auth"]:::strategy
        OAuthAuth["OAuth Auth"]:::strategy
    end

    subgraph ActionStrategies
        EmailAction["Send Email"]:::strategy
        SlackAction["Send Slack"]:::strategy
    end

    %% Relationships
    Client --> API
    API --> Config
    API --> Engine
    Engine <--> TemporalServer
    TemporalServer <--> TaskQueue
    TaskQueue --> Worker
    Worker --> Executor
    Executor --> StepInterface
    
    StepInterface --> AuthStep
    StepInterface --> HttpStep
    StepInterface --> DataStep
    StepInterface --> ActionStep
    
    StepFactory --> AuthFactory
    StepFactory --> ActionFactory
    
    AuthStep --> APIAuth
    AuthStep --> OAuthAuth
    ActionStep --> EmailAction
    ActionStep --> SlackAction

    %% Click events for component mapping
    click API "https://github.com/shahparthiv/rh/blob/main/src/main/java/com/server/controller/IntegrationController.java"
    click Engine "https://github.com/shahparthiv/rh/blob/main/src/main/java/com/server/IntegrationEngine.java"
    click Worker "https://github.com/shahparthiv/rh/tree/main/src/main/java/com/temoral_worker/integration/core"
    click StepInterface "https://github.com/shahparthiv/rh/blob/main/src/main/java/com/temoral_worker/integration/step/Step.java"
    click AuthStep "https://github.com/shahparthiv/rh/blob/main/src/main/java/com/temoral_worker/integration/step/AuthenticationStep.java"
    click HttpStep "https://github.com/shahparthiv/rh/blob/main/src/main/java/com/temoral_worker/integration/step/HttpRequestStep.java"
    click DataStep "https://github.com/shahparthiv/rh/blob/main/src/main/java/com/temoral_worker/integration/step/DataTransformationStep.java"
    click ActionStep "https://github.com/shahparthiv/rh/blob/main/src/main/java/com/temoral_worker/integration/step/ActionStep.java"
    click StepFactory "https://github.com/shahparthiv/rh/blob/main/src/main/java/com/temoral_worker/integration/factory/StepFactory.java"
    click AuthFactory "https://github.com/shahparthiv/rh/blob/main/src/main/java/com/temoral_worker/integration/factory/AuthenticationFactory.java"
    click ActionFactory "https://github.com/shahparthiv/rh/blob/main/src/main/java/com/temoral_worker/integration/factory/ActionFactory.java"
    click APIAuth "https://github.com/shahparthiv/rh/blob/main/src/main/java/com/temoral_worker/integration/strategy/authentication/APIKeyAuthentication.java"
    click OAuthAuth "https://github.com/shahparthiv/rh/blob/main/src/main/java/com/temoral_worker/integration/strategy/authentication/OAuthAuthentication.java"
    click EmailAction "https://github.com/shahparthiv/rh/blob/main/src/main/java/com/temoral_worker/integration/strategy/action/SendEmailAction.java"
    click SlackAction "https://github.com/shahparthiv/rh/blob/main/src/main/java/com/temoral_worker/integration/strategy/action/SendSlackAction.java"
    click Config "https://github.com/shahparthiv/rh/blob/main/src/main/resources/rh/cs.yml"
    click Executor "https://github.com/shahparthiv/rh/blob/main/src/main/java/com/temoral_worker/integration/executor/IntegrationExecutor.java"
```
