# fenghao-jun/low_design architecture

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

- Interactive diagram: https://gitdiagram.com/fenghao-jun/low_design
- Repository: https://github.com/fenghao-jun/low_design

## Overview

##### Main Components Identification
- Design Pages (the “design” folder): These house the main entry pages and business pages that end users will interact with. They include components and pages such as “design/pages”, “design/components”, and various UI elements.
- Low-Code Logic Handler (the “design-code” folder, found under “src/design-core” in the file tree): This contains the logic, actions, types, utilities, and rendering setup needed to process low-code commands. It is the central processing unit for events (actions), component registration, and handling the low-code data structure.
- Low-Code Editor (the “design-editor” folder): This is dedicated to editing the low-code content. It includes flow-event handling (for event propagation, context menus, etc.), work-flow configuration (which covers various node types like start, condition, router, etc.), and APIs that interface with the back-end or other services.
- Remote / Extensible Components: The project supports extensibility through remote components by using module federation. This enables non-universal components to be developed in separate repositories (as noted with remote-component and module federation setup in the README) and then integrated into the system.
- Shared Utility/Infrastructure: There are shared assets, styles, hooks, and HTTP utilities that support the entire system. These common utilities are found in directories like “src/utils”, “src/styles”, and configuration files that govern the project setup (webpack/vite configs, env files, etc.).

##### Relationships and Interactions
- The Design Pages rely on the core low-code processing (“design-code”) for business logic and component registration. They call upon the actions and render functionalities to display UI components dynamically.
- The Design Editor interacts with both the low-code core and the design pages. It serves as the interface for configuring workflows, setting up events, and linking UI elements to low-code definitions.
- The remote components are designed to be registered via a centralized registry (see “component-regiter.ts” in design-core) and are dynamically imported in components such as “src/design/components/RemoteComponent/index.vue”. This introduces an external dependency that is abstracted through module federation.
- Common utilities and shared resources are used by all parts of the project to standardize API calls, manage styles, enforce hooks, and perform validations.

##### Architectural Patterns and Design Principles
- Separation of concerns is evident by dividing the project into pages (UI rendering), core low-code logic (action and event handling), and editor functionality (workflow and design editing).
- The system uses component registration for dynamic rendering. The “componentActionCenter” and “component-regiter” utilities indicate a plugin-like architecture.
- Module Federation is applied for remote component integration, ensuring that externally developed UI components can be plugged in seamlessly.
- The design-editor’s decoupling of flow events, node types, and work-flow suggests an event-driven and component-based architecture.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Main Components
    A["Design Pages (Business UI)"]:::design
    SU["Shared Utilities & Infrastructure"]:::shared

    subgraph "Low-Code Core/Logic"
        LC["Low-Code Core/Logic"]:::core
        LC1["Actions & Rendering"]:::core
        LC2["Types"]:::core
        LC3["Utils & Component Registration"]:::core
        LC --> LC1
        LC --> LC2
        LC --> LC3
    end

    subgraph "Low-Code Editor (Workflow & Configuration)"
        LE["Low-Code Editor (Workflow & Configuration)"]:::editor
        LE1["Flow-Event Handling"]:::editor
        LE2["Workflow Node Configuration"]:::editor
        LE3["Editor APIs"]:::editor
        LE --> LE1
        LE --> LE2
        LE --> LE3
    end

    R["Remote Component Integration"]:::remote

    %% Relationships
    A -->|"calls"| LC
    LC -->|"renders"| A
    LE -->|"configures_events"| LC
    LC -->|"registers_components"| R
    LE -->|"imports_remote_components"| R
    SU -->|"provides_functions"| A
    SU -->|"provides_functions"| LC
    SU -->|"provides_functions"| LE

    %% Click Events
    click A "https://github.com/fenghao-jun/low_design/tree/trunk/src/design/pages"
    click LC "https://github.com/fenghao-jun/low_design/tree/trunk/src/design-core"
    click LE "https://github.com/fenghao-jun/low_design/tree/trunk/src/design-editor"
    click R "https://github.com/fenghao-jun/low_design/tree/trunk/src/design/components/RemoteComponent"
    click SU "https://github.com/fenghao-jun/low_design/tree/trunk/src/utils"
    click SU "https://github.com/fenghao-jun/low_design/tree/trunk/src/styles"

    %% Styles
    classDef design fill:#FFCCCC,stroke:#333,stroke-width:2px;
    classDef core fill:#CCE5FF,stroke:#333,stroke-width:2px;
    classDef editor fill:#CCFFCC,stroke:#333,stroke-width:2px;
    classDef remote fill:#FFFFCC,stroke:#333,stroke-width:2px;
    classDef shared fill:#E6E6E6,stroke:#333,stroke-width:2px;
```
