# fineyh/lowcodeplatform architecture

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

- Interactive diagram: https://gitdiagram.com/fineyh/lowcodeplatform
- Repository: https://github.com/fineyh/lowcodeplatform

## Overview

##### Main Components
- Frontend Application:
– Editor Module: This is the central canvas where users drag, arrange, and preview components (look at src/components/EditCanvas and src/components/ShowCanvas).
– Component List Module: Representing the left panel with a list of available components (found in src/components/ComponentList).
– Config Menu Module: The right panel dedicated to editing component properties (in src/components/ConfigMenu).
– Toolbar Module: Contains various shortcut actions (undo/redo, delete, export, AI generation, etc.), as described in the README.
– AI Generation Module: Integrates with a large language model to generate or transform code based on user input (visible in the usage manual screenshots).
– Views & Routing: Pages like HomePage, PreviewPage, and NotFound defined in src/views and orchestrated by src/router.
– Global Styles & Utilities: Shared assets (CSS/SCSS in assets and configurations) and utility functions (in src/utils) support the app’s look and interactive behavior.
– State Management: Using Pinia (see src/store) to manage the state, including canvas, elements, and publish status.

- Backend (Mock Server):
– JSON Server: The server folder includes a db.json and package.json, which provide the mock API endpoints required by the front-end for data persistence and retrieval.

##### Out the Relationships and Interactions
- The Frontend client interacts with the JSON server via HTTP calls (using APIs in src/http) to retrieve and update page data.
- The editor, component list, and config menu are integrated within the main application layout — typically linked via a routing or a top-level container (App.vue).
- The state management system (Pinia) ties in with the UI components to persist user actions (for drag-and-drop actions, property updates, and tool operations).
- Utility functions (e.g., throttle, deepcopy, useDragger) support front-end interactions and workflow throughout the modules.
- The AI Generation module feeds back into the editor by transforming user inputs into code that instantly renders on the canvas.

##### Architectural Patterns and Design Principles
- Component-Based Design: Clear separation of concerns is visible through distinct Vue or TSX components for different UI parts.
- MVC/MVVM-like Structure: The Views (with .vue files) and the state in Pinia loosely map to model and view-model layers, enabling reactive UI updates.
- Separation of Frontend and Backend: Although using a JSON server, the design keeps the client logic and mock backend independent, preparing the codebase for a potential real backend.

##### Relevant Technologies and Frameworks
- Vue.js, possibly with support for TSX components.
- Pinia for state management.
- Vite as the build tool (vite.config.ts).
- JSON Server as the mock backend.
- CSS/SCSS for styling along with local script patches (such as canvas2image.js).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Section
    subgraph "Frontend"
        %% UI Modules
        subgraph "UI Modules"
            subgraph "Editor Module"
                EC["EditCanvas"]:::frontend
                SC["ShowCanvas"]:::frontend
            end
            CL["Component List"]:::frontend
            CM["Config Menu"]:::frontend
            TB["Toolbar Module"]:::frontend
            AIG["AI Generation Module"]:::frontend
        end

        %% Routing & Views
        subgraph "Routing & Views"
            VP["Views (HomePage,PreviewPage,NotFound)"]:::routing
            RT["Routing (src/router)"]:::routing
        end

        %% Supporting Modules
        subgraph "Supporting Modules"
            GS["Global Styles"]:::utils
            UT["Utilities"]:::utils
            SM["State Management"]:::state
            HA["HTTP API Integration"]:::http
        end
    end

    %% Backend Section
    subgraph "Backend"
        JS["JSON Server"]:::backend
    end

    %% Connections between Frontend UI Modules and Supporting Modules
    EC -->|"calls"| HA
    SC -->|"calls"| HA
    HA -->|"fetch/update"| JS

    EC -->|"updates"| SM
    SC -->|"updates"| SM
    CL -->|"updates"| SM
    CM -->|"updates"| SM
    TB -->|"updates"| SM
    AIG -->|"updates"| SM

    TB -->|"controls"| EC
    TB -->|"triggers"| AIG
    AIG -->|"generates"| EC

    %% Routing connections
    RT -->|"routesTo"| VP
    VP -->|"renders"| EC
    VP -->|"renders"| CL
    VP -->|"renders"| CM
    VP -->|"renders"| TB
    VP -->|"renders"| AIG

    %% Supporting Modules connections to UI Modules
    UT -->|"supports"| EC
    UT -->|"supports"| CL
    UT -->|"supports"| CM
    UT -->|"supports"| TB
    GS -->|"styles"| EC
    GS -->|"styles"| CL
    GS -->|"styles"| CM
    GS -->|"styles"| TB

    %% Click Events
    click EC "https://github.com/fineyh/lowcodeplatform/tree/main/src/components/EditCanvas"
    click SC "https://github.com/fineyh/lowcodeplatform/tree/main/src/components/ShowCanvas"
    click CL "https://github.com/fineyh/lowcodeplatform/tree/main/src/components/ComponentList"
    click CM "https://github.com/fineyh/lowcodeplatform/tree/main/src/components/ConfigMenu"
    click TB "https://github.com/fineyh/lowcodeplatform/blob/main/src/App.vue"
    click VP "https://github.com/fineyh/lowcodeplatform/tree/main/src/views"
    click RT "https://github.com/fineyh/lowcodeplatform/tree/main/src/router"
    click GS "https://github.com/fineyh/lowcodeplatform/tree/main/src/assets"
    click UT "https://github.com/fineyh/lowcodeplatform/tree/main/src/utils"
    click SM "https://github.com/fineyh/lowcodeplatform/tree/main/src/store"
    click HA "https://github.com/fineyh/lowcodeplatform/tree/main/src/http"
    click JS "https://github.com/fineyh/lowcodeplatform/blob/main/server/db.json"

    %% Styles
    classDef frontend fill:#D6EAF8,stroke:#1B4F72,stroke-width:2px;
    classDef routing fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef utils fill:#D5F5E3,stroke:#117864,stroke-width:2px;
    classDef state fill:#FADBD8,stroke:#C0392B,stroke-width:2px;
    classDef http fill:#EBDEF0,stroke:#8E44AD,stroke-width:2px;
    classDef backend fill:#F5B7B1,stroke:#922B21,stroke-width:2px;
```
