# airpowerteam/airpower-web architecture

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

- Interactive diagram: https://gitdiagram.com/airpowerteam/airpower-web
- Repository: https://github.com/airpowerteam/airpower-web

## Overview

##### Project type and purpose
- This is **AirPower-Web**, an NPM-publishable **Vue 3 + Element Plus + TypeScript** UI component library and rapid-development scaffolding.
- It bundles a suite of reusable Vue components, custom hooks, decorators, HTTP utilities, and other tooling to accelerate frontend development.

##### File structure
- Top-level build/config files:
- tsconfig.json, vite.config.ts, package.json, eslint.config.js
- Entry point: **src/index.ts** exports everything as a Vue plugin/library.
- Assets: **src/assets** (CSS/SCSS, SVG images)
- UI layer: **src/components** houses all Vue UI components (button, dialog, table, form, etc.)
- Core utilities & services:
- **src/http** (Http client, enums, types)
- **src/feedback**, **src/file**, **src/permission**, **src/validator**, **src/i18n**
- **src/service** (abstract service classes)
- State & data modeling:
- **src/model** (entities, query/request/response models)
- **src/interface** (TypeScript interfaces for payloads, files, trees, users…)
- Custom decorators: **src/decorator** (Form, Model, Search, Table, Field)
- Reusable logic hooks: **src/hooks** (detail, editor, table variants, selector, tree…)
- Configuration/constants: **src/config**, **src/type**, **src/shared**
- Routing helper: **src/router**
- Dialog helpers: **src/dialog**

##### Extract README insights
- Highlights that this library depends on other **@AirPower** packages (Transformer, Enum, i18n, Util)
- Built with Vite, TypeScript, Vue 3, Element Plus
- Designed as a plug-and-play scaffolding toolkit for rapid development

a. Main components
- **Library Entry (src/index.ts)**
- **UI Components**
- **Hooks & Decorators**
- **Core Services & HTTP Layer**
- **Models & Interfaces**
- **Utilities (i18n, feedback, file, permission, validator)**
- **External Dependencies** (AirPower-Transformer, AirPower-Enum, AirPower-i18n, AirPower-Util, Vue 3, Element Plus, Vite)
b. Relationships & data flow
- **Entry Point** → registers **UI Components** & **Utilities** as Vue plugin
- **UI Components** ← use **Hooks**, **Decorators**, **Services**, **Models**, **Utilities**
- **Hooks** → call **HTTP Layer** and **Services** → return **Models/Interfaces**
- **Decorators** ➔ enhance Models & Form components
c. Architectural patterns & principles
- **Modular monorepo-style library**: each feature lives in its own folder
- **Vue plugin pattern**: single entry to install all components/utilities
- **Separation of concerns**: UI vs data layer vs utilities vs decorators/hooks
- **Decorator pattern** for metadata (forms, models, tables)
- **Hook-based composition** for data fetching and state management
d. Key technologies & frameworks
- Vue 3 Composition API, Element Plus UI framework
- TypeScript (strict typing for interfaces/models)
- Vite (build tool)
- NPM packaging

##### Capturing essential detail
- Keep the entry point central—everything figures into or out of **src/index.ts**

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Entry Point
    Entry["Library Entry<br/>src/index.ts"]:::entry

    %% UI Layer
    subgraph "UI Components"
        Components["UI Components<br/>src/components"]:::ui
    end

    %% Logic Layer
    subgraph "Hooks & Services"
        Hooks["Custom Hooks<br/>src/hooks"]:::logic
        Services["Core Services<br/>src/service"]:::logic
    end

    %% HTTP Layer
    HTTP["HTTP Layer<br/>src/http"]:::logic

    %% Metadata Layer
    Decorators["Custom Decorators<br/>src/decorator"]:::meta

    %% Data Layer
    subgraph "Data Models & Interfaces"
        Models["Models<br/>src/model"]:::data
        Interfaces["Interfaces<br/>src/interface"]:::data
    end

    %% Utilities
    subgraph "Utilities"
        I18n["i18n Util<br/>WebI18n.ts"]:::util
        Feedback["Feedback Util<br/>FeedbackUtil.ts"]:::util
        File["File Util<br/>WebFileUtil.ts"]:::util
        Permission["Permission Util<br/>PermissionUtil.ts"]:::util
        Validator["Validator<br/>WebValidator.ts"]:::util
    end

    %% Config & Constants
    subgraph "Config & Shared"
        Config["Config & Constants<br/>src/config"]:::util
        Types["Shared Types<br/>src/type/index.ts"]:::util
        Shared["Shared Helpers<br/>src/shared/index.ts"]:::util
        Enum["Enums<br/>src/enum"]:::util
        Dialog["Dialog Helpers<br/>src/dialog"]:::util
        Router["Router Helper<br/>RouterUtil.ts"]:::util
    end

    %% External Dependencies
    subgraph "External Dependencies"
        Transformer["AirPower-Transformer"]:::external
        EnumExt["AirPower-Enum"]:::external
        i18nExt["AirPower-i18n"]:::external
        UtilExt["AirPower-Util"]:::external
        Vue["Vue 3"]:::external
        Element["Element Plus"]:::external
        Vite["Vite"]:::external
        NPM["NPM"]:::external
    end

    %% Remote APIs
    ExternalAPI["Remote APIs"]:::external

    %% Connections from Entry
    Entry --> Components
    Entry --> Hooks
    Entry --> Decorators
    Entry --> Services
    Entry --> HTTP
    Entry --> Models
    Entry --> Interfaces
    Entry --> I18n
    Entry --> Feedback
    Entry --> File
    Entry --> Permission
    Entry --> Validator
    Entry --> Config
    Entry --> Types
    Entry --> Shared
    Entry --> Enum
    Entry --> Dialog
    Entry --> Router
    Entry --> Transformer
    Entry --> EnumExt
    Entry --> i18nExt
    Entry --> UtilExt
    Entry --> Vue
    Entry --> Element
    Entry --> Vite
    Entry --> NPM

    %% Internal Relationships
    Components --> Hooks
    Components --> Decorators
    Components --> Services
    Components --> Models
    Components --> Interfaces
    Components --> I18n
    Components --> Feedback
    Components --> File
    Components --> Permission
    Components --> Validator

    Hooks --> HTTP
    Hooks --> Services
    Hooks --> Models
    Hooks --> Interfaces
    Hooks --> Shared

    Services --> HTTP
    Services --> Models
    Services --> Interfaces

    HTTP --> ExternalAPI

    Decorators --> Models

    %% Click Events
    click Entry "https://github.com/airpowerteam/airpower-web/blob/main/src/index.ts"
    click Components "https://github.com/airpowerteam/airpower-web/tree/main/src/components"
    click Hooks "https://github.com/airpowerteam/airpower-web/tree/main/src/hooks"
    click Decorators "https://github.com/airpowerteam/airpower-web/tree/main/src/decorator"
    click Services "https://github.com/airpowerteam/airpower-web/tree/main/src/service"
    click HTTP "https://github.com/airpowerteam/airpower-web/tree/main/src/http"
    click Models "https://github.com/airpowerteam/airpower-web/tree/main/src/model"
    click Interfaces "https://github.com/airpowerteam/airpower-web/tree/main/src/interface"
    click I18n "https://github.com/airpowerteam/airpower-web/blob/main/src/i18n/WebI18n.ts"
    click Feedback "https://github.com/airpowerteam/airpower-web/blob/main/src/feedback/FeedbackUtil.ts"
    click File "https://github.com/airpowerteam/airpower-web/blob/main/src/file/WebFileUtil.ts"
    click Permission "https://github.com/airpowerteam/airpower-web/blob/main/src/permission/PermissionUtil.ts"
    click Validator "https://github.com/airpowerteam/airpower-web/blob/main/src/validator/WebValidator.ts"
    click Config "https://github.com/airpowerteam/airpower-web/tree/main/src/config"
    click Types "https://github.com/airpowerteam/airpower-web/blob/main/src/type/index.ts"
    click Shared "https://github.com/airpowerteam/airpower-web/blob/main/src/shared/index.ts"
    click Enum "https://github.com/airpowerteam/airpower-web/tree/main/src/enum"
    click Dialog "https://github.com/airpowerteam/airpower-web/tree/main/src/dialog"
    click Router "https://github.com/airpowerteam/airpower-web/blob/main/src/router/RouterUtil.ts"

    %% Styles
    classDef entry fill:#f9f,stroke:#333,stroke-width:1px
    classDef ui fill:#ffdddd,stroke:#333,stroke-width:1px
    classDef logic fill:#ddffdd,stroke:#333,stroke-width:1px
    classDef meta fill:#ddddff,stroke:#333,stroke-width:1px
    classDef data fill:#ffffdd,stroke:#333,stroke-width:1px
    classDef util fill:#ddffff,stroke:#333,stroke-width:1px
    classDef external fill:#eeeeee,stroke:#666,stroke-width:1px,stroke-dasharray: 5 5
```
