# ysflamine/jellyroulette architecture

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

- Interactive diagram: https://gitdiagram.com/ysflamine/jellyroulette
- Repository: https://github.com/ysflamine/jellyroulette

## Overview

JellyRoulette is a Jellyfin plugin that helps users choose a random movie or series from their library. The user opens the injected web UI, selects media, watched-state, genre, and library filters, then spins to receive a winner and poster candidates; the result can be played or opened in Jellyfin. The backend exposes the spin and filter-data API, with selection delegated to a service that queries Jellyfin’s library. Configuration controls UI injection and defaults. Edges follow excerpts or README statements; unsampled implementation details are not inferred.

Main entry points: [`Jellyfin.Plugin.JellyRoulette/Controllers/RandomMediaController.cs`](https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Controllers/RandomMediaController.cs) (Random media API), [`Jellyfin.Plugin.JellyRoulette/Services/RandomMediaService.cs`](https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Services/RandomMediaService.cs) (Media selection), [`Jellyfin.Plugin.JellyRoulette/PluginServiceRegistrator.cs`](https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/PluginServiceRegistrator.cs) (Service registration), [`Jellyfin.Plugin.JellyRoulette/Web/roulette.js`](https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Web/roulette.js) (Roulette interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_roulette_ui["Roulette interface<br/>[roulette.js]"]
  node_loader["UI loader<br/>[roulette.loader.js]"]
  node_injection["UI injection"]
  node_assets["Web assets"]
  node_translations["Translations endpoint"]
end

subgraph group_api["API and selection"]
  node_api_controller["Random media API"]
  node_media_service["Media selection"]
  node_service_contract["Selection contract"]
  node_dto["API data contracts<br/>[Dtos.cs]"]
end

subgraph group_plugin["Plugin configuration"]
  node_plugin["Plugin entry<br/>[Plugin.cs]"]
  node_configuration["Plugin settings"]
  node_registrar["Service registration"]
end

subgraph group_host["Jellyfin host"]
  node_jellyfin_library["Jellyfin library APIs"]
end

node_user(("Jellyfin user"))
node_admin(("Jellyfin administrator"))

node_user -->|"uses"| node_roulette_ui
node_roulette_ui -->|"requests filters and spin"| node_api_controller
node_api_controller -->|"calls selection"| node_media_service
node_api_controller -->|"depends on"| node_service_contract
node_media_service -->|"queries library"| node_jellyfin_library
node_api_controller -->|"uses request and response types"| node_dto
node_media_service -->|"builds results"| node_dto
node_injection -->|"injects into web UI"| node_loader
node_loader -->|"loads script asset"| node_assets
node_admin -->|"configures plugin"| node_plugin
node_plugin -->|"uses settings"| node_configuration
node_registrar -->|"registers service"| node_service_contract
node_registrar -->|"registers filter"| node_injection

click node_roulette_ui "https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Web/roulette.js"
click node_loader "https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Web/roulette.loader.js"
click node_injection "https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Services/UiInjectionStartupFilter.cs"
click node_assets "https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Controllers/WebAssetsController.cs"
click node_translations "https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Controllers/TranslationsController.cs"
click node_api_controller "https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Controllers/RandomMediaController.cs"
click node_media_service "https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Services/RandomMediaService.cs"
click node_service_contract "https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Services/IRandomMediaService.cs"
click node_dto "https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Models/Dtos.cs"
click node_plugin "https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Plugin.cs"
click node_configuration "https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Configuration/PluginConfiguration.cs"
click node_registrar "https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/PluginServiceRegistrator.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_roulette_ui,node_loader,node_injection,node_assets,node_translations,node_user toneBlue
class node_api_controller,node_media_service,node_service_contract,node_dto toneAmber
class node_plugin,node_configuration,node_registrar toneMint
class node_jellyfin_library toneRose
class node_admin toneIndigo
```

## Components

### Web experience

- [Roulette interface](https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Web/roulette.js): `Jellyfin.Plugin.JellyRoulette/Web/roulette.js`
- [UI loader](https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Web/roulette.loader.js): `Jellyfin.Plugin.JellyRoulette/Web/roulette.loader.js`
- [UI injection](https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Services/UiInjectionStartupFilter.cs): `Jellyfin.Plugin.JellyRoulette/Services/UiInjectionStartupFilter.cs`
- [Web assets](https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Controllers/WebAssetsController.cs): `Jellyfin.Plugin.JellyRoulette/Controllers/WebAssetsController.cs`
- [Translations endpoint](https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Controllers/TranslationsController.cs): `Jellyfin.Plugin.JellyRoulette/Controllers/TranslationsController.cs`

### API and selection

- [Random media API](https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Controllers/RandomMediaController.cs): `Jellyfin.Plugin.JellyRoulette/Controllers/RandomMediaController.cs`
- [Media selection](https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Services/RandomMediaService.cs): `Jellyfin.Plugin.JellyRoulette/Services/RandomMediaService.cs`
- [Selection contract](https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Services/IRandomMediaService.cs): `Jellyfin.Plugin.JellyRoulette/Services/IRandomMediaService.cs`
- [API data contracts](https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Models/Dtos.cs): `Jellyfin.Plugin.JellyRoulette/Models/Dtos.cs`

### Plugin configuration

- [Plugin entry](https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Plugin.cs): `Jellyfin.Plugin.JellyRoulette/Plugin.cs`
- [Plugin settings](https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/Configuration/PluginConfiguration.cs): `Jellyfin.Plugin.JellyRoulette/Configuration/PluginConfiguration.cs`
- [Service registration](https://github.com/ysflamine/jellyroulette/blob/main/Jellyfin.Plugin.JellyRoulette/PluginServiceRegistrator.cs): `Jellyfin.Plugin.JellyRoulette/PluginServiceRegistrator.cs`

### Jellyfin host

- **Jellyfin library APIs**

### Other components

- **Jellyfin user**
- **Jellyfin administrator**

## Connections

- Jellyfin user → Roulette interface: uses (evidence: `README.md`)
- Roulette interface → Random media API: requests filters and spin (evidence: `README.md`)
- Random media API → Media selection: calls selection (evidence: `Jellyfin.Plugin.JellyRoulette/Controllers/RandomMediaController.cs`)
- Random media API → Selection contract: depends on (evidence: `Jellyfin.Plugin.JellyRoulette/Controllers/RandomMediaController.cs`)
- Media selection → Jellyfin library APIs: queries library (evidence: `Jellyfin.Plugin.JellyRoulette/Services/RandomMediaService.cs`)
- Random media API → API data contracts: uses request and response types (evidence: `Jellyfin.Plugin.JellyRoulette/Controllers/RandomMediaController.cs`)
- Media selection → API data contracts: builds results (evidence: `Jellyfin.Plugin.JellyRoulette/Services/RandomMediaService.cs`)
- UI injection → UI loader: injects into web UI (evidence: `Jellyfin.Plugin.JellyRoulette/Services/UiInjectionStartupFilter.cs`)
- UI loader → Web assets: loads script asset (evidence: `Jellyfin.Plugin.JellyRoulette/Controllers/WebAssetsController.cs`)
- Jellyfin administrator → Plugin entry: configures plugin (evidence: `Jellyfin.Plugin.JellyRoulette/Plugin.cs`)
- Plugin entry → Plugin settings: uses settings (evidence: `Jellyfin.Plugin.JellyRoulette/Plugin.cs`)
- Service registration → Selection contract: registers service (evidence: `Jellyfin.Plugin.JellyRoulette/PluginServiceRegistrator.cs`)
- Service registration → UI injection: registers filter (evidence: `Jellyfin.Plugin.JellyRoulette/PluginServiceRegistrator.cs`)
