# enzoborgespereira/survey-library architecture

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

- Interactive diagram: https://gitdiagram.com/enzoborgespereira/survey-library
- Repository: https://github.com/enzoborgespereira/survey-library

## Overview

##### Project type and purpose
- This is a monorepo JavaScript/TypeScript library (“SurveyJS Form Library”) designed to render dynamic JSON-based forms in browser applications.
- It provides a central, platform-independent core engine (`survey-core`) plus framework-specific UI adapters/plugins (Angular, React, Vue2/3, Knockout, jQuery).
- It includes build scripts, CI/CD workflows, example apps, and extensive automated tests (unit, functional, end-to-end, visual regression, accessibility).

##### File structure
- Top-level files & directories
- `package.json`, `.github/`, CI files (`azure-pipelines.yml`, GitHub Actions workflows), lint & test configs, build scripts under `build-scripts/`.
- `packages/` folder: each subfolder is a distinct package:
– `survey-core`: the core engine and common styles, localization, themes, expression parser, drag-drop, data model, task manager
– `survey-angular-ui`, `survey-react-ui`, `survey-js-ui`, `survey-vue3-ui`: adapters exposing core as native UI components in each framework
- `examples/`, `e2e/`, `functionalTests/`, `visualRegressionTests/`, `accessibilityTests/`: demonstration & testing suites
- Patterns
- Monorepo with a “core + plugins” architecture
- Component-based (each UI package implements a component library)
- Build pipeline: scripts compile `survey-core` first, then each UI package, bundle with Webpack/Vite, run tests

##### README for additional insights
- The README emphasizes the two-layer architecture: a platform-agnostic core plus native wrappers
- Instructions for building: `npm run build_core`, `npm run build-plugins`, `npm run build`
- Testing: Karma for unit tests, TestCafe/Playwright for end-to-end, snapshots for visual regression

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Core Engine"
        Core["survey-core engine"]:::core
        CoreEntry["entries & webpack"]:::coreDetail
    end

    subgraph "UI Adapters"
        ANG["survey-angular-ui"]:::ui
        REACT["survey-react-ui"]:::ui
        VUE3["survey-vue3-ui"]:::ui
        JSUI["survey-js-ui"]:::ui
        JSUIEntry["entries & index"]:::uiDetail
    end

    subgraph "Build Pipeline"
        BS1["build_core"]:::build
        BS2["build_plugins"]:::build
        BS3["bundle"]:::build
        BS4["test"]:::build
        BS5["publish"]:::build
        WebpackCamel["webpack-camel-name.js"]:::buildDetail
        WebpackDashed["webpack-dashed-name.js"]:::buildDetail
    end

    subgraph "CI/CD - GitHub Actions"
        GH1["node-test.yml"]:::ci
        GH2["node12.yml"]:::ci
        GH3["node14.yml"]:::ci
        GH4["node16.yml"]:::ci
        GH5["node18.yml"]:::ci
        GH6["tagged-release.yml"]:::ci
        ORCH["build-packages.yml"]:::ciDetail
    end

    subgraph "CI/CD - Azure Pipelines"
        AZ1["azure-pipelines.yml"]:::ci
        AZ2["release-azure-pipeline.yml"]:::ci
    end

    subgraph "Examples"
        EX1["angular"]:::examples
        EX2["react"]:::examples
        EX3["vue-ui"]:::examples
        EX4["survey-js-ui"]:::examples
        EX5["jquery-ui"]:::examples
        EX6["knockout"]:::examples
        EX7["vue"]:::examples
    end

    subgraph "Test Suites"
        E2E["e2e/"]:::tests
        FUNC["functionalTests/"]:::tests
        VIS["visualRegressionTests/"]:::tests
        ACC["accessibilityTests/"]:::tests
    end

    EXT["External Services"]:::external

    %% Dependencies
    ANG -->|"depends on"| Core
    REACT -->|"depends on"| Core
    VUE3 -->|"depends on"| Core
    JSUI -->|"depends on"| Core
    JSUI --> JSUIEntry

    Core --> CoreEntry

    %% Build flow
    BS1 -->|"compile core"| Core
    BS2 -->|"compile adapters"| ANG & REACT & VUE3 & JSUI
    BS3 -->|"bundle artifacts"| BS2
    BS4 -->|"run tests on bundles"| BS3
    BS5 -->|"publish packages"| BS4

    WebpackCamel --> BS2
    WebpackDashed --> BS2

    %% CI/CD triggers
    GH1 & GH2 & GH3 & GH4 & GH5 & GH6 -->|"run pipeline"| BS1
    ORCH --> BS1
    AZ1 & AZ2 --> BS1

    %% Examples usage
    EX1 --> ANG
    EX2 --> REACT
    EX3 --> VUE3
    EX4 --> JSUI
    EX5 --> JSUI
    EX6 --> JSUI
    EX7 --> VUE3

    %% Tests against bundles
    E2E & FUNC & VIS & ACC --> BS3

    %% External services at runtime
    EXT --> Core
    EXT --> ANG
    EXT --> REACT
    EXT --> VUE3
    EXT --> JSUI

    %% Click events
    click Core "https://github.com/enzoborgespereira/survey-library/tree/master/packages/survey-core/src"
    click CoreEntry "https://github.com/enzoborgespereira/survey-library/tree/master/packages/survey-core/entries"
    click CoreEntry "https://github.com/enzoborgespereira/survey-library/blob/master/packages/survey-core/webpack.config.js"
    click ANG "https://github.com/enzoborgespereira/survey-library/tree/master/packages/survey-angular-ui/src"
    click REACT "https://github.com/enzoborgespereira/survey-library/tree/master/packages/survey-react-ui/src"
    click VUE3 "https://github.com/enzoborgespereira/survey-library/tree/master/packages/survey-vue3-ui/src"
    click JSUI "https://github.com/enzoborgespereira/survey-library/tree/master/packages/survey-js-ui/entries"
    click JSUI "https://github.com/enzoborgespereira/survey-library/blob/master/packages/survey-js-ui/index.js"
    click WebpackCamel "https://github.com/enzoborgespereira/survey-library/blob/master/build-scripts/webpack-camel-name.js"
    click WebpackDashed "https://github.com/enzoborgespereira/survey-library/blob/master/build-scripts/webpack-dashed-name.js"
    click GH1 "https://github.com/enzoborgespereira/survey-library/blob/master/.github/workflows/node-test.yml"
    click GH2 "https://github.com/enzoborgespereira/survey-library/blob/master/.github/workflows/node12.yml"
    click GH3 "https://github.com/enzoborgespereira/survey-library/blob/master/.github/workflows/node14.yml"
    click GH4 "https://github.com/enzoborgespereira/survey-library/blob/master/.github/workflows/node16.yml"
    click GH5 "https://github.com/enzoborgespereira/survey-library/blob/master/.github/workflows/node18.yml"
    click GH6 "https://github.com/enzoborgespereira/survey-library/blob/master/.github/workflows/tagged-release.yml"
    click ORCH "https://github.com/enzoborgespereira/survey-library/blob/master/build-packages.yml"
    click AZ1 "https://github.com/enzoborgespereira/survey-library/blob/master/azure-pipelines.yml"
    click AZ2 "https://github.com/enzoborgespereira/survey-library/blob/master/release-azure-pipeline.yml"
    click EX1 "https://github.com/enzoborgespereira/survey-library/tree/master/examples/angular"
    click EX2 "https://github.com/enzoborgespereira/survey-library/tree/master/examples/react"
    click EX3 "https://github.com/enzoborgespereira/survey-library/tree/master/examples/vue-ui"
    click EX4 "https://github.com/enzoborgespereira/survey-library/tree/master/examples/survey-js-ui"
    click EX5 "https://github.com/enzoborgespereira/survey-library/tree/master/examples/jquery-ui"
    click EX6 "https://github.com/enzoborgespereira/survey-library/tree/master/examples/knockout"
    click EX7 "https://github.com/enzoborgespereira/survey-library/tree/master/examples/vue"
    click E2E "https://github.com/enzoborgespereira/survey-library/tree/master/e2e/"
    click FUNC "https://github.com/enzoborgespereira/survey-library/tree/master/functionalTests/"
    click VIS "https://github.com/enzoborgespereira/survey-library/tree/master/visualRegressionTests/"
    click ACC "https://github.com/enzoborgespereira/survey-library/tree/master/accessibilityTests/"

    %% Styles
    classDef core fill:#cce5ff,stroke:#004085
    classDef coreDetail fill:#b8daff,stroke:#004085,stroke-dasharray: 5 5
    classDef ui fill:#d4edda,stroke:#155724
    classDef uiDetail fill:#c3e6cb,stroke:#155724,stroke-dasharray: 5 5
    classDef build fill:#fff3cd,stroke:#856404
    classDef buildDetail fill:#ffe8a1,stroke:#856404,stroke-dasharray: 5 5
    classDef ci fill:#f5c6cb,stroke:#721c24
    classDef ciDetail fill:#f1b0b7,stroke:#721c24,stroke-dasharray: 5 5
    classDef examples fill:#e2e3e5,stroke:#6c757d
    classDef tests fill:#e2e3e5,stroke:#6c757d,stroke-dasharray: 2 2
    classDef external fill:none,stroke:#6c757d,stroke-dasharray: 4 2
```
