# futo-org/grayjay.desktop architecture

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

- Interactive diagram: https://gitdiagram.com/futo-org/grayjay.desktop
- Repository: https://github.com/futo-org/grayjay.desktop

## Overview

Grayjay Desktop is a multi-platform media application whose plugin integrations unify content from different platforms. The main user workflow is browsing recommendations or searching, opening channel/content details, and watching media; plugins supply platform content while the desktop interface presents it. Distinct capabilities include source management, downloads and export, casting, subscriptions/history, and device sync. The sampled excerpts establish server startup, platform-client initialization, and several controller responsibilities; many feature links below are documented by the README or are dashed where implementation wiring was not shown.

Main entry points: [`Grayjay.Desktop.Web/src/index.tsx`](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.Desktop.Web/src/index.tsx) (Web interface), [`Grayjay.ClientServer/Controllers/DetailsController.cs`](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Controllers/DetailsController.cs) (Content details), [`Grayjay.ClientServer/States/StatePlatform.cs`](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/States/StatePlatform.cs) (Platform clients), [`Grayjay.ClientServer/Controllers/DownloadController.cs`](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Controllers/DownloadController.cs) (Downloads and export)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Desktop experience"]
  node_webapp["Web interface<br/>[index.tsx]"]
  node_server["Local server<br/>[GrayjayServer.cs]"]
  node_home["Home and search<br/>[HomeController.cs]"]
end

subgraph group_content["Content and playback"]
  node_details["Content details"]
  node_player["Media player<br/>[index.tsx]"]
  node_downloads["Downloads and export"]
  node_casting["Casting"]
  node_livechat["Live chat<br/>[LiveChatManager.cs]"]
end

subgraph group_platforms["Platform integrations"]
  node_plugins["Source plugins<br/>[StatePlugins.cs]"]
  node_platform["Platform clients<br/>[StatePlatform.cs]"]
  node_clientpool["Client pool"]
  node_subscriptions["Subscriptions"]
end

subgraph group_services["Application services"]
  node_proxy["Media proxy<br/>[HttpProxy.cs]"]
  node_sabr["SABR streaming<br/>[SabrSession.cs]"]
  node_sync["Device sync"]
  node_settings["Application settings<br/>[GrayjaySettings.cs]"]
end

subgraph group_state["State and persistence"]
  node_stateapp["Application lifecycle<br/>[StateApp.cs]"]
  node_history["History<br/>[StateHistory.cs]"]
  node_downloadstate["Download state<br/>[StateDownloads.cs]"]
  node_database[("SQLite database")]
end

node_user(("Desktop user"))

node_user -->|"browses"| node_webapp
node_webapp -.->|"requests"| node_server
node_server -->|"serves interface"| node_webapp
node_webapp -.->|"searches"| node_home
node_webapp -.->|"opens content"| node_details
node_details -->|"resolves content"| node_platform
node_platform -.->|"uses clients"| node_clientpool
node_platform -->|"loads scripts"| node_plugins
node_platform -->|"provides recommendations"| node_home
node_details -.->|"provides playback"| node_player
node_details -->|"registers media route"| node_proxy
node_proxy -.->|"streams segments"| node_sabr
node_details -->|"manages chat"| node_livechat
node_webapp -.->|"manages downloads"| node_downloads
node_downloads -->|"gets video details"| node_platform
node_downloads -->|"starts downloads"| node_downloadstate
node_webapp -.->|"casts media"| node_casting
node_webapp -.->|"manages subscriptions"| node_subscriptions
node_details -.->|"records viewing"| node_history
node_user -.->|"syncs devices"| node_sync
node_sync -->|"syncs subscription data"| node_subscriptions
node_sync -->|"syncs history"| node_history
node_stateapp -->|"initializes storage"| node_database
node_user -.->|"configures"| node_settings

click node_webapp "https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.Desktop.Web/src/index.tsx"
click node_server "https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/GrayjayServer.cs"
click node_home "https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Controllers/HomeController.cs"
click node_details "https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Controllers/DetailsController.cs"
click node_player "https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.Desktop.Web/src/components/player/VideoPlayerView/index.tsx"
click node_downloads "https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Controllers/DownloadController.cs"
click node_casting "https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Controllers/CastingController.cs"
click node_livechat "https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/LiveChat/LiveChatManager.cs"
click node_plugins "https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/States/StatePlugins.cs"
click node_platform "https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/States/StatePlatform.cs"
click node_clientpool "https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Pooling/PlatformClientPool.cs"
click node_subscriptions "https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/States/StateSubscriptions.cs"
click node_proxy "https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Proxy/HttpProxy.cs"
click node_sabr "https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Sabr/SabrSession.cs"
click node_sync "https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Sync/GrayjaySyncHandlers.cs"
click node_settings "https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Settings/GrayjaySettings.cs"
click node_stateapp "https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/States/StateApp.cs"
click node_history "https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/States/StateHistory.cs"
click node_downloadstate "https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/States/StateDownloads.cs"
click node_database "https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Database/DatabaseConnection.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webapp,node_server,node_home,node_user toneBlue
class node_details,node_player,node_downloads,node_casting,node_livechat toneAmber
class node_plugins,node_platform,node_clientpool,node_subscriptions toneMint
class node_proxy,node_sabr,node_sync,node_settings toneRose
class node_stateapp,node_history,node_downloadstate,node_database toneIndigo
```

## Components

### Desktop experience

- [Web interface](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.Desktop.Web/src/index.tsx): `Grayjay.Desktop.Web/src/index.tsx`
- [Local server](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/GrayjayServer.cs): `Grayjay.ClientServer/GrayjayServer.cs`
- [Home and search](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Controllers/HomeController.cs): `Grayjay.ClientServer/Controllers/HomeController.cs`

### Content and playback

- [Content details](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Controllers/DetailsController.cs): `Grayjay.ClientServer/Controllers/DetailsController.cs`
- [Media player](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.Desktop.Web/src/components/player/VideoPlayerView/index.tsx): `Grayjay.Desktop.Web/src/components/player/VideoPlayerView/index.tsx`
- [Downloads and export](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Controllers/DownloadController.cs): `Grayjay.ClientServer/Controllers/DownloadController.cs`
- [Casting](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Controllers/CastingController.cs): `Grayjay.ClientServer/Controllers/CastingController.cs`
- [Live chat](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/LiveChat/LiveChatManager.cs): `Grayjay.ClientServer/LiveChat/LiveChatManager.cs`

### Platform integrations

- [Source plugins](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/States/StatePlugins.cs): `Grayjay.ClientServer/States/StatePlugins.cs`
- [Platform clients](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/States/StatePlatform.cs): `Grayjay.ClientServer/States/StatePlatform.cs`
- [Client pool](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Pooling/PlatformClientPool.cs): `Grayjay.ClientServer/Pooling/PlatformClientPool.cs`
- [Subscriptions](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/States/StateSubscriptions.cs): `Grayjay.ClientServer/States/StateSubscriptions.cs`

### Application services

- [Media proxy](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Proxy/HttpProxy.cs): `Grayjay.ClientServer/Proxy/HttpProxy.cs`
- [SABR streaming](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Sabr/SabrSession.cs): `Grayjay.ClientServer/Sabr/SabrSession.cs`
- [Device sync](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Sync/GrayjaySyncHandlers.cs): `Grayjay.ClientServer/Sync/GrayjaySyncHandlers.cs`
- [Application settings](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Settings/GrayjaySettings.cs): `Grayjay.ClientServer/Settings/GrayjaySettings.cs`

### State and persistence

- [Application lifecycle](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/States/StateApp.cs): `Grayjay.ClientServer/States/StateApp.cs`
- [History](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/States/StateHistory.cs): `Grayjay.ClientServer/States/StateHistory.cs`
- [Download state](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/States/StateDownloads.cs): `Grayjay.ClientServer/States/StateDownloads.cs`
- [SQLite database](https://github.com/futo-org/grayjay.desktop/blob/master/Grayjay.ClientServer/Database/DatabaseConnection.cs): `Grayjay.ClientServer/Database/DatabaseConnection.cs`

### Other components

- **Desktop user**

## Connections

- Desktop user → Web interface: browses
- Web interface → Local server: requests
- Local server → Web interface: serves interface
- Web interface → Home and search: searches
- Web interface → Content details: opens content
- Content details → Platform clients: resolves content (evidence: `Grayjay.ClientServer/Controllers/DetailsController.cs`)
- Platform clients → Client pool: uses clients (evidence: `Grayjay.ClientServer/Pooling/PlatformClientPool.cs`)
- Platform clients → Source plugins: loads scripts (evidence: `Grayjay.ClientServer/States/StatePlatform.cs`)
- Platform clients → Home and search: provides recommendations (evidence: `Grayjay.ClientServer/States/StatePlatform.cs`)
- Content details → Media player: provides playback
- Content details → Media proxy: registers media route (evidence: `Grayjay.ClientServer/Controllers/DetailsController.cs`)
- Media proxy → SABR streaming: streams segments
- Content details → Live chat: manages chat (evidence: `Grayjay.ClientServer/Controllers/DetailsController.cs`)
- Web interface → Downloads and export: manages downloads
- Downloads and export → Platform clients: gets video details (evidence: `Grayjay.ClientServer/Controllers/DownloadController.cs`)
- Downloads and export → Download state: starts downloads (evidence: `Grayjay.ClientServer/Controllers/DownloadController.cs`)
- Web interface → Casting: casts media
- Web interface → Subscriptions: manages subscriptions
- Content details → History: records viewing (evidence: `Grayjay.ClientServer/Controllers/DetailsController.cs`)
- Desktop user → Device sync: syncs devices
- Device sync → Subscriptions: syncs subscription data (evidence: `Grayjay.ClientServer/Sync/GrayjaySyncHandlers.cs`)
- Device sync → History: syncs history (evidence: `Grayjay.ClientServer/Sync/GrayjaySyncHandlers.cs`)
- Application lifecycle → SQLite database: initializes storage (evidence: `Grayjay.ClientServer/States/StateApp.cs`)
- Desktop user → Application settings: configures
