# liutingyulalala/vue-vben-admin architecture

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

- Interactive diagram: https://gitdiagram.com/liutingyulalala/vue-vben-admin
- Repository: https://github.com/liutingyulalala/vue-vben-admin

## Overview

This project is an advanced Vue 3–based admin template built as a multi‑package monorepo. Its purpose is to offer a middle‑and‑back end UI template with several front‑end “flavors” (using Ant Design, Element, and Naive UI), along with a mock backend API to support development and testing. The readme emphasizes the cutting‑edge technology stack (Vue 3, Vite, TypeScript), theming, internationalization, and dynamic route‑based permission handling.

##### Main Components
- Frontend Applications: In the “apps” directory there are several distinct frontend projects:
– apps/web-antd (using Ant Design components)
– apps/web-ele (using Element UI)
– apps/web-naive (using Naive UI)
- Backend Mock Service: Located in apps/backend-mock, this simulates API endpoints for authentication, system data (departments, menus, roles, etc.), and table operations.
- Internal Tooling & Configurations: The “internal” folder and parts of the “scripts” directory, along with configuration files (Vite, ESLint, Tailwind, etc.), represent the build and deployment infrastructure and developer tooling.
- Documentation: The “docs” folder holds the project’s documentation (using VitePress), which can be shown as an external artifact that serves developers and users of the admin template.

##### Relationships and Interactions
- The monorepo structure (managed using pnpm workspaces and Turbo) connects all these parts. A block showing “Monorepo Build/Dev Tools” might centrally coordinate changes within internal configurations, scripts, and package inter‑dependencies.
- The documentation is generated from source files in the “docs” folder and may reference components from the UI kit and usage examples from the playground.

##### Architectural Patterns and Principles
- Separation of Concerns: You have a clear separation between the UI (several themed frontend applications), service simulation (backend-mock for APIs), and shared presentation/logic layers (packages for UI kit, composables, preferences, etc.).
- Modular Monorepo Design: The project is organized into several packages and independent apps, allowing team members to work on distinct UI frameworks or shared logic modules. Each package is self-contained but inter‑dependent.
- Component‑Based Design: Frontend apps follow component and layout structures with clearly defined modules for routers, stores, views, and adapters.

##### Technologies/Frameworks Highlighted
- Vue 3 and Vite for the frontend.
- TypeScript throughout for type safety.
- Multiple UI frameworks (Ant Design, Element UI, and Naive UI) for different themed applications.
- A mock backend implemented with Node (in apps/backend-mock) supporting API endpoints for authentication, system management, etc.
- Build and developer-tooling integrated via modern monorepo tools (pnpm, Turbo), along with linting (ESLint, Prettier, Stylelint) and testing (Vitest, Playwright).

##### Specific Elements
- Explicitly delineate components such as:
- Frontend UI modules: layouts, router, store, views, adapter, and API modules.
- Backend mock API: endpoints grouped by functionalities (authentication, system, table, etc.).
- DevOps and build pipeline: scripts, internal config, monorepo tools (pnpm, Turbo) along with CI/CD workflows (e.g., GitHub Actions files from .github/workflows).
- Use directional connectors to illustrate data flow (e.g., API requests go from Web apps to backend service; shared libraries are “imported” into the web apps).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Frontend Applications
    subgraph "Frontend Applications"
        F_Ant["Web-antd (Ant Design)"]:::frontend
        F_Ele["Web-ele (Element UI)"]:::frontend
        F_Naive["Web-naive (Naive UI)"]:::frontend
    end

    %% Backend Mock Service
    subgraph "Backend Service"
        Backend["Backend Mock Service"]:::backend
    end

    %% Shared Libraries & Packages
    subgraph "Shared Libraries & Packages"
        Shared_Core["Core Modules (@core)"]:::shared
        Stores["Stores"]:::shared
        Locales["Locales"]:::shared
    end

    %% Internal Tools & Configurations
    subgraph "Internal Tools & Configs"
        Internal["Internal Configs & Scripts"]:::internal
        Monorepo["Monorepo Build/Dev Tools"]:::internal
    end

    %% Documentation
    subgraph "Documentation"
        Docs["Documentation (VitePress)"]:::docs
    end

    %% Relationships: Frontend Apps depend on Shared Libraries and call Backend API
    F_Ant -->|"imports"| Shared_Core
    F_Ele -->|"imports"| Shared_Core
    F_Naive -->|"imports"| Shared_Core

    F_Ant -->|"imports"| Stores
    F_Ele -->|"imports"| Stores
    F_Naive -->|"imports"| Stores

    F_Ant -->|"imports"| Locales
    F_Ele -->|"imports"| Locales
    F_Naive -->|"imports"| Locales

    F_Ant -->|"APIcalls"| Backend
    F_Ele -->|"APIcalls"| Backend
    F_Naive -->|"APIcalls"| Backend

    %% Internal Tools & DevOps support all modules via Monorepo Tools
    Internal -->|"supports"| Monorepo
    Monorepo -->|"syncs"| Shared_Core
    Monorepo -->|"syncs"| Stores
    Monorepo -->|"syncs"| Locales
    Monorepo -->|"syncs"| F_Ant
    Monorepo -->|"syncs"| F_Ele
    Monorepo -->|"syncs"| F_Naive
    Monorepo -->|"syncs"| Backend

    %% Documentation references key modules and frontends for examples and usage
    Docs -->|"references"| Shared_Core
    Docs -->|"references"| Stores
    Docs -->|"references"| Locales
    Docs -->|"references"| F_Ant
    Docs -->|"references"| F_Ele
    Docs -->|"references"| F_Naive

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef shared fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef internal fill:#D3D3D3,stroke:#000,stroke-width:2px;
    classDef docs fill:#FFB6C1,stroke:#000,stroke-width:2px;

    %% Click Events
    click F_Ant "https://github.com/liutingyulalala/vue-vben-admin/tree/main/apps/web-antd"
    click F_Ele "https://github.com/liutingyulalala/vue-vben-admin/tree/main/apps/web-ele"
    click F_Naive "https://github.com/liutingyulalala/vue-vben-admin/tree/main/apps/web-naive"
    click Backend "https://github.com/liutingyulalala/vue-vben-admin/tree/main/apps/backend-mock"
    click Shared_Core "https://github.com/liutingyulalala/vue-vben-admin/tree/main/packages/@core"
    click Stores "https://github.com/liutingyulalala/vue-vben-admin/tree/main/packages/stores"
    click Locales "https://github.com/liutingyulalala/vue-vben-admin/tree/main/packages/locales"
    click Internal "https://github.com/liutingyulalala/vue-vben-admin/tree/main/internal"
    click Docs "https://github.com/liutingyulalala/vue-vben-admin/tree/main/docs"
```
