# wavemaker/wavemaker-ng-runtime architecture

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

- Interactive diagram: https://gitdiagram.com/wavemaker/wavemaker-ng-runtime
- Repository: https://github.com/wavemaker/wavemaker-ng-runtime

## Overview

##### Project Type and Purpose
- The README identifies “WaveMaker” with a focus on “Widgets – API Documentation,” and the file tree contains numerous Angular packages (ng-package.json files, angular.json, etc.) which indicate a UI component/widget framework.
- The project includes modules for “core” functionality, HTTP services, security, runtime integration, mobile adaptations, and even a transpiler. This signals a full-featured, modular UI framework and widget library aimed at both enterprise web and mobile applications.

##### File Structure and Identify Primary Components
- Core Libraries and Services:
- Projects like “projects/core”, “projects/http-service”, “projects/security”, and “projects/variables” house the foundational utilities (constants, services, directives, resolvers, etc.) that other modules rely on.
- Widget Libraries:
- The “projects/components” directory is subdivided into multiple areas (base components, transpile, widgets) and further into specific widget types (advanced, basic, dialogs, navigation, page components, data tables, forms, etc.). These represent the building blocks for constructing the front-end UI.
- Runtime and Mobile Modules:
- Modules under “projects/runtime-base”, “projects/runtime-dynamic”, “projects/runtime”, and “projects/mobile” indicate different runtime integrations as well as support for mobile-specific versions of widgets.
- Build and Configuration Tools:
- Directories such as “build-scripts”, “config”, “documentation”, and files like “angular.json,” “wm-custom-webpack.config.js,” and multiple rollup configuration files suggest an elaborate build/deployment pipeline. They tie together the production of multiple npm packages and manage dependencies.
- Demo or Application Code:
- The “src” directory (with “src/app”, “src/assets”, “src/environments”, etc.) likely includes a demo or sample application that ties these modules together, serving as a testbed or showcase.

##### Establish Relationships and Interactions
- The Core modules provide services (e.g., state management, HTTP, security, utilities) that widgets, runtime modules, and the demonstration app depend on.
- The many widget libraries (basic, advanced, containers, dialogs, input, data, navigation, etc.) are largely independent but share common conventions and possibly common base interfaces from the core.
- Runtime and mobile modules wrap or extend these widget components to enable dynamic loading and platform-specific behavior.
- The build system (Rollup, Webpack configs, and build scripts) orchestrates how each module is packaged (using ng-packager configurations) and assembled into the final distributable products.

##### Architectural Patterns & Technologies
- Modular Architecture: The project is organized as a monorepo with many independent Angular/TypeScript packages, using ng-packages for easy consumption and versioning.
- Layered Architecture: There is a clear separation between infrastructure (build scripts, configuration files), core services/utilities, widget libraries, and runtime/mobile adaptors.
- Dependency Injection & Service-Based Design: Core services (HTTP, security, state persistence) and widget factories indicate common Angular patterns.
- Build/CI Integration: With configuration files for CI (e.g., .gitlab-ci.yml), Rollup configurations, and custom webpack settings, the project emphasizes automated builds and testing.
- Testing: The presence of many “.spec.ts” files suggests unit testing is an integral part of the design.

##### Final Touches

- Build and Configuration Infrastructure
- Core Services and Shared Libraries (e.g., projects/core, HTTP, security, variables)
- Widget/Component Libraries (organized by function: basic, advanced, dialogs, etc.)
- Runtime and Mobile Adaptations (runtime-base, runtime-dynamic, mobile)
- Demo/Application Integration (src/app)

## Diagram (Mermaid)

```mermaid
graph TD
    %% Build and Configuration Infrastructure
    subgraph "Build & Config Tools"
        bs("Build Scripts"):::buildStyle
        cf("Config Files"):::buildStyle
        doc("Documentation"):::buildStyle
        ac("Angular Config"):::buildStyle
        cw("Custom Webpack"):::buildStyle
    end

    %% Core Services & Shared Libraries
    subgraph "Core Services & Shared Libraries"
        core("Core Services"):::coreStyle
        http("HTTP Services"):::coreStyle
        sec("Security Services"):::coreStyle
        var("Variable Services"):::coreStyle
    end

    %% Widget Libraries
    subgraph "Widget Libraries"
        base("Base Components"):::widgetStyle
        transpile("Transpiled Widgets"):::widgetStyle
        advanced("Advanced Widgets"):::widgetStyle
    end

    %% Runtime & Mobile Adaptations
    subgraph "Runtime & Mobile Adaptations"
        runtimeBase("Runtime Base"):::runtimeStyle
        runtimeDynamic("Runtime Dynamic"):::runtimeStyle
        mobile("Mobile Runtime"):::runtimeStyle
        mobileVar("Mobile Variables"):::runtimeStyle
    end

    %% Demo/Application Layer
    subgraph "Demo/Application Layer"
        demo("Demo App"):::demoStyle
    end

    %% Build System dependencies
    bs --> core
    bs --> base
    bs --> runtimeBase
    bs --> demo
    cf --> core
    ac --> demo

    %% Widget Libraries depend on Core Services
    base -->|"depends-on"| core
    transpile -->|"depends-on"| core
    advanced -->|"depends-on"| core

    %% Runtime Modules wrap/extend Widget Libraries
    runtimeBase -->|"wraps"| base
    runtimeDynamic -->|"extends"| advanced
    mobile -->|"integrates"| advanced
    mobileVar -->|"part-of"| mobile

    %% Demo App consumes Core Services, Widget Libraries, and Runtime Modules
    demo -->|"consumes"| core
    demo -->|"consumes"| base
    demo -->|"consumes"| advanced
    demo -->|"integrates"| runtimeBase
    demo -->|"integrates"| mobile

    %% Click Events
    click core "https://github.com/wavemaker/wavemaker-ng-runtime/tree/master/projects/core"
    click http "https://github.com/wavemaker/wavemaker-ng-runtime/tree/master/projects/http-service"
    click sec "https://github.com/wavemaker/wavemaker-ng-runtime/tree/master/projects/security"
    click var "https://github.com/wavemaker/wavemaker-ng-runtime/tree/master/projects/variables"
    click base "https://github.com/wavemaker/wavemaker-ng-runtime/tree/master/projects/components/components/base"
    click transpile "https://github.com/wavemaker/wavemaker-ng-runtime/tree/master/projects/components/transpile"
    click advanced "https://github.com/wavemaker/wavemaker-ng-runtime/tree/master/projects/components/widgets"
    click runtimeBase "https://github.com/wavemaker/wavemaker-ng-runtime/tree/master/projects/runtime-base"
    click runtimeDynamic "https://github.com/wavemaker/wavemaker-ng-runtime/tree/master/projects/runtime-dynamic"
    click mobile "https://github.com/wavemaker/wavemaker-ng-runtime/tree/master/projects/mobile"
    click mobileVar "https://github.com/wavemaker/wavemaker-ng-runtime/tree/master/projects/mobile/variables"
    click bs "https://github.com/wavemaker/wavemaker-ng-runtime/tree/master/build-scripts"
    click cf "https://github.com/wavemaker/wavemaker-ng-runtime/tree/master/config"
    click doc "https://github.com/wavemaker/wavemaker-ng-runtime/tree/master/documentation"
    click ac "https://github.com/wavemaker/wavemaker-ng-runtime/blob/master/angular.json"
    click cw "https://github.com/wavemaker/wavemaker-ng-runtime/blob/master/wm-custom-webpack.config.js"
    click demo "https://github.com/wavemaker/wavemaker-ng-runtime/tree/master/src"

    %% Styles
    classDef buildStyle fill:#f9e79f,stroke:#8e44ad,stroke-width:2px;
    classDef coreStyle fill:#aed6f1,stroke:#2471a3,stroke-width:2px;
    classDef widgetStyle fill:#abebc6,stroke:#239b56,stroke-width:2px;
    classDef runtimeStyle fill:#f9c19c,stroke:#d35400,stroke-width:2px;
    classDef demoStyle fill:#f5b7b1,stroke:#c0392b,stroke-width:2px;
```
