# mendix/web-widgets architecture

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

- Interactive diagram: https://gitdiagram.com/mendix/web-widgets
- Repository: https://github.com/mendix/web-widgets

## Overview

##### Project type and purpose
- This is an open-source, platform-supported monorepo of reusable web widgets, modules, and shared libraries for the Mendix low-code platform.
- It includes build and release automation, CI/CD pipelines, and dozens of individual widget and module packages.

##### Break down the file structure into high-level components
a.  Monorepo Root & Configuration
–  pnpm-workspace.yaml, turbo.json, GitHub workflows (.github/workflows/*), patches/
–  Houses global scripts, lockfiles, CI/CD, release configuration
b.  Automation Tools
–  automation/run-e2e: orchestrates Playwright/Cypress E2E tests and Docker setups
–  automation/snapshot-generator: generates sample JSON snapshots
–  automation/utils & automation/scripts: helper CLI tools for bumping versions, changelogs, publishing
c.  Shared Libraries & Configs
–  packages/shared: ESLint/Prettier configs, tsconfig presets, shared chart components, plugin kits
d.  Pluggable Widgets
–  packages/pluggableWidgets/*: dozens of individual widget packages (datagrid, chart, dropdown, etc.)
–  Each has its own src/, tests, e2e, build config, and package.json
e.  Mendix Modules
–  packages/modules/*: JavaScript actions, CSS themes, modules bundling for Mendix Classic widgets
f.  Custom Widgets
–  packages/customWidgets/*: specialized widget packages maintained by Mendix
g.  Root Package.json & Tooling
–  Defines engine versions (Node/pnpm), workspace scripts (pnpm start, lint, test)

##### Relationships and data flows
- Shared libraries → imported by pluggableWidgets, modules, customWidgets
- Automation tools → invoke build/test scripts in each package
- CI/CD (GitHub Actions) → triggers lint/test/build/publish across all packages
- Developer workstation → uses pnpm to install, runs pnpm start/test in individual widget folders, interacts with Mendix Studio via MX_PROJECT_PATH
- npm registry or Mendix Marketplace → target for published packages

##### Architectural patterns
- Monorepo with pnpm workspaces + Turborepo for task orchestration
- Plugin architecture: each widget is an isolated plugin package
- Layered modularity: shared libraries at bottom, widgets/modules at mid-layer, automation and CI at top
- Standardized build/test pipelines using TypeScript, ESLint, Prettier, Jest, Playwright/Cypress, Docker

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Monorepo Root & Config"
        A1["pnpm-workspace.yaml"]:::config
        A2["turbo.json"]:::config
        A3[".github/workflows/"]:::config
        A4["patches/"]:::config
        A5["package.json"]:::config
    end

    subgraph "Automation Tools"
        B1["run-e2e"]:::automation
        B2["snapshot-generator"]:::automation
        B3["utils"]:::automation
        B4["scripts"]:::automation
    end

    subgraph "Shared Libraries & Configs"
        C1["packages/shared/"]:::shared
    end

    subgraph "Pluggable Widgets"
        D1["packages/pluggableWidgets/"]:::packages
    end

    subgraph "Mendix Modules"
        E1["packages/modules/"]:::packages
    end

    subgraph "Custom Widgets"
        F1["packages/customWidgets/"]:::packages
    end

    G1["Developer Workstation\n(pnpm install/test,\nMendix Studio)"]:::external
    G2["GitHub Actions"]:::external
    G3["npm Registry\n/Mendix Marketplace"]:::external

    %% Dependencies
    C1 --> D1
    C1 --> E1
    C1 --> F1

    B1 --> D1
    B1 --> E1
    B1 --> F1
    B2 --> D1
    B2 --> E1
    B2 --> F1
    B3 --> D1
    B3 --> E1
    B3 --> F1
    B4 --> D1
    B4 --> E1
    B4 --> F1

    G2 -->|"triggers CI/CD pipeline"| B1
    G2 -->|"triggers CI/CD pipeline"| D1
    G2 -->|"triggers CI/CD pipeline"| E1
    G2 -->|"triggers CI/CD pipeline"| F1
    G2 -->|"publishes packages"| G3

    G1 <-->|"develop/edit/debug"| D1
    G1 <-->|"develop/edit/debug"| E1
    G1 <-->|"develop/edit/debug"| F1

    %% Click Events
    click A1 "https://github.com/mendix/web-widgets/blob/main/pnpm-workspace.yaml"
    click A2 "https://github.com/mendix/web-widgets/blob/main/turbo.json"
    click A3 "https://github.com/mendix/web-widgets/tree/main/.github/workflows/"
    click A4 "https://github.com/mendix/web-widgets/tree/main/patches/"
    click A5 "https://github.com/mendix/web-widgets/blob/main/package.json"
    click B1 "https://github.com/mendix/web-widgets/tree/main/automation/run-e2e/"
    click B2 "https://github.com/mendix/web-widgets/tree/main/automation/snapshot-generator/"
    click B3 "https://github.com/mendix/web-widgets/tree/main/automation/utils/"
    click B4 "https://github.com/mendix/web-widgets/tree/main/automation/scripts/"
    click C1 "https://github.com/mendix/web-widgets/tree/main/packages/shared/"
    click D1 "https://github.com/mendix/web-widgets/tree/main/packages/pluggableWidgets/"
    click E1 "https://github.com/mendix/web-widgets/tree/main/packages/modules/"
    click F1 "https://github.com/mendix/web-widgets/tree/main/packages/customWidgets/"

    %% Styles
    classDef config fill:#DDDDDD,stroke:#888,stroke-width:1px
    classDef automation fill:#BBDEFB,stroke:#888,stroke-width:1px
    classDef shared fill:#C8E6C9,stroke:#888,stroke-width:1px
    classDef packages fill:#FFE0B2,stroke:#888,stroke-width:1px
    classDef external fill:#FFFFFF,stroke:#888,stroke-dasharray:5 5,stroke-width:1px
```
