# mitate-gengaku/visualflow architecture

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

- Interactive diagram: https://gitdiagram.com/mitate-gengaku/visualflow
- Repository: https://github.com/mitate-gengaku/visualflow

## Overview

##### Main Components
- Frontend Application: Since this is a React/Next.js application, start by showing the overall client-side structure. Include key components such as:
- App Entry (Next.js pages, layout, global styles)
- Flow Feature Module: This is the core of the application. Illustrate components under src/src/features/flow which handle:
- The visual design canvas (ReactFlow integration)
- Node components (workflow-node, job-node, step-node)
- Control components (zoom controls, save/download controls)
- Export functionality (export dialogs, code-block, copy & download operations)
- Configuration and custom handlers (custom source/target handles, initial node/edge configuration)
- Theme Feature Module: Represent the theming system based on files under src/src/features/theme and the theme provider in src/src/components/provider.
- State Management: Include the state stores (under src/src/store and within src/src/features/flow/store) managing the workflow state, connections, edges, nodes, and UI dialogs (export/save data).

##### Relationships and Data Flow
- How the Next.js app acts as the central container, bootstrapping the visual designer.
- How UI components (layout, header, sidebar, etc.) interact with feature components (the flow and theme modules).
- Conversion from visual workflow (UI state) to YAML code, flowing from the ReactFlow components through export utilities and finally to the clipboard/download functionalities.
- Integration of external libraries like ReactFlow as an integral part of the visual flow design component.

##### Architectural Patterns and Design Principles
- Modularity: Different features (flow design, theme switching) are encapsulated in separate directories, which helps in maintaining and swapping modules as needed.

##### Technologies and Dependencies
- Next.js: Indicate the SSR/React-based front end framework forming the app’s backbone.
- ReactFlow: Highlight its role in managing and displaying the visual workflow.
- TypeScript: Mention that the code is strongly typed (as seen in .ts and .tsx files).
- Tailwind CSS and PostCSS: For styling (evident by tailwind.config.ts and globals.css).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Next.js Application (Entry Point)"
        A1("App Layout")
        A2("Page Entry")
        A3("Global Styles")
    end

    subgraph "UI Components (Common UI)"
        B1("Layout Components")
        B2("Icons")
    end

    subgraph "Flow Feature Module (Visual Designer)"
        C1("ReactFlow Integration")
        C2("Node Components")
        C3("Control Components")
        C4("Export Functionality")
        C5("Custom Handles")
        C6("Menu Items")
        C7("Flow Hooks & Configurations")
    end

    subgraph "Theme Feature Module (Theming)"
        D1("Theme Definitions")
        D2("Theme Provider")
    end

    subgraph "State Management"
        E1("Global Store")
        E2("Flow Store")
    end

    subgraph "YAML Export & Conversion"
        F1("YAML Output")
    end

    %% Connections among components (vertical flow)
    A1 --> B1
    A2 --> B1
    A3 --> B1

    B1 --> C1
    B2 --> C1

    C1 --> C2
    C2 --> C3
    C3 --> C4
    C4 --> F1
    C7 --> C4
    C1 --> C5
    C1 --> C6

    C4 --> E2
    C7 --> E2
    E2 --> F1
    E1 --> E2

    B1 --> C7

    D1 --> D2
    D2 --> B1

    %% Click Events
    click A1 "https://github.com/mitate-gengaku/visualflow/blob/main/src/src/app/layout.tsx"
    click A2 "https://github.com/mitate-gengaku/visualflow/blob/main/src/src/app/page.tsx"
    click A3 "https://github.com/mitate-gengaku/visualflow/blob/main/src/src/app/globals.css"
    click B1 "https://github.com/mitate-gengaku/visualflow/tree/main/src/src/components/layout"
    click B2 "https://github.com/mitate-gengaku/visualflow/tree/main/src/src/components/icons"
    click C1 "https://github.com/mitate-gengaku/visualflow/blob/main/src/src/features/flow/components/react-flow.tsx"
    click C2 "https://github.com/mitate-gengaku/visualflow/tree/main/src/src/features/flow/components/node"
    click C3 "https://github.com/mitate-gengaku/visualflow/tree/main/src/src/features/flow/components/controls"
    click C4 "https://github.com/mitate-gengaku/visualflow/tree/main/src/src/features/flow/components/export"
    click C5 "https://github.com/mitate-gengaku/visualflow/tree/main/src/src/features/flow/components/handle"
    click C6 "https://github.com/mitate-gengaku/visualflow/tree/main/src/src/features/flow/components/menu"
    click C7 "https://github.com/mitate-gengaku/visualflow/tree/main/src/src/features/flow/hooks"
    click E1 "https://github.com/mitate-gengaku/visualflow/tree/main/src/src/store"
    click E2 "https://github.com/mitate-gengaku/visualflow/tree/main/src/src/features/flow/store"
    click D1 "https://github.com/mitate-gengaku/visualflow/tree/main/src/src/features/theme"
    click D2 "https://github.com/mitate-gengaku/visualflow/blob/main/src/src/components/provider/theme-provider.tsx"

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef feature fill:#A9DFBF,stroke:#239B56,stroke-width:2px;
    classDef state fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef theme fill:#F5B7B1,stroke:#922B21,stroke-width:2px;
    classDef export fill:#D7BDE2,stroke:#6C3483,stroke-width:2px;

    class A1,A2,A3,B1,B2 frontend;
    class C1,C2,C3,C5,C6,C7 feature;
    class C4,F1 export;
    class E1,E2 state;
    class D1,D2 theme;
```
