# alekpet/comfyui_custom_nodes_alekpet architecture

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

## Overview

##### Main Components
- Translation Nodes (ArgosTranslateNode, ChatGLMNode, DeepTranslatorNode, GoogleTranslateNode)
- Instruction Nodes (ChatGLM4InstructNode, ChatGLM4InstructMediaNode)
- Image/Media Nodes (PoseNode, PainterNode)
- Extras/Utilities (ExtrasNode, PreviewTextNode, ColorsCorrectNode, HexToHueNode)
- Code Execution/Experimentation (IDENode)
- Supporting Assets: For nodes that have additional resources (e.g., PainterNode and PoseNode), include subcomponents for their assets (JS, CSS, fonts, brushes) and libraries.
- Infrastructure and Dependencies: Highlight the use of configuration files (like config.json), package management (requirements.txt, pyproject.toml) and integration modules (JavaScript frontends, additional libraries in lib folders).

##### Relationships and Interactions
- For nodes like IDENode, indicate bi-directional communication since it can run both Python and JavaScript code dynamically.

##### Architectural Patterns and Design Principles
- Modular/microservices-like design where each node is a self-contained module with its own folder that includes code, configuration, and assets.
- Separation of concerns: the business logic in Python versus the presentation or interactive parts in JavaScript/CSS.
- Reusable components or libraries that are shared among nodes (e.g., the usage of fabric.js in both PainterNode and PoseNode).

##### Technologies and Frameworks
- Python is the primary back-end language for node logic.
- JavaScript, CSS, and additional front-end libraries (e.g., ace-builds and fabric.js) support interactive and UI functionality.
- Configuration management via JSON (config files) and package definition through requirements.txt and pyproject.toml.
- GitHub workflows and CI/CD pipelines (as indicated by the .github/workflows folder) that support auto-publishing/deployment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Component
    Core["ComfyUI Core"]:::core

    %% External APIs
    GoogleAPI["External: googletrans"]:::external
    DeepTranslatorAPI["External: DeepTranslator API"]:::external
    ChatGLMEngine["External: ChatGLM Engine"]:::external
    ArgosEngine["External: Argos Engine"]:::external

    %% Translation Nodes
    subgraph "Translation Nodes"
        ATranslate["ArgosTranslate Node"]:::backend
        ChatGLMTrans["ChatGLM Node"]:::backend
        DeepTrans["DeepTranslator Node"]:::backend
        GoogleTrans["GoogleTranslate Node"]:::backend
    end

    %% Instruct Nodes
    subgraph "Instruct Nodes"
        ChatGLMInstruct["ChatGLM4Instruct Node"]:::backend
        ChatGLMInstructMedia["ChatGLM4InstructMedia Node"]:::backend
    end

    %% Image/Media Nodes
    subgraph "Image/Media Nodes"
        subgraph "Painter Node"
            PainterBackend["Painter Node (Python)"]:::backend
            PainterAssets["Painter Node (UI Assets)"]:::frontend
        end
        subgraph "Pose Node"
            PoseBackend["Pose Node (Python)"]:::backend
            PoseAssets["Pose Node (UI Assets)"]:::frontend
        end
    end

    %% Extras/Utilities Node
    subgraph "Extras Nodes"
        Extras["Extras Node"]:::backend
    end

    %% Code Execution / Experimentation Node
    subgraph "Code Execution Node"
        subgraph "IDENode"
            IDEBackend["IDENode (Python)"]:::backend
            IDEFrontend["IDENode (JavaScript)"]:::frontend
        end
    end

    %% Core Loading Relations
    Core -->|"loads"| ATranslate
    Core -->|"loads"| ChatGLMTrans
    Core -->|"loads"| DeepTrans
    Core -->|"loads"| GoogleTrans
    Core -->|"loads"| ChatGLMInstruct
    Core -->|"loads"| ChatGLMInstructMedia
    Core -->|"loads"| PainterBackend
    Core -->|"loads"| PoseBackend
    Core -->|"loads"| Extras
    Core -->|"loads"| IDEBackend

    %% External API Dependencies for Translation Nodes
    ATranslate -->|"api"| ArgosEngine
    ChatGLMTrans -->|"api"| ChatGLMEngine
    DeepTrans -->|"api"| DeepTranslatorAPI
    GoogleTrans -->|"api"| GoogleAPI

    %% Internal UI Integration for Image/Media Nodes
    PainterBackend <-->|"UI"| PainterAssets
    PoseBackend <-->|"UI"| PoseAssets

    %% Bidirectional Communication in Code Execution Node
    IDEBackend <-->|"bi-directional"| IDEFrontend

    %% Click Events
    click Core "https://github.com/alekpet/comfyui_custom_nodes_alekpet/blob/master/__init__.py"
    click ATranslate "https://github.com/alekpet/comfyui_custom_nodes_alekpet/blob/master/ArgosTranslateNode/argos_translate_node.py"
    click ChatGLMTrans "https://github.com/alekpet/comfyui_custom_nodes_alekpet/blob/master/ChatGLMNode/chatglm_node.py"
    click DeepTrans "https://github.com/alekpet/comfyui_custom_nodes_alekpet/blob/master/DeepTranslatorNode/deep_translator_node.py"
    click GoogleTrans "https://github.com/alekpet/comfyui_custom_nodes_alekpet/blob/master/GoogleTranslateNode/google_translate_node.py"
    click Extras "https://github.com/alekpet/comfyui_custom_nodes_alekpet/blob/master/ExtrasNode/extras_node.py"
    click IDEBackend "https://github.com/alekpet/comfyui_custom_nodes_alekpet/blob/master/IDENode/ide_node.py"
    click PainterBackend "https://github.com/alekpet/comfyui_custom_nodes_alekpet/blob/master/PainterNode/painter_node.py"
    click PoseBackend "https://github.com/alekpet/comfyui_custom_nodes_alekpet/blob/master/PoseNode/pose_node.py"

    %% Styling
    classDef core fill:#1f77b4,stroke:#333,stroke-width:2px,color:#fff
    classDef backend fill:#98df8a,stroke:#333,stroke-width:2px,color:#000
    classDef frontend fill:#ffbb78,stroke:#333,stroke-width:2px,color:#000
    classDef external fill:#ff7f0e,stroke:#333,stroke-width:2px,color:#fff
```
