# u-c-s/hurl architecture

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

- Interactive diagram: https://gitdiagram.com/u-c-s/hurl
- Repository: https://github.com/u-c-s/hurl

## Overview

##### Main Components Identification

The system consists of three main .NET applications and a browser extension:
- Browser Selector (Main UI Application)
- Settings Application
- Launcher (Rust-based)
- Browser Extension (Chrome)

##### Key Architectural Elements

a. Core Components:
- Library Layer (Hurl.Library)
- Contains shared models and core functionality
- Handles browser detection and rule matching
- Manages settings and JSON operations

b. User Interface Components:
- Browser Selector (Hurl.BrowserSelector)
- Main window for browser selection
- Time selection window
- URI handling and launching

c. Settings Management (Hurl.Settings)
- Configuration interface
- Rule management
- Browser management

d. Integration Components:
- Launcher (Rust-based entry point)
- Chrome Extension
- Windows Protocol Handler Integration

**[User Interaction Layer]**
- ↓
**[Windows Protocol Handler]**
- ↓
**[Rust Launcher]**
- ↓
**[Core Applications]**
- → [Browser Selector]
- → [UI Components]
- → [URI Handler]
- → [Settings App]
- → [Rule Management]
- → [Browser Config]
- → [Hurl Library]
- → [Models]
- → [Rule Matching]
- → [Browser Detection]

**[Browser Extension] ←→ [Browser Selector]**

##### Important Details

a. Data Flow:
- How URLs are processed from click to browser launch
- Settings and rule synchronization
- Browser detection and selection flow

b. Integration Points:
- Windows protocol handler registration
- Browser extension communication
- File system interaction for settings

c. Key Technologies:
- .NET 8 Desktop Runtime
- Windows App SDK
- Rust (for launcher)
- Chrome Extension API

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph User["User Interaction Layer"]
        UserClick["User Click"]
        BrowserExt["Browser Extension"]:::extension
    end

    subgraph System["System Integration Layer"]
        WinProtocol["Windows Protocol Handler"]:::system
        RustLauncher["Rust Launcher"]:::launcher
    end

    subgraph Core["Core Applications"]
        subgraph BrowserSelector["Browser Selector"]
            MainWindow["Main Window"]:::ui
            TimeSelect["Time Selection"]:::ui
            UriHandler["URI Handler"]:::core
        end

        subgraph Settings["Settings Application"]
            RuleManagement["Rule Management"]:::ui
            BrowserConfig["Browser Configuration"]:::ui
            SettingsInterface["Settings Interface"]:::ui
        end

        subgraph Library["Hurl Library"]
            Models["Core Models"]:::lib
            RuleMatch["Rule Matching Engine"]:::lib
            BrowserDetect["Browser Detection"]:::lib
            SettingsManager["Settings Management"]:::lib
        end
    end

    %% Relationships
    UserClick --> BrowserExt
    BrowserExt --> WinProtocol
    WinProtocol --> RustLauncher
    RustLauncher --> UriHandler
    UriHandler --> MainWindow
    MainWindow --> TimeSelect
    MainWindow --> RuleMatch
    RuleMatch --> BrowserDetect
    BrowserDetect --> Models
    RuleManagement --> RuleMatch
    BrowserConfig --> BrowserDetect
    SettingsInterface --> SettingsManager
    SettingsManager --> Models

    %% Click Events
    click BrowserExt "https://github.com/U-C-S/Hurl/tree/main/Extensions/Chrome"
    click MainWindow "https://github.com/U-C-S/Hurl/blob/main/Source/Hurl.BrowserSelector/Windows/MainWindow.xaml"
    click TimeSelect "https://github.com/U-C-S/Hurl/blob/main/Source/Hurl.BrowserSelector/Windows/TimeSelectWindow.xaml"
    click UriHandler "https://github.com/U-C-S/Hurl/blob/main/Source/Hurl.BrowserSelector/Helpers/UriLauncher.cs"
    click RuleManagement "https://github.com/U-C-S/Hurl/blob/main/Source/Hurl.Settings/Views/RulesetPage.xaml"
    click BrowserConfig "https://github.com/U-C-S/Hurl/blob/main/Source/Hurl.Settings/Views/BrowsersPage.xaml"
    click SettingsInterface "https://github.com/U-C-S/Hurl/blob/main/Source/Hurl.Settings/Views/Settings.xaml"
    click Models "https://github.com/U-C-S/Hurl/tree/main/Source/Hurl.Library/Models"
    click RuleMatch "https://github.com/U-C-S/Hurl/blob/main/Source/Hurl.Library/RuleMatch.cs"
    click BrowserDetect "https://github.com/U-C-S/Hurl/blob/main/Source/Hurl.Library/GetBrowsers.cs"
    click SettingsManager "https://github.com/U-C-S/Hurl/blob/main/Source/Hurl.Library/Models/Settings.cs"
    click RustLauncher "https://github.com/U-C-S/Hurl/tree/main/Source/Launcher"

    %% Styling
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef lib fill:#2ecc71,stroke:#27ae60,color:white
    classDef system fill:#e67e22,stroke:#d35400,color:white
    classDef extension fill:#9b59b6,stroke:#8e44ad,color:white
    classDef launcher fill:#f1c40f,stroke:#f39c12,color:black

    %% Legend
    subgraph Legend
        UI["UI Component"]:::ui
        Library["Library Component"]:::lib
        SystemInt["System Integration"]:::system
        Ext["Extension Component"]:::extension
        Launch["Launcher Component"]:::launcher
    end
```
