# unisonweb/ucm-desktop architecture

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

- Interactive diagram: https://gitdiagram.com/unisonweb/ucm-desktop
- Repository: https://github.com/unisonweb/ucm-desktop

## Overview

##### Main Components

a) Frontend Layer:
- Elm Application Core
- TypeScript Integration Layer
- UI Components (Split Pane, Command Palette, Workspace)
- CSS Styling System

b) Backend/Desktop Layer:
- Tauri Runtime
- Native System Integration
- IPC (Inter-Process Communication)

c) External Components:
- UCM CLI Service
- File System Integration

**┌─────────────────────────────────────────────┐**
- UI Layer                    │
- ┌─────────┐ ┌──────────┐ ┌──────────────┐  │
- Workspace│ │Command   │ │Settings &     │  │
- Manager  │ │Palette   │ │Configuration  │  │
- ┘ └──────────┘ └──────────────┘  │
- ┤
- Application Core                 │
- ┌─────────┐ ┌──────────┐ ┌──────────────┐  │
- Elm      │ │TypeScript│ │Window         │  │
- Modules  │ │Bridge    │ │Management     │  │
- ┘ └──────────┘ └──────────────┘  │
- ┤
- Desktop Integration              │
- ┌─────────┐ ┌──────────┐ ┌──────────────┐  │
- Tauri    │ │Native    │ │UCM CLI       │  │
- Runtime  │ │APIs      │ │Communication  │  │
- ┘ └──────────┘ └──────────────┘  │
- ┘

##### Component Relationships

- Bidirectional communication between Elm and TypeScript
- Tauri's communication with native system
- Frontend components' interaction with Application Core
- Desktop Integration layer's communication with UCM CLI

##### Important Details to Highlight

a) Frontend Architecture:
- Split Pane system for workspace management
- Command Palette for user interactions
- Workspace management system
- Theme support (Light/Dark modes)

b) Core Features:
- Project management
- Branch handling
- Workspace organization
- Command execution

c) System Integration:
- UCM CLI communication (Port 5858)
- Token-based authentication
- CORS configuration
- File system access

##### Technical Stack Indicators

Technology badges or labels for:
- Elm
- TypeScript
- Tauri
- UCM CLI
- CSS Modules

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI
        WM["Workspace Manager"]:::ui
        CP["Command Palette"]:::ui
        SC["Settings & Configuration"]:::ui
        SP["Split Pane System"]:::ui
        WC["Workspace Components"]:::ui
    end

    subgraph Core
        EA["Elm Application"]:::core
        TS["TypeScript Bridge"]:::core
        WN["Window Management"]:::core
        TH["Theme System"]:::core
        PM["Project Management"]:::core
        BH["Branch Handler"]:::core
    end

    subgraph Desktop
        TR["Tauri Runtime"]:::desktop
        NA["Native APIs"]:::desktop
        UC["UCM CLI Communication"]:::desktop
        FS["File System"]:::desktop
    end

    %% Relationships
    WM --> EA
    CP --> EA
    SC --> EA
    SP --> WC
    WC --> EA

    EA <--> TS
    TS <--> TR
    TR <--> NA
    TR <--> UC
    NA <--> FS

    PM --> UC
    BH --> UC
    WN --> TR
    TH --> TS

    %% Click Events
    click EA "https://github.com/unisonweb/ucm-desktop/blob/main/src/Main.elm"
    click SP "https://github.com/unisonweb/ucm-desktop/blob/main/src/SplitPane/SplitPane.elm"
    click CP "https://github.com/unisonweb/ucm-desktop/blob/main/src/Ucm/CommandPalette/CommandPaletteModal.elm"
    click WC "https://github.com/unisonweb/ucm-desktop/blob/main/src/Ucm/Workspace/WorkspaceContext.elm"
    click TR "https://github.com/unisonweb/ucm-desktop/blob/main/src-tauri/src/main.rs"
    click PM "https://github.com/unisonweb/ucm-desktop/blob/main/src/Ucm/Project.elm"
    click BH "https://github.com/unisonweb/ucm-desktop/blob/main/src/Ucm/SearchBranchSheet.elm"
    click TH "https://github.com/unisonweb/ucm-desktop/blob/main/src/Ucm/Theme.ts"
    click WN "https://github.com/unisonweb/ucm-desktop/blob/main/src/Window.elm"
    click UC "https://github.com/unisonweb/ucm-desktop/blob/main/src/Ucm/UcmConnectivity.elm"
    click SC "https://github.com/unisonweb/ucm-desktop/blob/main/src/Ucm/AppSettings.ts"

    %% Styling
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef desktop fill:#e67e22,stroke:#d35400,color:white

    %% Legend
    subgraph Legend
        UI_L["UI Components"]:::ui
        CORE_L["Core Components"]:::core
        DESKTOP_L["Desktop Components"]:::desktop
    end
```
