# busy-cloud/boat-ui architecture

> Architecture diagram of the GitHub repository busy-cloud/boat-ui, 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/busy-cloud/boat-ui
- Repository: https://github.com/busy-cloud/boat-ui

## Overview

##### Project Type and Purpose
- boat-ui appears to be a full-stack web application that focuses on delivering a rich user interface. The structure suggests an Angular-based frontend with multiple UI feature modules (such as admin, dash, login, page, setting, and several reusable “smart-” UI components) along with a Go-based backend (indicated by the main.go, go.mod, and go.sum files).
- The distribution of prebuilt static assets (in the dist/browser folder) and the presence of configurations like angular.json and proxy.conf.json imply that the frontend is built with Angular and bundled via Node tooling, while the backend (written in Go) may serve APIs and static files.

##### Main Architectural Components
a. Frontend Application:
- Angular Application – this forms the core UI and is structured under the “src” directory.
○ Feature Modules: admin, dash, login, page, setting, etc.
○ Reusable Components & Libraries: smart-editor, smart-table, smart-toolbar, smart-info in the “src/app/lib” folder.
○ Template Components: various templates for amap, chart, form, info, markdown, statistic, and table.
○ Configuration & Build Artifacts: Angular’s configuration files (angular.json, tsconfig, package.json) and build output in “dist/”.

b. Backend Service:
- Go Backend – evidenced by main.go, go.mod, and go.sum, which likely implement API endpoints and possibly serve static assets. Although details are minimal, it’s important to represent this as the service that the Angular frontend communicates with.

c. Supporting/Configuration Components:
- Node Environment – package.json and package-lock.json indicate dependency and build management for the frontend.
- Proxy Configuration – proxy.conf.json indicates that during development, API calls from the Angular app are proxied to the Go backend.
- Public Assets – the “public” folder might contain files served directly (or for development testing) which could be part of the static content served by the backend.
- Distribution / Build Process – the “dist/” directory should be shown as the output artifact of the build process (with assets, index.html, and bundled JavaScript).

##### Relationships and Interactions
1. The Client Layer (Angular Frontend):
- Represents the browser, where the Angular application loads its components.
- Interactions between different Angular modules (admin, dash, login, etc.) as internal subdivisions.
- Modular nature with reusable smart components (smart-editor, etc.) and the template pages.
2. The Server Layer (Go Backend):
- Represents API endpoints, static file serving (from the “dist/” folder), and possibly other backend-specific logic.
- The Node Build Process:
- Build tooling (Node, Angular CLI) that converts the “src” code into the build output in the “dist/” directory.
- Configurations and package management as part of the supporting infrastructure.
- Data Flow:
- A proxy intermediary (if needed) to illustrate how proxy.conf.json redirects calls during development.

##### Architectural Patterns and Technologies
- MVC (Component-based UI): The Angular application’s structure with separate components, modules, services, and templates may follow a component-based design pattern.
- Separation of Concerns: Frontend (Angular) is clearly separated from the backend (Go). The build and deployment process distinguishes static assets from API logic.
- Use of Micro-frontends (if applicable): Though not explicitly segmented, the existence of many distinct feature modules suggests a modular design for UI development.
- Key Technologies: Angular (with TypeScript), Node (for dependency and build management), Go for server-side operations, and standard web technologies (HTML, CSS/SCSS, and JavaScript).

## Diagram (Mermaid)

```mermaid
flowchart TD 
    subgraph "Client (Angular Frontend)"
        AngularApp["Angular Application"]:::frontend

        subgraph "Feature Modules"
            AdminModule["Admin Module"]:::feature
            DashModule["Dash Module"]:::feature
            LoginModule["Login Module"]:::feature
            PageModule["Page Module"]:::feature
            SettingModule["Setting Module"]:::feature
            UnknownModule["Unknown Module"]:::feature
        end

        subgraph "Reusable Components & Libraries"
            SmartEditor["Smart Editor"]:::library
            SmartInfo["Smart Info"]:::library
            SmartTable["Smart Table"]:::library
            SmartToolbar["Smart Toolbar"]:::library
            SharedService["Shared Service"]:::library
            UtilityFuncs["Utility Functions"]:::library
        end

        subgraph "Template Components"
            AmapTemplate["Amap Template"]:::template
            ChartTemplate["Chart Template"]:::template
            FormTemplate["Form Template"]:::template
            InfoTemplate["Info Template"]:::template
            MarkdownTemplate["Markdown Template"]:::template
            StatisticTemplate["Statistic Template"]:::template
            TableTemplate["Table Template"]:::template
            BaseTemplates["Base Template Files"]:::template
        end

        subgraph "Build & Assets"
            StaticAssets["Prebuilt Static Assets (Assets)"]:::assets
            FillIcons["Fill Icons"]:::assets
            OutlineIcons["Outline Icons"]:::assets
            TwotoneIcons["Twotone Icons"]:::assets
            Configuration["Angular Config & Build Artifacts"]:::config
            ProxyConfig["Proxy Config (proxy.conf.json)"]:::config
            BuildOutput["Build Output (dist)"]:::assets
            PublicAssets["Public Assets"]:::config
        end
    end

    subgraph "Server (Go Backend)"
        GoMain["Go Main Application"]:::backend
        GoModules["Go Modules"]:::backend
    end

    %% Relationships within Client
    AngularApp -->|"includes"| AdminModule
    AngularApp -->|"includes"| DashModule
    AngularApp -->|"includes"| LoginModule
    AngularApp -->|"includes"| PageModule
    AngularApp -->|"includes"| SettingModule
    AngularApp -->|"includes"| UnknownModule

    AngularApp -->|"utilizes"| SmartEditor
    AngularApp -->|"utilizes"| SmartInfo
    AngularApp -->|"utilizes"| SmartTable
    AngularApp -->|"utilizes"| SmartToolbar
    AngularApp -->|"uses"| SharedService
    AngularApp -->|"uses"| UtilityFuncs

    AngularApp -->|"composes"| AmapTemplate
    AngularApp -->|"composes"| ChartTemplate
    AngularApp -->|"composes"| FormTemplate
    AngularApp -->|"composes"| InfoTemplate
    AngularApp -->|"composes"| MarkdownTemplate
    AngularApp -->|"composes"| StatisticTemplate
    AngularApp -->|"composes"| TableTemplate
    AngularApp -->|"composes"| BaseTemplates

    Configuration -->|"builds"| BuildOutput
    StaticAssets --> FillIcons
    StaticAssets --> OutlineIcons
    StaticAssets --> TwotoneIcons

    %% API & Asset Serving Flow
    SharedService -->|"REST_API"| ProxyConfig
    ProxyConfig -->|"forwards"| GoMain
    BuildOutput -->|"served_by"| GoMain

    %% Styles
    classDef frontend fill:#bbdefb,stroke:#0d47a1,stroke-width:2px;
    classDef feature fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px;
    classDef library fill:#f8bbd0,stroke:#ad1457,stroke-width:2px;
    classDef template fill:#fff9c4,stroke:#f9a825,stroke-width:2px;
    classDef assets fill:#d1c4e9,stroke:#512da8,stroke-width:2px;
    classDef config fill:#ffe0b2,stroke:#ef6c00,stroke-width:2px;
    classDef backend fill:#ffcdd2,stroke:#c62828,stroke-width:2px;

    %% Click Events
    click AngularApp "https://github.com/busy-cloud/boat-ui/tree/main/src"
    click AdminModule "https://github.com/busy-cloud/boat-ui/tree/main/src/app/admin"
    click DashModule "https://github.com/busy-cloud/boat-ui/tree/main/src/app/dash"
    click LoginModule "https://github.com/busy-cloud/boat-ui/tree/main/src/app/login"
    click PageModule "https://github.com/busy-cloud/boat-ui/tree/main/src/app/page"
    click SettingModule "https://github.com/busy-cloud/boat-ui/tree/main/src/app/setting"
    click UnknownModule "https://github.com/busy-cloud/boat-ui/tree/main/src/app/unknown"

    click SmartEditor "https://github.com/busy-cloud/boat-ui/tree/main/src/app/lib/smart-editor"
    click SmartInfo "https://github.com/busy-cloud/boat-ui/tree/main/src/app/lib/smart-info"
    click SmartTable "https://github.com/busy-cloud/boat-ui/tree/main/src/app/lib/smart-table"
    click SmartToolbar "https://github.com/busy-cloud/boat-ui/tree/main/src/app/lib/smart-toolbar"
    click SharedService "https://github.com/busy-cloud/boat-ui/blob/main/src/app/lib/smart-request.service.ts"
    click UtilityFuncs "https://github.com/busy-cloud/boat-ui/blob/main/src/app/lib/utils.ts"

    click AmapTemplate "https://github.com/busy-cloud/boat-ui/tree/main/src/app/template/amap"
    click ChartTemplate "https://github.com/busy-cloud/boat-ui/tree/main/src/app/template/chart"
    click FormTemplate "https://github.com/busy-cloud/boat-ui/tree/main/src/app/template/form"
    click InfoTemplate "https://github.com/busy-cloud/boat-ui/tree/main/src/app/template/info"
    click MarkdownTemplate "https://github.com/busy-cloud/boat-ui/tree/main/src/app/template/markdown"
    click StatisticTemplate "https://github.com/busy-cloud/boat-ui/tree/main/src/app/template/statistic"
    click TableTemplate "https://github.com/busy-cloud/boat-ui/tree/main/src/app/template/table"
    click BaseTemplates "https://github.com/busy-cloud/boat-ui/blob/main/src/app/template/template-base.component.ts"
    click BaseTemplates "https://github.com/busy-cloud/boat-ui/blob/main/src/app/template/template.ts"

    click StaticAssets "https://github.com/busy-cloud/boat-ui/tree/main/dist/browser/assets"
    click FillIcons "https://github.com/busy-cloud/boat-ui/tree/main/dist/browser/assets/fill"
    click OutlineIcons "https://github.com/busy-cloud/boat-ui/tree/main/dist/browser/assets/outline"
    click TwotoneIcons "https://github.com/busy-cloud/boat-ui/tree/main/dist/browser/assets/twotone"

    click GoMain "https://github.com/busy-cloud/boat-ui/blob/main/main.go"
    click GoModules "https://github.com/busy-cloud/boat-ui/blob/main/go.mod"
    click GoModules "https://github.com/busy-cloud/boat-ui/blob/main/go.sum"

    click Configuration "https://github.com/busy-cloud/boat-ui/blob/main/angular.json"
    click Configuration "https://github.com/busy-cloud/boat-ui/blob/main/tsconfig.app.json"
    click Configuration "https://github.com/busy-cloud/boat-ui/blob/main/tsconfig.json"
    click Configuration "https://github.com/busy-cloud/boat-ui/blob/main/tsconfig.spec.json"
    click Configuration "https://github.com/busy-cloud/boat-ui/blob/main/proxy.conf.json"
    click Configuration "https://github.com/busy-cloud/boat-ui/blob/main/package.json"
    click Configuration "https://github.com/busy-cloud/boat-ui/blob/main/package-lock.json"
    click BuildOutput "https://github.com/busy-cloud/boat-ui/tree/main/dist"
    click PublicAssets "https://github.com/busy-cloud/boat-ui/tree/main/public"
```
