# zaarrg/stremio-community-v5 architecture

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

- Interactive diagram: https://gitdiagram.com/zaarrg/stremio-community-v5
- Repository: https://github.com/zaarrg/stremio-community-v5

## Overview

Stremio Desktop is a Windows native host for the Stremio Web v5 interface, with mpv playback, a local Node streaming server, and desktop integrations. The principal flow starts in the app, initializes its settings and runtime services, then presents the web UI; UI events can dispatch playback commands to mpv. The graph also preserves documented capabilities such as updates, extensions, tray controls, and Discord presence. Relationships are based on the supplied excerpts, SOURCE INDEX references, and README; unsampled implementation details are not assumed.

Main entry points: [`src/main.cpp`](https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/main.cpp) (App Startup), [`src/ui/mainwindow.cpp`](https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/ui/mainwindow.cpp) (Window Event Bridge), [`src/webview/webview.cpp`](https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/webview/webview.cpp) (WebView2 Host), [`src/mpv/player.cpp`](https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/mpv/player.cpp) (mpv Player)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Application Runtime"]
  node_entry["App Startup<br/>[main.cpp]"]
  node_state["Shared Runtime State<br/>[globals.cpp]"]
  node_settings["Settings<br/>[config.cpp]"]
end

subgraph group_interface["Web Interface"]
  node_webview["WebView2 Host<br/>[webview.cpp]"]
  node_webui["Stremio Web UI"]
  node_bridge["Window Event Bridge<br/>[mainwindow.cpp]"]
  node_extensions["Web Extensions<br/>[extensions.cpp]"]
end

subgraph group_playback["Playback"]
  node_mpv["mpv Player<br/>[player.cpp]"]
  node_streaming["Streaming Server<br/>[server.cpp]"]
end

subgraph group_desktop["Desktop Features"]
  node_tray["System Tray<br/>[tray.cpp]"]
  node_splash["Splash Screen<br/>[splash.cpp]"]
  node_discord["Discord Presence<br/>[discord.cpp]"]
end

subgraph group_services["App Services"]
  node_updater["Auto Updater<br/>[updater.cpp]"]
  node_crashlog["Crash Logging<br/>[crashlog.cpp]"]
end

node_user(("User"))

node_user -->|"launches"| node_entry
node_entry -->|"loads settings"| node_settings
node_entry -->|"initializes"| node_discord
node_entry -->|"starts updater"| node_updater
node_entry -->|"creates splash"| node_splash
node_entry -->|"initializes"| node_mpv
node_entry -->|"starts server"| node_streaming
node_entry -->|"initializes"| node_webview
node_entry -->|"logs failures"| node_crashlog
node_entry -->|"uses shared state"| node_state
node_webview -->|"hosts UI"| node_webui
node_webview -->|"routes messages"| node_bridge
node_bridge -->|"dispatches commands"| node_mpv
node_bridge -->|"updates presence"| node_discord
node_bridge -->|"requests update"| node_updater
node_bridge -->|"sends UI messages"| node_webview
node_webview -->|"sets up extensions"| node_extensions
node_bridge -->|"creates tray icon"| node_tray
node_user -.->|"uses playback"| node_mpv
node_user -.->|"plays streams"| node_streaming

click node_entry "https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/main.cpp"
click node_state "https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/core/globals.cpp"
click node_settings "https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/utils/config.cpp"
click node_webview "https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/webview/webview.cpp"
click node_bridge "https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/ui/mainwindow.cpp"
click node_extensions "https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/utils/extensions.cpp"
click node_mpv "https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/mpv/player.cpp"
click node_streaming "https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/node/server.cpp"
click node_tray "https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/tray/tray.cpp"
click node_splash "https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/ui/splash.cpp"
click node_discord "https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/utils/discord.cpp"
click node_updater "https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/updater/updater.cpp"
click node_crashlog "https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/utils/crashlog.cpp"

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_entry,node_state,node_settings,node_user toneBlue
class node_webview,node_webui,node_bridge,node_extensions toneAmber
class node_mpv,node_streaming toneMint
class node_tray,node_splash,node_discord toneRose
class node_updater,node_crashlog toneIndigo
```

## Components

### Application Runtime

- [App Startup](https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/main.cpp): `src/main.cpp`
- [Shared Runtime State](https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/core/globals.cpp): `src/core/globals.cpp`
- [Settings](https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/utils/config.cpp): `src/utils/config.cpp`

### Web Interface

- [WebView2 Host](https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/webview/webview.cpp): `src/webview/webview.cpp`
- **Stremio Web UI**
- [Window Event Bridge](https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/ui/mainwindow.cpp): `src/ui/mainwindow.cpp`
- [Web Extensions](https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/utils/extensions.cpp): `src/utils/extensions.cpp`

### Playback

- [mpv Player](https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/mpv/player.cpp): `src/mpv/player.cpp`
- [Streaming Server](https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/node/server.cpp): `src/node/server.cpp`

### Desktop Features

- [System Tray](https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/tray/tray.cpp): `src/tray/tray.cpp`
- [Splash Screen](https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/ui/splash.cpp): `src/ui/splash.cpp`
- [Discord Presence](https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/utils/discord.cpp): `src/utils/discord.cpp`

### App Services

- [Auto Updater](https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/updater/updater.cpp): `src/updater/updater.cpp`
- [Crash Logging](https://github.com/zaarrg/stremio-community-v5/blob/webview-windows/src/utils/crashlog.cpp): `src/utils/crashlog.cpp`

### Other components

- **User**

## Connections

- User → App Startup: launches (evidence: `src/main.cpp`)
- App Startup → Settings: loads settings (evidence: `src/main.cpp`)
- App Startup → Discord Presence: initializes (evidence: `src/main.cpp`)
- App Startup → Auto Updater: starts updater (evidence: `src/main.cpp`)
- App Startup → Splash Screen: creates splash (evidence: `src/main.cpp`)
- App Startup → mpv Player: initializes (evidence: `src/main.cpp`)
- App Startup → Streaming Server: starts server (evidence: `src/main.cpp`)
- App Startup → WebView2 Host: initializes (evidence: `src/main.cpp`)
- App Startup → Crash Logging: logs failures (evidence: `src/main.cpp`)
- App Startup → Shared Runtime State: uses shared state (evidence: `src/main.cpp`)
- WebView2 Host → Stremio Web UI: hosts UI (evidence: `README.md`)
- WebView2 Host → Window Event Bridge: routes messages (evidence: `src/webview/webview.cpp`)
- Window Event Bridge → mpv Player: dispatches commands (evidence: `src/ui/mainwindow.cpp`)
- Window Event Bridge → Discord Presence: updates presence (evidence: `src/ui/mainwindow.cpp`)
- Window Event Bridge → Auto Updater: requests update (evidence: `src/ui/mainwindow.cpp`)
- Window Event Bridge → WebView2 Host: sends UI messages (evidence: `src/ui/mainwindow.cpp`)
- WebView2 Host → Web Extensions: sets up extensions (evidence: `src/webview/webview.cpp`)
- Window Event Bridge → System Tray: creates tray icon (evidence: `src/ui/mainwindow.cpp`)
- User → mpv Player: uses playback
- User → Streaming Server: plays streams
