# lollipopkit/flutter_server_box architecture

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

- Interactive diagram: https://gitdiagram.com/lollipopkit/flutter_server_box
- Repository: https://github.com/lollipopkit/flutter_server_box

## Overview

##### Main Components Identification

a) Client-side Components:
- Flutter Mobile/Desktop Applications (iOS, Android, macOS, Windows, Linux)
- Watch OS App
- Home Widgets
- Platform-specific Features (Bio auth, Push notifications)

b) Server-side Components:
- Linux Servers (monitored targets)
- ServerBoxMonitor daemon
- SSH/SFTP Services
- Docker Containers
- System Services (systemd)

**┌─ Client Layer ──────────────────────────┐**
- ┌─ UI Layer ─────┐  ┌─ Features ─────┐ │
- Status Charts │  │- Bio Auth      │ │
- SSH Terminal  │  │- Push Messages │ │
- SFTP Browser │  │- Home Widgets  │ │
- Docker UI    │  │- Watch App     │ │
- ┘  └────────────────┘ │
- ┌─ Core Services ──────────────────────┤
- SSH/SFTP Client                     │
- Status Monitoring                   │
- Docker Management                   │
- Authentication                      │
- ┘ │
- ┘

**┌─ Communication Layer ─────────────────┐**
- SSH Protocol                         │
- SFTP Protocol                        │
- Push Notification Services           │
- ┘

**┌─ Server Layer ───────────────────────┐**
- ┌─ ServerBoxMonitor ─┐ ┌─ Services ┐ │
- Status Collector  │ │- SSH      │ │
- Metrics Monitor   │ │- Docker   │ │
- Push Service      │ │- Systemd  │ │
- ┘ └───────────┘  │
- ┘

##### Data Flow Indicators

- Bidirectional communication between client and server
- Data flow for status monitoring
- Authentication flows
- Push notification paths

##### Component Details

Annotations for:
- Supported platforms (iOS, Android, macOS, Windows, Linux)
- Key features (Status monitoring, SSH, SFTP, Docker management)
- Authentication methods
- Localization support (multiple languages)

##### Integration Points

Connections with:
- ServerBoxMonitor daemon
- Docker API
- System services
- Push notification services
- Biometric authentication services

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Layer"]
        subgraph UI["UI Components"]
            Charts["Status Charts"]:::ui
            Terminal["SSH Terminal"]:::ui
            SFTP["SFTP Browser"]:::ui
            DockerUI["Docker UI"]:::ui
        end

        subgraph Features["Platform Features"]
            Watch["Watch OS App"]:::feature
            Widgets["Home Widgets"]:::feature
            Bio["Bio Auth"]:::feature
            Push["Push Messages"]:::feature
        end

        subgraph Core["Core Services"]
            SSH["SSH/SFTP Client"]:::core
            Monitor["Status Monitoring"]:::core
            Docker["Docker Management"]:::core
            Auth["Authentication"]:::core
        end

        subgraph Architecture["Core Architecture"]
            App["App Entry"]:::arch
            Route["Routing"]:::arch
            Provider["Data Providers"]:::arch
            State["State Management"]:::arch
        end
    end

    subgraph Comm["Communication Layer"]
        SSHProto["SSH Protocol"]:::comm
        SFTPProto["SFTP Protocol"]:::comm
        PushService["Push Notification Services"]:::comm
    end

    subgraph Server["Server Layer"]
        subgraph BoxMonitor["ServerBoxMonitor"]
            Status["Status Collector"]:::server
            Metrics["Metrics Monitor"]:::server
            PushServer["Push Service"]:::server
        end

        subgraph Services["System Services"]
            SSHd["SSH Service"]:::service
            DockerSvc["Docker Service"]:::service
            Systemd["Systemd"]:::service
        end
    end

    %% Relationships
    UI --> Core
    Features --> Core
    Core --> Comm
    Comm --> BoxMonitor
    Comm --> Services
    BoxMonitor --> Services

    %% Click Events
    click Watch "https://github.com/lollipopkit/flutter_server_box/tree/main/ios/WatchApp/"
    click Widgets "https://github.com/lollipopkit/flutter_server_box/tree/main/android/app/src/main/kotlin/tech/lolli/toolbox/widget/"
    click SSH "https://github.com/lollipopkit/flutter_server_box/tree/main/lib/data/model/ssh/"
    click SFTP "https://github.com/lollipopkit/flutter_server_box/tree/main/lib/data/model/sftp/"
    click Monitor "https://github.com/lollipopkit/flutter_server_box/tree/main/lib/data/model/server/"
    click Docker "https://github.com/lollipopkit/flutter_server_box/tree/main/lib/data/model/container/"
    click Auth "https://github.com/lollipopkit/flutter_server_box/blob/main/lib/core/utils/ssh_auth.dart"
    click Charts "https://github.com/lollipopkit/flutter_server_box/tree/main/lib/view/page/server/detail/"
    click Terminal "https://github.com/lollipopkit/flutter_server_box/tree/main/lib/view/page/ssh/"
    click SFTP "https://github.com/lollipopkit/flutter_server_box/blob/main/lib/view/page/storage/sftp.dart"
    click DockerUI "https://github.com/lollipopkit/flutter_server_box/blob/main/lib/view/page/container.dart"
    click App "https://github.com/lollipopkit/flutter_server_box/blob/main/lib/app.dart"
    click Route "https://github.com/lollipopkit/flutter_server_box/blob/main/lib/core/route.dart"
    click Provider "https://github.com/lollipopkit/flutter_server_box/tree/main/lib/data/provider/"
    click State "https://github.com/lollipopkit/flutter_server_box/tree/main/lib/data/store/"
    click Systemd "https://github.com/lollipopkit/flutter_server_box/blob/main/lib/data/model/server/systemd.dart"

    %% Styling
    classDef ui fill:#3498db
    classDef feature fill:#9b59b6
    classDef core fill:#2ecc71
    classDef comm fill:#e74c3c
    classDef server fill:#f1c40f
    classDef service fill:#95a5a6
    classDef arch fill:#1abc9c

    %% Legend
    subgraph Legend
        UI_L["UI Components"]:::ui
        Feature_L["Platform Features"]:::feature
        Core_L["Core Services"]:::core
        Comm_L["Communication"]:::comm
        Server_L["Server Components"]:::server
        Service_L["System Services"]:::service
        Arch_L["Architecture"]:::arch
    end
```
