# syncfusion/ej2-showcase-js-diagram-builder architecture

> Architecture diagram of the GitHub repository syncfusion/ej2-showcase-js-diagram-builder, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/syncfusion/ej2-showcase-js-diagram-builder
- Repository: https://github.com/syncfusion/ej2-showcase-js-diagram-builder

## Overview

##### Project Type and Purpose
- It provides a visual interface for creating flowcharts, mind maps, org charts, etc., entirely on the client side.
- There is no custom backend; all logic and assets are packaged and served as static files.

##### Main Architectural Components
a. Development & CI/CD
- Source repository (Git) containing code, configs, scripts, and assets.
- Jenkins pipeline (Jenkinsfile) that pulls from Git, runs npm install, build scripts (Gulp/Webpack), and deploys to a static-file host.
- Configuration (config.json) for build or environment settings.
b. Build System
- Gulp (gulpfile.js) for tasks such as preprocessing or copying assets.
- Webpack (webpack.config.js) for bundling all JS modules under /scripts and /src into one or more output bundles.
c. Static Server
- Serves index.html plus the JS/CSS bundles and assets.
- In development, webpack-dev-server or `npm run serve` is used.
d. Client (Browser)
- index.html loads the main bundle.
- Assets: CSS (outlook.css, diagrambuilder.css, styles.css), fonts, images, and JSON template files.

##### Relationships & Data Flow
- Source repo → (push) → Jenkins CI → Build (npm → Gulp/Webpack) → Static hosting.
- Browser requests index.html → loads bundle.js + CSS + assets → instantiates DiagramBuilder.

##### Architectural Patterns & Design Principles
- Single-page application (no page reload).
- Separation of concerns:
- “common” folder for shared utilities and entrypoint (src/common/index.js).
- “home” module for the landing page (src/home).
- assets and JSON templates separated under src/assets.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build & CI/CD
    subgraph "Build & CI/CD"
        direction TB
        GitRepo["Git Repository"]:::build
        JenkinsCI["Jenkins CI"]:::build
        Config["config.json"]:::build
        Gulp["Gulp Tasks"]:::build
        Webpack["Webpack Bundler"]:::build
    end

    %% Hosting
    subgraph "Static Hosting" 
        direction TB
        StaticServer["Static Web Server"]:::hosting
    end

    %% Client Browser & SPA
    subgraph "Client (Browser / SPA)"
        direction TB
        Browser["Browser"]:::client
        DiagramCore["Diagram Builder Core (Syncfusion EJ2)"]:::client
        subgraph "App Modules"
            direction TB
            CommonIndex["Common Utilities"]:::client
            CommonCommands["scripts/commoncommands.js"]:::client
            UtilityMethods["scripts/utilitymethods.js"]:::client
            HomeHTML["src/home/home.html"]:::client
            HomeJS["src/home/home.js"]:::client
            subgraph "Feature Modules"
                direction TB
                Events["scripts/events.js"]:::client
                Palettes["scripts/palettes.js"]:::client
                Themes["scripts/themes.js"]:::client
                ElectricalShapes["scripts/electrical-shapes.js"]:::client
                FloorPlan["scripts/floorplan-shapes.js"]:::client
                NetworkShapes["scripts/network-shapes.js"]:::client
                MindMap["scripts/mindmap.js"]:::client
                OrgChart["scripts/orgchart.js"]:::client
                Pages["scripts/pages.js"]:::client
                CustomProps["scripts/customproperties.js"]:::client
                CustomMenu["scripts/customcontextmenuitems.js"]:::client
                UserHandles["scripts/userhandles.js"]:::client
                Layers["scripts/layers.js"]:::client
                DownloadData["scripts/downloaddata.js"]:::client
                DropdownData["scripts/dropdowndatasource.js"]:::client
                Selector["scripts/selector.js"]:::client
            end
        end
        subgraph "Assets & Templates"
            direction TB
            OutlookCSS["src/assets/css/outlook.css"]:::assets
            BuilderCSS["src/assets/dbstyle/diagrambuilder.css"]:::assets
            StylesCSS["src/assets/styles.css"]:::assets
            Images["src/assets/images/..."]:::assets
            JSONTemplates["JSON Templates"]:::assets
        end
    end

    %% Entry & Dependencies
    GitRepo -->|push| JenkinsCI
    JenkinsCI -->|npm install & build| Gulp
    Gulp --> Webpack
    Webpack -->|deploy static files| StaticServer
    StaticServer -->|serves| Browser
    Browser -->|loads| DiagramCore
    DiagramCore -->|uses| CommonIndex
    Browser -->|retrieves| OutlookCSS
    Browser -->|retrieves| BuilderCSS
    Browser -->|retrieves| StylesCSS
    Browser -->|fetches| JSONTemplates
    Browser -->|loads SPA| HomeHTML
    HomeHTML -->|initializes| HomeJS
    HomeJS -->|interacts with| DiagramCore
    HomeJS -->|uses| CommonCommands
    HomeJS -->|uses| UtilityMethods
    CommonIndex -->|shared utilities| CommonCommands
    CommonIndex -->|shared utilities| UtilityMethods
    DiagramCore -->|events| Events
    DiagramCore -->|palettes| Palettes
    DiagramCore -->|themes| Themes
    DiagramCore -->|shapes| ElectricalShapes
    DiagramCore -->|shapes| FloorPlan
    DiagramCore -->|shapes| NetworkShapes
    DiagramCore -->|features| MindMap
    DiagramCore -->|features| OrgChart
    DiagramCore -->|navigation| Pages
    DiagramCore -->|properties| CustomProps
    DiagramCore -->|context menu| CustomMenu
    DiagramCore -->|handles| UserHandles
    DiagramCore -->|layers| Layers
    DiagramCore -->|export| DownloadData
    DiagramCore -->|data source| DropdownData
    DiagramCore -->|selection| Selector

    %% Click Events
    click GitRepo "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/."
    click JenkinsCI "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/tree/master/Jenkinsfile"
    click Config "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/config.json"
    click Gulp "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/gulpfile.js"
    click Webpack "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/webpack.config.js"
    click HomeHTML "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/src/home/home.html"
    click HomeJS "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/src/home/home.js"
    click CommonIndex "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/src/common/index.js"
    click CommonCommands "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/scripts/commoncommands.js"
    click UtilityMethods "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/scripts/utilitymethods.js"
    click Events "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/scripts/events.js"
    click Palettes "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/scripts/palettes.js"
    click Themes "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/scripts/themes.js"
    click ElectricalShapes "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/scripts/electrical-shapes.js"
    click FloorPlan "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/scripts/floorplan-shapes.js"
    click NetworkShapes "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/scripts/network-shapes.js"
    click MindMap "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/scripts/mindmap.js"
    click OrgChart "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/scripts/orgchart.js"
    click Pages "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/scripts/pages.js"
    click CustomProps "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/scripts/customproperties.js"
    click CustomMenu "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/scripts/customcontextmenuitems.js"
    click UserHandles "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/scripts/userhandles.js"
    click Layers "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/scripts/layers.js"
    click DownloadData "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/scripts/downloaddata.js"
    click DropdownData "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/scripts/dropdowndatasource.js"
    click Selector "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/scripts/selector.js"
    click OutlookCSS "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/src/assets/css/outlook.css"
    click BuilderCSS "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/src/assets/dbstyle/diagrambuilder.css"
    click StylesCSS "https://github.com/syncfusion/ej2-showcase-js-diagram-builder/blob/master/src/assets/styles.css"

    %% Styles
    classDef build fill:#F5A623,stroke:#333,stroke-width:1px
    classDef hosting fill:#7ED321,stroke:#333,stroke-width:1px
    classDef client fill:#4A90E2,stroke:#333,stroke-width:1px
    classDef assets fill:#9B9B9B,stroke:#333,stroke-width:1px
```
