# zhaojh329/oui architecture

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

- Interactive diagram: https://gitdiagram.com/zhaojh329/oui
- Repository: https://github.com/zhaojh329/oui

## Overview

- Front-end UI Modules:
– There is a common UI core (“oui-ui-core”) which holds shared Vue3/Element Plus assets (e.g., the “htdoc” directory with package.json, vite.config.js, etc.).
– Additionally, several modular “applications” (such as oui-app-acl, oui-app-backup, oui-app-demo, etc.) each have their own “htdoc” directories containing individual Vue components and pages. They represent discrete pages or features that can be packaged as separate IPK modules.
- Back-end API and RPC Services:
– The “oui-rpc-core” directory holds Lua-based code for API endpoints and RPC services, which are built with Lua-eco.
– Within each application, there are “files” directories (often containing menu.json and subdirectories like “rpc”) that supply Lua scripts (such as acl.lua, demo.lua, etc.) which likely serve as back-end logic or configuration.
- Configuration and System Integration:
– The “libuci-lua-53” module indicates integration with OpenWrt’s UCI system, allowing the framework to interact with native configuration systems.
– Other auxiliary files (like Makefiles, node.mk, version.mk, etc.) drive building and deployment.
- Documentation:
– The “docs” directory is present for developer and user guidance and gives context to how the UI and API interact.

##### Relationships and interactions
– The Front-end is built using Vue3, Element Plus, and Vite. Each modular UI component (from either “oui-ui-core” or individual “oui-app-*” directories) is responsible for the presentation layer.
– The Back-end, developed in Lua using Lua-eco, offers API endpoints via RPC (see “oui-rpc-core” and the rpc scripts in each application).
- How the UI components call the Back-end API:
- Integration with OpenWrt’s UCI system:

##### Architectural patterns and technologies
- Separation of concerns:
– Highlight that front-end and back-end are independently developed—this is underscored by the project’s stated “separation of front-end and backend.”
- Modular design:
– Each “oui-app-*” is a self-contained module that corresponds to a specific feature (e.g., ACL management, DHCP lease, user management, etc.) similar to the modular approach of Luci.
- Technology Stacks:
– For the Front-end: Vue3, Element Plus, and Vite.
– For the Back-end: Lua (with Lua-eco) along with RPC routing logic found in “oui-rpc-core.”
– Integration with OpenWrt configuration via libuci-lua-53.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Front-end UI"
        UI_Core["oui-ui-core (UI Core)"]:::frontend
        subgraph "Modular Applications"
            ACL_App["oui-app-acl"]:::frontend
            Backup_App["oui-app-backup"]:::frontend
            Demo_App["oui-app-demo"]:::frontend
        end
    end

    subgraph "Back-end API / RPC"
        RPC_Core["oui-rpc-core (Back-end API)"]:::backend
        ACL_RPC["oui-app-acl RPC"]:::backend
        Demo_RPC["oui-app-demo RPC"]:::backend
    end

    UCI_Config["libuci-lua-53 (UCI Configuration)"]:::config
    Build["Build/Deployment Support"]:::build
    Docs["Documentation"]:::docs

    %% Front-end to Back-end interactions
    UI_Core -->|"Vue3Rendering"| RPC_Core
    ACL_App -->|"APICall"| RPC_Core
    Backup_App -->|"APICall"| RPC_Core
    Demo_App -->|"APICall"| RPC_Core

    %% Application specific backend RPC calls
    ACL_App -->|"RPCSubcall"| ACL_RPC
    Demo_App -->|"RPCSubcall"| Demo_RPC

    %% Back-end to UCI configuration integration
    RPC_Core -->|"UCIconfigCall"| UCI_Config

    %% Build/Deployment relationships
    Build -->|"Builds"| UI_Core
    Build -->|"Builds"| ACL_App
    Build -->|"Builds"| Backup_App
    Build -->|"Builds"| Demo_App
    Build -->|"Builds"| RPC_Core

    %% Documentation links
    Docs ---|"Documents"| UI_Core
    Docs ---|"Documents"| RPC_Core

    %% Click Events
    click UI_Core "https://github.com/zhaojh329/oui/tree/master/oui-ui-core/htdoc"
    click ACL_App "https://github.com/zhaojh329/oui/tree/master/applications/oui-app-acl/htdoc"
    click Backup_App "https://github.com/zhaojh329/oui/tree/master/applications/oui-app-backup/htdoc"
    click Demo_App "https://github.com/zhaojh329/oui/tree/master/applications/oui-app-demo/htdoc"
    click RPC_Core "https://github.com/zhaojh329/oui/tree/master/oui-rpc-core/files/rpc"
    click ACL_RPC "https://github.com/zhaojh329/oui/blob/master/applications/oui-app-acl/files/rpc/acl.lua"
    click Demo_RPC "https://github.com/zhaojh329/oui/blob/master/applications/oui-app-demo/files/rpc/demo.lua"
    click UCI_Config "https://github.com/zhaojh329/oui/tree/master/libuci-lua-53/src"
    click Docs "https://github.com/zhaojh329/oui/tree/master/docs/"
    click Build "https://github.com/zhaojh329/oui/blob/master/node.mk"

    %% Styling definitions
    classDef frontend fill:#BBDEFB,stroke:#0D47A1,stroke-width:2px;
    classDef backend fill:#C8E6C9,stroke:#1B5E20,stroke-width:2px;
    classDef config fill:#FFCC80,stroke:#E65100,stroke-width:2px;
    classDef build fill:#F8BBD0,stroke:#880E4F,stroke-width:2px;
    classDef docs fill:#D1C4E9,stroke:#311B92,stroke-width:2px;
```
