# beclab/olares architecture

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

- Interactive diagram: https://gitdiagram.com/beclab/olares
- Repository: https://github.com/beclab/olares

## Overview

##### High-Level Architecture Components

a) User Interface Layer
- Desktop Application (apps/desktop)
- Web-based Management Console (third-party/ks-console)
- Client Applications (mentioned in README for Android, iOS, Windows, Mac, Chrome Plugin)

b) Application Layer
- Built-in Apps (files, vault, market, notifications, etc.)
- Third-party Apps
- AI Applications and Models

c) Framework Layer
- App Service (frameworks/app-service)
- System Server (frameworks/system-server)
- Backend For Launcher (frameworks/bfl)
- GPU Management (frameworks/GPU)
- TAPR (Application Runtime)

d) Infrastructure Layer
- Kubernetes/K3s Base
- Storage Systems (JuiceFS, MinIO)
- Database Services
- Authentication (Authelia)
- Network Management (Headscale, Tailscale)

##### Key Relationships to Highlight

a) Data Flow
- Client requests → BFL Proxy → Application Services
- Storage requests → JuiceFS/MinIO
- Authentication flow → Authelia → Apps

b) Control Flow
- System Server → App Service → Applications
- GPU Manager → AI Applications
- Backup Server → Storage Systems

##### Component Grouping

- Security Group (Authelia, Headscale, etc.)
- Storage Group (JuiceFS, MinIO, Backup)
- Runtime Group (TAPR, App Service)
- AI Services Group (GPU management, AI models)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef ui fill:#B3E0FF,stroke:#333,stroke-width:2px
    classDef app fill:#90EE90,stroke:#333,stroke-width:2px
    classDef framework fill:#FFB366,stroke:#333,stroke-width:2px
    classDef infra fill:#DDD,stroke:#333,stroke-width:2px
    classDef security fill:#FFB6C1,stroke:#333,stroke-width:2px
    classDef storage fill:#E6E6FA,stroke:#333,stroke-width:2px
    classDef ai fill:#DDA0DD,stroke:#333,stroke-width:2px

    subgraph UI["User Interface Layer"]
        Desktop["Desktop Application"]:::ui
        WebConsole["Web Management Console"]:::ui
        ClientApps["Client Applications"]:::ui
    end

    subgraph Apps["Application Layer"]
        Files["Files App"]:::app
        Vault["Vault App"]:::app
        Market["Market App"]:::app
        Notifications["Notifications App"]:::app
        ThirdParty["Third-party Apps"]:::app
        AIApps["AI Applications"]:::ai
    end

    subgraph Framework["Framework Layer"]
        AppService["App Service"]:::framework
        SystemServer["System Server"]:::framework
        BFL["Backend For Launcher"]:::framework
        GPUMgmt["GPU Management"]:::framework
        TAPR["TAPR Runtime"]:::framework
        BackupServer["Backup Server"]:::framework
        FSLib["File System Library"]:::framework
    end

    subgraph Infra["Infrastructure Layer"]
        K8s["Kubernetes/K3s"]:::infra
        JuiceFS["JuiceFS"]:::storage
        MinIO["MinIO"]:::storage
        DB["Database Services"]:::infra
        Auth["Authentication/Authelia"]:::security
        Network["Headscale/Tailscale"]:::infra
    end

    %% Relationships
    Desktop --> BFL
    WebConsole --> BFL
    ClientApps --> BFL
    
    BFL --> AppService
    AppService --> Files
    AppService --> Vault
    AppService --> Market
    AppService --> Notifications
    AppService --> ThirdParty
    AppService --> AIApps
    
    SystemServer --> AppService
    GPUMgmt --> AIApps
    
    Files --> FSLib
    FSLib --> JuiceFS
    FSLib --> MinIO
    
    BackupServer --> JuiceFS
    BackupServer --> MinIO
    
    AppService --> Auth
    Auth --> K8s
    Network --> K8s

    %% Click Events
    click Desktop "https://github.com/beclab/Olares/tree/main/apps/desktop"
    click WebConsole "https://github.com/beclab/Olares/tree/main/third-party/ks-console"
    click Files "https://github.com/beclab/Olares/tree/main/apps/files"
    click Vault "https://github.com/beclab/Olares/tree/main/apps/vault"
    click Market "https://github.com/beclab/Olares/tree/main/apps/market"
    click Notifications "https://github.com/beclab/Olares/tree/main/apps/notifications"
    click AppService "https://github.com/beclab/Olares/tree/main/frameworks/app-service"
    click SystemServer "https://github.com/beclab/Olares/tree/main/frameworks/system-server"
    click BFL "https://github.com/beclab/Olares/tree/main/frameworks/bfl"
    click GPUMgmt "https://github.com/beclab/Olares/tree/main/frameworks/GPU"
    click TAPR "https://github.com/beclab/Olares/tree/main/frameworks/tapr"
    click Auth "https://github.com/beclab/Olares/tree/main/third-party/authelia"
    click Network "https://github.com/beclab/Olares/tree/main/third-party/headscale"
    click BackupServer "https://github.com/beclab/Olares/tree/main/frameworks/backup-server"
    click FSLib "https://github.com/beclab/Olares/tree/main/libs/fs-lib"

    %% Legend
    subgraph Legend
        UI_L["UI Component"]:::ui
        App_L["Application"]:::app
        Framework_L["Framework"]:::framework
        Infra_L["Infrastructure"]:::infra
        Security_L["Security"]:::security
        Storage_L["Storage"]:::storage
        AI_L["AI Component"]:::ai
    end
```
