# highcharts/highcharts-editor architecture

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

- Interactive diagram: https://gitdiagram.com/highcharts/highcharts-editor
- Repository: https://github.com/highcharts/highcharts-editor

## Overview

##### Project Type and Purpose
- This is a client‐side, embeddable chart editor library for Highcharts. It provides a stand‐alone web UI component (no backend needed by default) that can be integrated into frameworks (TinyMCE, CKEditor, WordPress, Electron, etc.) or run as a demo site via a simple Express server.

##### File Structure Analysis
- Top-level:
- src/           — core JavaScript modules, UI widgets, editors, meta definitions, product bundles
- less/          — all UI styles in Less
- views/         — Handlebars templates for the demo server
- integrations/  — example integration code for TinyMCE, CKEditor, WordPress, Electron
- plugins/       — extension hooks (data sources, export formats)
- app/           — standalone demo client (index.html + main.js + jquery-simple-rest)
- bin/           — CLI scripts (Express server launcher, HTTP entry point)
- tools/, gulpfile.js, highed.config.js — build scripts, tasks, configuration
- dictionaries/, localization/ — static data for settings and i18n
- Build outputs (not in tree): dist/ folder with minified JS/CSS bundles after running gulp.

##### README Insights
- It’s entirely client-side, zero-back-end architecture by default.
- Build tasks compile and concatenate src/, less/, templates into single files:
– highcharts-editor.min.js
– highcharts-editor.min.css
– product bundles (with default templates or advanced mode)
- Demo server (bin/www) serves unminified source for development and auto-bakes Less.

##### Main Components
a. Source Modules (src/, less/, templates)
b. Build Pipeline (gulp + tools/*)
c. Distribution Bundles (JS, CSS, product bundles)
d. Demo/Dev Server (Express in bin/www + views/)
e. Embedding Targets (app/, integrations/*)
f. External Dependencies (Highcharts library, FontAwesome, Google Fonts, Highcharts Cloud)
g. Plugins & Extensions (plugins/, dictionaries/, localization/)

##### Relationships and Interactions
- Distribution Bundles feed both the Demo Server (views/ + app/) and Integrations.
- Plugins and dictionaries are loaded at build time (via tools/gen.localization.js, etc.) or at runtime by the editor.
- Demo Server at runtime serves the HTML+bundles; user interacts with UI widgets which emit events processed by core modules and Highcharts API.
- Embedding Targets (WordPress plugin, TinyMCE adaptor) simply include the bundles and call highed.Editor(...) to initialize.

##### Architectural Patterns and Principles
- Modular architecture: UI widgets (core-ui/) separated from core logic (core/), editors (src/editors/) and product templates (src/products/).
- Plugin system: dynamic loading of data sources and export formats.
- Build-time composition: Handlebars templates pulled into product bundles.
- Clear separation of concerns: styling in less/, markup in views/, logic in src/.

##### Technologies and Frameworks
- Node.js + Express (dev server)
- Gulp (build system)
- Handlebars (HTML templating)
- Less (styles)
- jQuery (simple REST client in app/)
- Highcharts (chart rendering)
- FontAwesome, Google Fonts (UI assets)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Source Code
    subgraph "Source Code"
        direction TB
        SRC["src/"]:::source
        CORE_UI["src/core-ui/"]:::source
        CORE_LOGIC["src/core/"]:::source
        EDITORS["src/editors/"]:::source
        PRODUCTS["src/products/"]:::source
        META["src/meta/"]:::source
        UI_HELPERS["src/ui/"]:::source
        LESS["less/"]:::source
        VIEWS["views/"]:::source
        TEMPLATES["templates/"]:::source
        SRC --> CORE_UI
        SRC --> CORE_LOGIC
        SRC --> EDITORS
        SRC --> PRODUCTS
        SRC --> META
        SRC --> UI_HELPERS
    end

    %% Plugins & Static Data
    subgraph "Extensions & Data"
        direction TB
        PLUGINS["plugins/"]:::source
        DICTS["dictionaries/"]:::source
        LOCALE["localization/"]:::source
    end

    %% Build System
    subgraph "Build System"
        direction TB
        GULP["gulpfile.js"]:::build
        CFG["highed.config.js"]:::build
        TOOLS["tools/"]:::build
    end

    %% Distributions
    subgraph "Distribution Bundles"
        direction TB
        JS_BUNDLE["highcharts-editor.min.js"]:::dist
        CSS_BUNDLE["highcharts-editor.min.css"]:::dist
        PRODUCT_BUNDLES["Product Bundles"]:::dist
    end

    %% Runtime Environment
    subgraph "Runtime"
        direction TB
        DEMO_SERVER["Express Dev Server (bin/www)"]:::runtime
        DEMO_TEMPL["Demo Templates (views/)"]:::runtime
        DEMO_APP["Demo Client (app/)"]:::runtime
    end

    %% Integrations
    subgraph "Integrations"
        direction TB
        TINYMCE["TinyMCE Adapter"]:::integr
        CKEDITOR["CKEditor Adapter"]:::integr
        WP_PLUGIN["WordPress Plugin"]:::integr
    end

    %% External Dependencies
    subgraph "External Dependencies"
        direction TB
        HC["Highcharts"]:::external
        FA["FontAwesome"]:::external
        GF["Google Fonts"]:::external
        HCLOUD["Highcharts Cloud"]:::external
    end

    %% Connections
    SRC -->|build→| GULP
    LESS -->|build→| GULP
    VIEWS -->|build→| GULP
    TEMPLATES -->|build→| GULP
    PLUGINS -->|build→| GULP
    DICTS -->|build→| GULP
    LOCALE -->|build→| GULP

    GULP -->|outputs→| JS_BUNDLE
    GULP -->|outputs→| CSS_BUNDLE
    GULP -->|outputs→| PRODUCT_BUNDLES

    JS_BUNDLE -->|serve→| DEMO_SERVER
    CSS_BUNDLE -->|serve→| DEMO_SERVER
    DEMO_SERVER -->|HTTP request→| DEMO_APP
    DEMO_SERVER -->|renders→| DEMO_TEMPL

    JS_BUNDLE -->|embed→| TINYMCE
    JS_BUNDLE -->|embed→| CKEDITOR
    JS_BUNDLE -->|embed→| WP_PLUGIN

    DEMO_APP -->|uses→| HC
    TINYMCE -->|uses→| HC
    CKEDITOR -->|uses→| HC
    WP_PLUGIN -->|uses→| HC

    DEMO_APP -->|loads→| FA
    DEMO_APP -->|loads→| GF

    PRODUCT_BUNDLES -->|optional cloud sync→| HCLOUD

    %% Click Events
    click SRC "https://github.com/highcharts/highcharts-editor/tree/master/src/"
    click CORE_UI "https://github.com/highcharts/highcharts-editor/tree/master/src/core-ui/"
    click CORE_LOGIC "https://github.com/highcharts/highcharts-editor/tree/master/src/core/"
    click EDITORS "https://github.com/highcharts/highcharts-editor/tree/master/src/editors/"
    click PRODUCTS "https://github.com/highcharts/highcharts-editor/tree/master/src/products/"
    click META "https://github.com/highcharts/highcharts-editor/tree/master/src/meta/"
    click UI_HELPERS "https://github.com/highcharts/highcharts-editor/tree/master/src/ui/"
    click LESS "https://github.com/highcharts/highcharts-editor/tree/master/less/"
    click VIEWS "https://github.com/highcharts/highcharts-editor/tree/master/views/"
    click TEMPLATES "https://github.com/highcharts/highcharts-editor/tree/master/templates/"
    click GULP "https://github.com/highcharts/highcharts-editor/blob/master/gulpfile.js"
    click CFG "https://github.com/highcharts/highcharts-editor/blob/master/highed.config.js"
    click TOOLS "https://github.com/highcharts/highcharts-editor/tree/master/tools/"
    click DEMO_SERVER "https://github.com/highcharts/highcharts-editor/tree/master/bin/www"
    click DEMO_APP "https://github.com/highcharts/highcharts-editor/blob/master/app/index.html"
    click TINYMCE "https://github.com/highcharts/highcharts-editor/blob/master/integrations/tinymce.js"
    click CKEDITOR "https://github.com/highcharts/highcharts-editor/blob/master/integrations/ckeditor.js"
    click WP_PLUGIN "https://github.com/highcharts/highcharts-editor/tree/master/integrations/wordpress/highcharts-editor/"

    %% Styles
    classDef source fill:#cce5ff,stroke:#000,stroke-width:1px;
    classDef build fill:#fff2cc,stroke:#000,stroke-width:1px;
    classDef dist fill:#d5f5e3,stroke:#000,stroke-width:1px;
    classDef runtime fill:#eeeeee,stroke:#000,stroke-width:1px;
    classDef integr fill:#e0e0e0,stroke:#000,stroke-width:1px;
    classDef external fill:#f9e79f,stroke:#000,stroke-width:1px;
```
