# lljj-x/vue-json-schema-form architecture

> Architecture diagram of the GitHub repository lljj-x/vue-json-schema-form, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lljj-x/vue-json-schema-form
- Repository: https://github.com/lljj-x/vue-json-schema-form

## Overview

##### Project type and purpose
- This is a monorepo (managed by Lerna + Yarn) for “vue-json-schema-form,” a JSON-Schema-driven form generator library targeting Vue2 and Vue3 ecosystems. It contains:
- Core form engine and utilities under `packages/lib`
- Framework-specific adapters (Vue2/Vue3 + multiple UI frameworks) under `packages/lib/vue2` & `packages/lib/vue3`
- Demo applications in `packages/demo` (v1, v2, v3)
- Documentation site under `packages/docs`
- CI/CD workflows in `.github/workflows`
- Root-level config: `package.json`, `lerna.json`, build scripts, .gitignore, etc.

##### File structure
- Top-level directories:
- `packages/lib`: core engine, utils, and UI-framework wrappers
- `packages/demo`: three demo variants (demo-common shared components + three demo apps)
- `packages/docs`: VuePress-based documentation & site assets/plugins
- `packages/demo/demo-v2` & `demo-v3`: Webpack/Vue CLI demo apps for Playground, Schema-generator, Vue-editor
- Build & config files: Babel, PostCSS, ESLint, Vue CLI configs, demo scripts under each demo package
- CI workflows: automated docs deploy, demo build, publishing

##### README for additional insights
- Confirms supported UI frameworks (ElementUI, iView, Element Plus, Antdv, NaiveUI)
- Usage: user supplies JSON Schema → core engine + UI wrappers → rendered Vue form with full validation (AJV)
- Demo commands: `yarn run demo:dev`, entry points for Playground, Schema-generator, Vue-editor

a. Main components
- Core JSON-Schema Form Engine (`packages/lib/utils`, `schema` code)
- Vue2 Adapters (`packages/lib/vue2/vue2-core`)
- Vue2 UI Wrappers
- Element-Ui (`vue2-form-element`)
- Iview3 (`vue2-form-iview3`)
- Vue3 Adapters (`packages/lib/vue3/vue3-core`)
- Vue3 UI Wrappers
- Element-Plus (`vue3-form-element`)
- Antdv (`vue3-form-ant`)
- NaiveUI (`vue3-form-naive`)
- Demo Apps (`packages/demo/*`):
- Playground (index)
- Schema Generator
- H5 Vue-editor
- Docs Site (`packages/docs`): VuePress with custom plugins
- CI/CD Pipeline (.github/workflows)
- External Services: NPM Registry, CDN (EdgeOne)

b. Relationships & interactions
- Core Engine → imported by Vue2/Vue3 adapters
- Adapters + UI wrappers → published as npm packages
- Demo Apps & Docs → import published packages (or local packages during development)
- CI/CD → on commit: run build for lib, run demo build, deploy docs to GitHub Pages, publish packages
- End-users → pull npm packages → integrate into their Vue apps

c. Architectural patterns & design principles
- Monorepo modularization via Lerna: code reuse & isolation of concerns
- Adapter pattern: core engine is UI-agnostic; adapters wrap specific UI library widgets
- Plugin architecture in docs: VuePress custom plugins to demo components
- Single source of truth: JSON Schema defines both UI and validation rules

d. Relevant technologies & frameworks
- Lerna & Yarn Workspaces (monorepo management)
- Vue2 / Vue3
- ElementUI, iView, Element Plus, Ant Design Vue, NaiveUI
- AJV for JSON-Schema validation
- Babel, PostCSS, Webpack / Vue CLI for builds
- VuePress for docs
- GitHub Actions for CI/CD

##### Detailed capturing of architectural elements
- `lerna.json` orchestrating bootstrapping → dependency linking between packages
- Demo scripts under each `demo-v2/scripts/*` invoking Webpack entries
- How VuePress plugins under `packages/docs/.vuepress/plugins` hook into markdown rendering
- Schema flow: JSON Schema → core parser → fields map → renderers → UI components

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Monorepo Root
    root["Monorepo Root\n(lerna.json, configs)"]:::node

    subgraph "packages/lib"
        core["Core JSON-Schema Form Engine"]:::blue
        subgraph "Vue2 Adapters & Wrappers"
            v2core["Vue2 Adapter\n(vue2-core)"]:::blue
            v2el["Vue2 ElementUI Wrapper"]:::blue
            v2iv["Vue2 iView Wrapper"]:::blue
        end
        subgraph "Vue3 Adapters & Wrappers"
            v3core["Vue3 Adapter\n(vue3-core)"]:::blue
            v3el["Vue3 Element Plus Wrapper"]:::blue
            v3ant["Vue3 Ant Design Vue Wrapper"]:::blue
            v3nai["Vue3 Naive UI Wrapper"]:::blue
        end
    end

    subgraph "packages/demo"
        demoCommon["Shared Demo Components\n(demo-common)"]:::green
        demoV2["Demo V2 Application"]:::green
        demoV3["Demo V3 Application"]:::green
    end

    subgraph "packages/docs"
        docsSite["Documentation Site\n(VuePress)"]:::yellow
    end

    ci["CI/CD Workflows"]:::orange
    npm["NPM Registry"]:::cloud
    cdn["CDN (EdgeOne)"]:::cloud
    browser["Browser (End-User)"]:::cloud

    %% Root linking
    root --> core
    root --> demoCommon
    root --> docsSite
    root --> ci

    %% Core to Adapters
    core --> v2core
    core --> v3core

    %% Vue2 chain
    v2core --> v2el
    v2core --> v2iv
    v2el --> npm
    v2iv --> npm
    v2el --> demoV2
    v2iv --> demoV2

    %% Vue3 chain
    v3core --> v3el
    v3core --> v3ant
    v3core --> v3nai
    v3el --> npm
    v3ant --> npm
    v3nai --> npm
    v3el --> demoV3
    v3ant --> demoV3
    v3nai --> demoV3

    %% Demos
    demoCommon --> demoV2
    demoCommon --> demoV3
    demoV2 --> browser
    demoV3 --> browser

    %% Docs
    docsSite --> browser

    %% CI/CD flows
    ci -->|"on push"| core
    ci --> demoV2
    ci --> demoV3
    ci --> docsSite
    ci --> npm
    ci --> cdn

    %% Click Events
    click core "https://github.com/lljj-x/vue-json-schema-form/tree/master/packages/lib/utils"
    click v2core "https://github.com/lljj-x/vue-json-schema-form/tree/master/packages/lib/vue2/vue2-core"
    click v2el "https://github.com/lljj-x/vue-json-schema-form/tree/master/packages/lib/vue2/vue2-form-element"
    click v2iv "https://github.com/lljj-x/vue-json-schema-form/tree/master/packages/lib/vue2/vue2-form-iview3"
    click v3core "https://github.com/lljj-x/vue-json-schema-form/tree/master/packages/lib/vue3/vue3-core"
    click v3el "https://github.com/lljj-x/vue-json-schema-form/tree/master/packages/lib/vue3/vue3-form-element"
    click v3ant "https://github.com/lljj-x/vue-json-schema-form/tree/master/packages/lib/vue3/vue3-form-ant"
    click v3nai "https://github.com/lljj-x/vue-json-schema-form/tree/master/packages/lib/vue3/vue3-form-naive"
    click demoCommon "https://github.com/lljj-x/vue-json-schema-form/tree/master/packages/demo/demo-common"
    click demoV2 "https://github.com/lljj-x/vue-json-schema-form/tree/master/packages/demo/demo-v2"
    click demoV3 "https://github.com/lljj-x/vue-json-schema-form/tree/master/packages/demo/demo-v3"
    click docsSite "https://github.com/lljj-x/vue-json-schema-form/blob/master/packages/docs/docs/.vuepress"
    click ci "https://github.com/lljj-x/vue-json-schema-form/tree/master/.github/workflows"

    %% Styles
    classDef blue fill:#E3F2FD,stroke:#42A5F5
    classDef green fill:#E8F5E9,stroke:#66BB6A
    classDef yellow fill:#FFF9C4,stroke:#FFEE58
    classDef orange fill:#FFE0B2,stroke:#FB8C00
    classDef cloud fill:#E1F5FE,stroke:#81D4FA
    classDef node fill:#F3E5F5,stroke:#AB47BC
```
