# jellyfin/jellyfin-desktop architecture

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

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

## Overview

#### Purpose and Runtime
Jellyfin Desktop is a native cross-platform Jellyfin client: a Qt/Qt WebEngine shell hosting the Jellyfin web client, with libmpv-backed video/audio playback for hardware decoding, passthrough, and broad direct-play support. Primary executable startup is `src/main.cpp`; build composition begins at `CMakeLists.txt` and `src/CMakeLists.txt`.

#### Application Composition and Lifecycle
A component-oriented C++/Qt application initializes shared services, coordinates their lifecycle, and exposes native capabilities to the web UI. `ComponentManager` is the central orchestration boundary; globals and signals provide process-wide state/coordination.
- `src/core/ComponentManager.cpp`
- `src/core/Globals.cpp`
- `src/core/SignalManager.cpp`

#### Web UI and Native Bridge
The display/UI layer owns the application window and WebEngine QML view. JavaScript loaded into the web client calls native plugins for shell, connectivity, update, input, and MPV control; native code returns functionality to the browser-hosted UI rather than implementing Jellyfin screens itself.
- `src/ui/WindowManager.cpp`
- `src/ui/webview.qml`
- `native/nativeshell.js`
- `native/mpvVideoPlayer.js`

#### Playback Pipeline
`PlayerComponent` integrates libmpv with Qt rendering through `MpvVideoItem`; it is the principal media boundary between web-client commands and native playback/output. Album artwork and OpenGL detection support UI/media rendering and platform capability selection.
- `src/player/PlayerComponent.cpp`
- `src/player/MpvVideoItem.cpp`
- `external/mpvrenderer-wrapper.cpp`

#### Input and Control Translation
Input sources—keyboard, SDL controllers, CEC, LIRC, socket input, and Apple remotes/media keys—feed an input component and mapping layer. JSON maps translate device events into the web client’s expected controls; this decouples platform/device acquisition from UI commands.
- `src/input/InputComponent.cpp`
- `src/input/InputMapping.cpp`
- `resources/inputmaps/keyboard.json`

#### Profiles, Settings, and Local IPC
Per-profile configuration, cache, and logs are managed through profile/path services. Settings are represented as sections/values and include audio control. Local JSON server/client classes provide an in-machine communication boundary, likely for single-instance or companion process coordination.
- `src/core/ProfileManager.cpp`
- `src/settings/SettingsComponent.cpp`
- `src/shared/LocalJsonServer.cpp`
- `src/shared/Paths.cpp`

#### OS Integration
Platform-specific implementations abstract display management, power inhibition/system behavior, taskbar integration, and MPRIS media controls. Linux desktop environments use DBus/MPRIS; macOS, Windows, X11, Raspberry Pi, and OpenELEC have conditional implementations.
- `src/display/DisplayManager.cpp`
- `src/power/PowerComponent.cpp`
- `src/mpris/MprisComponent.cpp`
- `src/system/SystemComponent.cpp`

#### Build, Dependencies, and Distribution
CMake builds the native Qt application and conditionally discovers/configures Qt, MPV, SDL2, CEC, graphics, and platform dependencies. CI emits Linux, AppImage, macOS, and Windows artifacts; packaging templates create platform-native bundles/installers.
- `CMakeModules/DependencyConfiguration.cmake`
- `CMakeModules/FindMPV.cmake`
- `.github/workflows/build-macos.yml`
- `bundle/win/JellyfinDesktop.iss.in`

Main entry points: [`src/core/ComponentManager.cpp`](https://github.com/jellyfin/jellyfin-desktop/blob/master/src/core/ComponentManager.cpp) (Component manager), [`src/ui/webview.qml`](https://github.com/jellyfin/jellyfin-desktop/blob/master/src/ui/webview.qml) (WebEngine QML view), [`src/player/PlayerComponent.cpp`](https://github.com/jellyfin/jellyfin-desktop/blob/master/src/player/PlayerComponent.cpp) (Player component), [`src/input/InputMapping.cpp`](https://github.com/jellyfin/jellyfin-desktop/blob/master/src/input/InputMapping.cpp) (Input mapping)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Native Runtime"]
  node_main(("Application startup<br/>C++ entry point<br/>[main.cpp]"))
  node_component_manager{{"Component manager<br/>lifecycle orchestrator"}}
  node_process_state["Global state &amp; signals<br/>process coordination<br/>[Globals.cpp]"]
  node_profile_paths[("Profiles &amp; local paths<br/>profile storage<br/>[ProfileManager.cpp]")]
  node_settings["Settings service<br/>settings component"]
  node_local_ipc["Local JSON IPC<br/>local communication"]
  node_os_components["OS integration<br/>platform components<br/>[DisplayManager.cpp]"]
end

subgraph group_web["Web Client Host"]
  node_window_manager["Window manager<br/>Qt UI shell<br/>[WindowManager.cpp]"]
  node_webview["WebEngine QML view<br/>QML web host<br/>[webview.qml]"]
  node_native_shell["Shell native bridge<br/>JavaScript plugin<br/>[nativeshell.js]"]
  node_mpv_bridge["MPV native bridge<br/>JavaScript plugin<br/>[mpvVideoPlayer.js]"]
end

subgraph group_media["Playback &amp; Input"]
  node_player{{"Player component<br/>libmpv integration"}}
  node_mpv_render_item["MPV Qt renderer<br/>Qt render item<br/>[MpvVideoItem.cpp]"]
  node_input_component["Input acquisition<br/>input component<br/>[InputComponent.cpp]"]
  node_input_mapping["Input mapping<br/>control translator<br/>[InputMapping.cpp]"]
  node_keyboard_map["Keyboard map<br/>input map JSON<br/>[keyboard.json]"]
end

subgraph group_distribution["Build &amp; Distribution"]
  node_cmake_root["CMake build composition<br/>build configuration<br/>[CMakeLists.txt]"]
  node_dependency_config["Dependency discovery<br/>CMake module"]
  node_find_mpv["MPV discovery<br/>CMake finder<br/>[FindMPV.cmake]"]
  node_macos_ci["macOS build pipeline<br/>CI workflow<br/>[build-macos.yml]"]
  node_windows_installer["Windows installer<br/>Inno Setup template"]
end

node_cmake_root -->|"configures"| node_dependency_config
node_dependency_config -->|"finds"| node_find_mpv
node_macos_ci -->|"builds"| node_cmake_root
node_windows_installer -.->|"packages build"| node_cmake_root
node_main -->|"starts"| node_component_manager
node_component_manager -->|"coordinates"| node_process_state
node_component_manager -->|"initializes"| node_profile_paths
node_component_manager -->|"initializes"| node_settings
node_component_manager -->|"initializes"| node_local_ipc
node_component_manager -->|"initializes"| node_window_manager
node_component_manager -->|"initializes"| node_player
node_component_manager -->|"initializes"| node_input_component
node_component_manager -->|"initializes"| node_os_components
node_window_manager -->|"hosts"| node_webview
node_webview -->|"calls"| node_native_shell
node_webview -->|"calls"| node_mpv_bridge
node_native_shell -->|"delivers controls"| node_input_mapping
node_mpv_bridge -->|"controls"| node_player
node_player -->|"renders through"| node_mpv_render_item
node_input_component -->|"forwards events"| node_input_mapping
node_keyboard_map -->|"defines mappings"| node_input_mapping
node_input_mapping -->|"emits web controls"| node_webview
node_profile_paths -->|"stores settings"| node_settings
node_dependency_config -.->|"provides MPV dependency"| node_player

click node_cmake_root "https://github.com/jellyfin/jellyfin-desktop/blob/master/CMakeLists.txt"
click node_dependency_config "https://github.com/jellyfin/jellyfin-desktop/blob/master/CMakeModules/DependencyConfiguration.cmake"
click node_find_mpv "https://github.com/jellyfin/jellyfin-desktop/blob/master/CMakeModules/FindMPV.cmake"
click node_macos_ci "https://github.com/jellyfin/jellyfin-desktop/blob/master/.github/workflows/build-macos.yml"
click node_windows_installer "https://github.com/jellyfin/jellyfin-desktop/blob/master/bundle/win/JellyfinDesktop.iss.in"
click node_main "https://github.com/jellyfin/jellyfin-desktop/blob/master/src/main.cpp"
click node_component_manager "https://github.com/jellyfin/jellyfin-desktop/blob/master/src/core/ComponentManager.cpp"
click node_process_state "https://github.com/jellyfin/jellyfin-desktop/blob/master/src/core/Globals.cpp"
click node_profile_paths "https://github.com/jellyfin/jellyfin-desktop/blob/master/src/core/ProfileManager.cpp"
click node_settings "https://github.com/jellyfin/jellyfin-desktop/blob/master/src/settings/SettingsComponent.cpp"
click node_local_ipc "https://github.com/jellyfin/jellyfin-desktop/blob/master/src/shared/LocalJsonServer.cpp"
click node_window_manager "https://github.com/jellyfin/jellyfin-desktop/blob/master/src/ui/WindowManager.cpp"
click node_webview "https://github.com/jellyfin/jellyfin-desktop/blob/master/src/ui/webview.qml"
click node_native_shell "https://github.com/jellyfin/jellyfin-desktop/blob/master/native/nativeshell.js"
click node_mpv_bridge "https://github.com/jellyfin/jellyfin-desktop/blob/master/native/mpvVideoPlayer.js"
click node_player "https://github.com/jellyfin/jellyfin-desktop/blob/master/src/player/PlayerComponent.cpp"
click node_mpv_render_item "https://github.com/jellyfin/jellyfin-desktop/blob/master/src/player/MpvVideoItem.cpp"
click node_input_component "https://github.com/jellyfin/jellyfin-desktop/blob/master/src/input/InputComponent.cpp"
click node_input_mapping "https://github.com/jellyfin/jellyfin-desktop/blob/master/src/input/InputMapping.cpp"
click node_keyboard_map "https://github.com/jellyfin/jellyfin-desktop/blob/master/resources/inputmaps/keyboard.json"
click node_os_components "https://github.com/jellyfin/jellyfin-desktop/blob/master/src/display/DisplayManager.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_main,node_component_manager,node_process_state,node_profile_paths,node_settings,node_local_ipc,node_os_components toneBlue
class node_window_manager,node_webview,node_native_shell,node_mpv_bridge toneAmber
class node_player,node_mpv_render_item,node_input_component,node_input_mapping,node_keyboard_map toneMint
class node_cmake_root,node_dependency_config,node_find_mpv,node_macos_ci,node_windows_installer toneRose
```

## Components

### Native Runtime

Qt application services and platform integration.

- [Application startup](https://github.com/jellyfin/jellyfin-desktop/blob/master/src/main.cpp): C++ entry point · `src/main.cpp`
- [Component manager](https://github.com/jellyfin/jellyfin-desktop/blob/master/src/core/ComponentManager.cpp): lifecycle orchestrator · Initializes and coordinates shared application components. · `src/core/ComponentManager.cpp`
- [Global state & signals](https://github.com/jellyfin/jellyfin-desktop/blob/master/src/core/Globals.cpp): process coordination · `src/core/Globals.cpp`
- [Profiles & local paths](https://github.com/jellyfin/jellyfin-desktop/blob/master/src/core/ProfileManager.cpp): profile storage · Manages per-profile configuration, cache, and logs. · `src/core/ProfileManager.cpp`
- [Settings service](https://github.com/jellyfin/jellyfin-desktop/blob/master/src/settings/SettingsComponent.cpp): settings component · Provides settings sections, values, and audio controls. · `src/settings/SettingsComponent.cpp`
- [Local JSON IPC](https://github.com/jellyfin/jellyfin-desktop/blob/master/src/shared/LocalJsonServer.cpp): local communication · In-machine JSON server/client boundary. · `src/shared/LocalJsonServer.cpp`
- [OS integration](https://github.com/jellyfin/jellyfin-desktop/blob/master/src/display/DisplayManager.cpp): platform components · Display, power, system, taskbar, and MPRIS implementations per platform. · `src/display/DisplayManager.cpp`

### Web Client Host

Browser-hosted Jellyfin UI and native JavaScript bridge.

- [Window manager](https://github.com/jellyfin/jellyfin-desktop/blob/master/src/ui/WindowManager.cpp): Qt UI shell · Owns the application window and WebEngine view. · `src/ui/WindowManager.cpp`
- [WebEngine QML view](https://github.com/jellyfin/jellyfin-desktop/blob/master/src/ui/webview.qml): QML web host · `src/ui/webview.qml`
- [Shell native bridge](https://github.com/jellyfin/jellyfin-desktop/blob/master/native/nativeshell.js): JavaScript plugin · Exposes shell, connectivity, update, and input capabilities to the web client. · `native/nativeshell.js`
- [MPV native bridge](https://github.com/jellyfin/jellyfin-desktop/blob/master/native/mpvVideoPlayer.js): JavaScript plugin · Translates web-client playback commands to native MPV control. · `native/mpvVideoPlayer.js`

### Playback & Input

Native media output and control translation.

- [Player component](https://github.com/jellyfin/jellyfin-desktop/blob/master/src/player/PlayerComponent.cpp): libmpv integration · Primary boundary for native playback, hardware decoding, and output. · `src/player/PlayerComponent.cpp`
- [MPV Qt renderer](https://github.com/jellyfin/jellyfin-desktop/blob/master/src/player/MpvVideoItem.cpp): Qt render item · Renders libmpv output into the Qt UI. · `src/player/MpvVideoItem.cpp`
- [Input acquisition](https://github.com/jellyfin/jellyfin-desktop/blob/master/src/input/InputComponent.cpp): input component · Receives keyboard, controller, CEC, LIRC, socket, and Apple input. · `src/input/InputComponent.cpp`
- [Input mapping](https://github.com/jellyfin/jellyfin-desktop/blob/master/src/input/InputMapping.cpp): control translator · Maps device events to web-client controls. · `src/input/InputMapping.cpp`
- [Keyboard map](https://github.com/jellyfin/jellyfin-desktop/blob/master/resources/inputmaps/keyboard.json): input map JSON · `resources/inputmaps/keyboard.json`

### Build & Distribution

Dependency configuration, CI, and installers.

- [CMake build composition](https://github.com/jellyfin/jellyfin-desktop/blob/master/CMakeLists.txt): build configuration · `CMakeLists.txt`
- [Dependency discovery](https://github.com/jellyfin/jellyfin-desktop/blob/master/CMakeModules/DependencyConfiguration.cmake): CMake module · Configures Qt, MPV, SDL2, CEC, graphics, and platform dependencies. · `CMakeModules/DependencyConfiguration.cmake`
- [MPV discovery](https://github.com/jellyfin/jellyfin-desktop/blob/master/CMakeModules/FindMPV.cmake): CMake finder · `CMakeModules/FindMPV.cmake`
- [macOS build pipeline](https://github.com/jellyfin/jellyfin-desktop/blob/master/.github/workflows/build-macos.yml): CI workflow · `.github/workflows/build-macos.yml`
- [Windows installer](https://github.com/jellyfin/jellyfin-desktop/blob/master/bundle/win/JellyfinDesktop.iss.in): Inno Setup template · `bundle/win/JellyfinDesktop.iss.in`

## Connections

- CMake build composition → Dependency discovery: configures
- Dependency discovery → MPV discovery: finds
- macOS build pipeline → CMake build composition: builds
- Windows installer → CMake build composition: packages build
- Application startup → Component manager: starts
- Component manager → Global state & signals: coordinates
- Component manager → Profiles & local paths: initializes
- Component manager → Settings service: initializes
- Component manager → Local JSON IPC: initializes
- Component manager → Window manager: initializes
- Component manager → Player component: initializes
- Component manager → Input acquisition: initializes
- Component manager → OS integration: initializes
- Window manager → WebEngine QML view: hosts
- WebEngine QML view → Shell native bridge: calls
- WebEngine QML view → MPV native bridge: calls
- Shell native bridge → Input mapping: delivers controls
- MPV native bridge → Player component: controls
- Player component → MPV Qt renderer: renders through
- Input acquisition → Input mapping: forwards events
- Keyboard map → Input mapping: defines mappings
- Input mapping → WebEngine QML view: emits web controls
- Profiles & local paths → Settings service: stores settings
- Dependency discovery → Player component: provides MPV dependency
