# workflowbuildersdk/workflowbuilder architecture

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

- Interactive diagram: https://gitdiagram.com/workflowbuildersdk/workflowbuilder
- Repository: https://github.com/workflowbuildersdk/workflowbuilder

## Overview

##### Project type and purpose
- It contains four workspace packages:
- apps/frontend – a React + TypeScript SPA (exposed even as a Web Component).
- apps/frontend-e2e – end-to-end tests.
- apps/types – shared TypeScript definitions.

##### File structure
- Top-level config files (package.json, tsconfig.base.json, pnpm-workspace.yaml, CI/linters).
- apps/ directory with the four packages above.
- In apps/frontend:
- src/app/hooks – custom React hooks for layout, commands, theming, persistence.
- src/app/providers – React context providers (undo/redo, zoom, mouse, translation).
- src/app/i18n – i18next integration and locale files.
- src/app/plugins – plugin adapter code.
- public assets, global.css, Vite config, Dockerfile.
- apps/frontend-e2e uses a test framework (likely Playwright or Cypress) to drive the built frontend.

##### README for additional insights
- The Technical Overview confirms the four-package split and calls out the React frontend as the core.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Monorepo Level
    subgraph "Monorepo Root"
        RootConfigs["Workspace Configs"]:::config
        pkgTypes["apps/types"]:::pkg
        pkgIcons["apps/icons"]:::pkg
        pkgFrontend["apps/frontend"]:::pkg
        pkgE2E["apps/frontend-e2e"]:::pkg
    end

    %% External Dependencies
    ELK["ELK Layout Engine"]:::external
    i18nExt["i18next"]:::external
    ReactExt["React"]:::external
    ReduxExt["Redux Toolkit"]:::external
    PnpmReg["pnpm Registry"]:::external

    %% Frontend Package Details
    subgraph "apps/frontend"
        subgraph "Config Files"
            FEpkgJSON["package.json"]:::config
            FEDocker["Dockerfile"]:::config
            FEVite["vite.config.mts"]:::config
            FEIndex["index.html"]:::config
        end
        subgraph "UI Components"
            UIComp["/src/app/components"]:::frontUI
        end
        subgraph "Feature Modules"
            Features["/src/app/features"]:::features
        end
        subgraph "Custom Hooks (Services)"
            Hooks["/src/app/hooks"]:::hooks
        end
        subgraph "State Management"
            Store["/src/app/store"]:::store
            Slices["/src/app/store/slices"]:::store
            Middleware["/src/app/store/middleware/middleware.ts"]:::store
        end
        subgraph "Context Providers"
            Providers["/src/app/providers"]:::providers
        end
        subgraph "Internationalization"
            I18n["/src/app/i18n"]:::i18n
        end
        subgraph "Plugin Adapter Layer"
            Plugins["/src/app/plugins"]:::plugins
        end
        subgraph "Assets & Styles"
            Assets["src/assets & global.css"]:::assets
        end
    end

    %% E2E Runner
    E2ETest["apps/frontend-e2e"]:::e2e

    %% Browser
    Browser["Browser (User)"]:::browser

    %% Persistence
    LocalStorage["LocalStorage"]:::storage

    %% Relationships - Monorepo
    pkgFrontend -->|imports types| pkgTypes
    pkgFrontend -->|imports icons| pkgIcons
    pkgFrontend -->|build/test from| RootConfigs
    pkgTypes -->|fetched via| PnpmReg
    pkgIcons -->|fetched via| PnpmReg
    pkgFrontend -->|fetched via| PnpmReg
    pkgE2E -->|fetched via| PnpmReg

    %% Frontend to External
    pkgFrontend -->|uses| ELK
    pkgFrontend -->|uses| i18nExt
    pkgFrontend -->|uses| ReactExt
    pkgFrontend -->|uses| ReduxExt

    %% User Flow
    Browser -->|interacts| UIComp
    UIComp -->|calls hooks| Hooks
    Hooks -->|dispatch actions| Store
    Store -->|updates state| UIComp
    Store -->|persists| LocalStorage
    LocalStorage -->|state reload| Store

    %% E2E Flow
    E2ETest -->|HTTP requests| Browser

    %% Click Events
    click RootConfigs "https://github.com/workflowbuildersdk/workflowbuilder/blob/main/package.json"
    click pkgTypes "https://github.com/workflowbuildersdk/workflowbuilder/blob/main/apps/types/package.json"
    click pkgIcons "https://github.com/workflowbuildersdk/workflowbuilder/blob/main/apps/icons/package.json"
    click pkgFrontend "https://github.com/workflowbuildersdk/workflowbuilder/blob/main/apps/frontend/package.json"
    click FEpkgJSON "https://github.com/workflowbuildersdk/workflowbuilder/blob/main/apps/frontend/package.json"
    click FEDocker "https://github.com/workflowbuildersdk/workflowbuilder/tree/main/apps/frontend/Dockerfile"
    click FEVite "https://github.com/workflowbuildersdk/workflowbuilder/blob/main/apps/frontend/vite.config.mts"
    click FEIndex "https://github.com/workflowbuildersdk/workflowbuilder/blob/main/apps/frontend/index.html"
    click UIComp "https://github.com/workflowbuildersdk/workflowbuilder/tree/main/apps/frontend/src/app/components"
    click Features "https://github.com/workflowbuildersdk/workflowbuilder/tree/main/apps/frontend/src/app/features"
    click Hooks "https://github.com/workflowbuildersdk/workflowbuilder/tree/main/apps/frontend/src/app/hooks"
    click Store "https://github.com/workflowbuildersdk/workflowbuilder/tree/main/apps/frontend/src/app/store"
    click Slices "https://github.com/workflowbuildersdk/workflowbuilder/tree/main/apps/frontend/src/app/store/slices"
    click Middleware "https://github.com/workflowbuildersdk/workflowbuilder/blob/main/apps/frontend/src/app/store/middleware/middleware.ts"
    click Providers "https://github.com/workflowbuildersdk/workflowbuilder/tree/main/apps/frontend/src/app/providers"
    click I18n "https://github.com/workflowbuildersdk/workflowbuilder/tree/main/apps/frontend/src/app/i18n"
    click Plugins "https://github.com/workflowbuildersdk/workflowbuilder/tree/main/apps/frontend/src/app/plugins"
    click Assets "https://github.com/workflowbuildersdk/workflowbuilder/blob/main/apps/frontend/src/global.css"

    %% Styles
    classDef pkg fill:#f9f,stroke:#333;
    classDef config fill:#ff9,stroke:#333;
    classDef frontUI fill:#ccf,stroke:#333;
    classDef features fill:#cfc,stroke:#333;
    classDef hooks fill:#cff,stroke:#333;
    classDef store fill:#fcf,stroke:#333;
    classDef providers fill:#ffc,stroke:#333;
    classDef i18n fill:#fcc,stroke:#333;
    classDef plugins fill:#cc9,stroke:#333;
    classDef assets fill:#9cc,stroke:#333;
    classDef external fill:#eee,stroke:#666;
    classDef browser fill:#def,stroke:#333;
    classDef e2e fill:#fed,stroke:#333;
    classDef storage fill:#dfd,stroke:#333;
```
