# xien-ica/spotymc architecture

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

- Interactive diagram: https://gitdiagram.com/xien-ica/spotymc
- Repository: https://github.com/xien-ica/spotymc

## Overview

SpotyMC is a Fabric mod that brings Spotify playback and browsing into Minecraft. The user configures Spotify and the optional librespot backend, authenticates, then uses the in-game player to control playback, search or browse library and queue content, and view track information and synced lyrics. PlaybackPoller coordinates Spotify state updates and the local audio process; the player UI and HUD present that state. The graph follows README capabilities and indexed source references; some feature wiring is documented or indexed but its implementation was not excerpted, so uncertain links are omitted.

Main entry points: [`src/client/java/xien/jxsh/spotymc/PlaybackPoller.java`](https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/PlaybackPoller.java) (Playback coordinator), [`src/client/java/xien/jxsh/spotymc/gui/PlayerControlScreen.java`](https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/gui/PlayerControlScreen.java) (Player screen), [`src/client/java/xien/jxsh/spotymc/Spotymc.java`](https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/Spotymc.java) (Mod entry), [`src/client/java/xien/jxsh/spotymc/hud/LyricsHud.java`](https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/hud/LyricsHud.java) (Lyrics HUD)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Setup and authentication"]
  node_mod["Mod entry<br/>[Spotymc.java]"]
  node_settings["Backend setup"]
  node_config[("Mod configuration<br/>[ModConfig.java]")]
  node_auth["Spotify login<br/>[SpotifyAuth.java]"]
end

subgraph group_playback["Playback services"]
  node_installer["Librespot installer"]
  node_poller["Playback coordinator"]
  node_api["Spotify API client"]
  node_state["Playback snapshot<br/>[PlaybackState.java]"]
  node_process["Librespot process"]
  node_audio["Audio output<br/>[AudioPlayer.java]"]
end

subgraph group_player_ui["Player interface"]
  node_player["Player screen"]
  node_browse["Search and library"]
  node_input["Player input"]
  node_render["Player rendering"]
end

subgraph group_lyrics_hud["Lyrics and HUD"]
  node_lyrics_service["Lyrics service<br/>[LyricsService.java]"]
  node_lyrics_hud["Lyrics HUD<br/>[LyricsHud.java]"]
end

node_user(("Minecraft user"))
node_spotify["Spotify services"]

node_user -->|"opens mod"| node_mod
node_mod -->|"starts polling"| node_poller
node_mod -->|"opens screen"| node_player
node_mod -->|"registers HUD"| node_lyrics_hud
node_user -.->|"configures setup"| node_settings
node_settings -->|"installs backend"| node_installer
node_settings -->|"saves settings"| node_config
node_user -.->|"logs in"| node_auth
node_auth -->|"exchanges tokens"| node_spotify
node_auth -->|"stores tokens"| node_config
node_poller -->|"requests playback"| node_api
node_api -->|"calls Web API"| node_spotify
node_api -->|"uses credentials"| node_auth
node_poller -->|"updates snapshot"| node_state
node_poller -->|"starts backend"| node_process
node_poller -->|"streams audio"| node_audio
node_player -->|"reads playback"| node_poller
node_player -->|"manages browsing"| node_browse
node_player -->|"delegates input"| node_input
node_player -->|"renders panels"| node_render
node_browse -->|"loads library"| node_poller
node_input -->|"sends controls"| node_poller
node_input -->|"selects entries"| node_browse
node_poller -->|"fetches lyrics"| node_lyrics_service
node_lyrics_hud -->|"reads playback"| node_poller
node_lyrics_hud -->|"displays track"| node_state
node_lyrics_hud -->|"reads preferences"| node_config

click node_mod "https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/Spotymc.java"
click node_settings "https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/gui/LibrespotSettingsController.java"
click node_config "https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/config/ModConfig.java"
click node_auth "https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/auth/SpotifyAuth.java"
click node_installer "https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/audio/LibrespotInstaller.java"
click node_poller "https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/PlaybackPoller.java"
click node_api "https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/api/SpotifyApiClient.java"
click node_state "https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/api/PlaybackState.java"
click node_process "https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/audio/LibrespotProcess.java"
click node_audio "https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/audio/AudioPlayer.java"
click node_player "https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/gui/PlayerControlScreen.java"
click node_browse "https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/gui/browse/BrowseController.java"
click node_input "https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/gui/input/PlayerControlInput.java"
click node_render "https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/gui/render/LeftPanelRenderer.java"
click node_lyrics_service "https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/lyrics/LyricsService.java"
click node_lyrics_hud "https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/hud/LyricsHud.java"

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_mod,node_settings,node_config,node_auth,node_user toneBlue
class node_installer,node_poller,node_api,node_state,node_process,node_audio toneAmber
class node_player,node_browse,node_input,node_render toneMint
class node_lyrics_service,node_lyrics_hud toneRose
class node_spotify toneIndigo
```

## Components

### Setup and authentication

- [Mod entry](https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/Spotymc.java): `src/client/java/xien/jxsh/spotymc/Spotymc.java`
- [Backend setup](https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/gui/LibrespotSettingsController.java): `src/client/java/xien/jxsh/spotymc/gui/LibrespotSettingsController.java`
- [Mod configuration](https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/config/ModConfig.java): `src/client/java/xien/jxsh/spotymc/config/ModConfig.java`
- [Spotify login](https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/auth/SpotifyAuth.java): `src/client/java/xien/jxsh/spotymc/auth/SpotifyAuth.java`

### Playback services

- [Librespot installer](https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/audio/LibrespotInstaller.java): `src/client/java/xien/jxsh/spotymc/audio/LibrespotInstaller.java`
- [Playback coordinator](https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/PlaybackPoller.java): `src/client/java/xien/jxsh/spotymc/PlaybackPoller.java`
- [Spotify API client](https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/api/SpotifyApiClient.java): `src/client/java/xien/jxsh/spotymc/api/SpotifyApiClient.java`
- [Playback snapshot](https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/api/PlaybackState.java): `src/client/java/xien/jxsh/spotymc/api/PlaybackState.java`
- [Librespot process](https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/audio/LibrespotProcess.java): `src/client/java/xien/jxsh/spotymc/audio/LibrespotProcess.java`
- [Audio output](https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/audio/AudioPlayer.java): `src/client/java/xien/jxsh/spotymc/audio/AudioPlayer.java`

### Player interface

- [Player screen](https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/gui/PlayerControlScreen.java): `src/client/java/xien/jxsh/spotymc/gui/PlayerControlScreen.java`
- [Search and library](https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/gui/browse/BrowseController.java): `src/client/java/xien/jxsh/spotymc/gui/browse/BrowseController.java`
- [Player input](https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/gui/input/PlayerControlInput.java): `src/client/java/xien/jxsh/spotymc/gui/input/PlayerControlInput.java`
- [Player rendering](https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/gui/render/LeftPanelRenderer.java): `src/client/java/xien/jxsh/spotymc/gui/render/LeftPanelRenderer.java`

### Lyrics and HUD

- [Lyrics service](https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/lyrics/LyricsService.java): `src/client/java/xien/jxsh/spotymc/lyrics/LyricsService.java`
- [Lyrics HUD](https://github.com/xien-ica/spotymc/blob/master/src/client/java/xien/jxsh/spotymc/hud/LyricsHud.java): `src/client/java/xien/jxsh/spotymc/hud/LyricsHud.java`

### Other components

- **Minecraft user**
- **Spotify services**

## Connections

- Minecraft user → Mod entry: opens mod (evidence: `src/client/java/xien/jxsh/spotymc/Spotymc.java`)
- Mod entry → Playback coordinator: starts polling (evidence: `src/client/java/xien/jxsh/spotymc/Spotymc.java`)
- Mod entry → Player screen: opens screen (evidence: `src/client/java/xien/jxsh/spotymc/Spotymc.java`)
- Mod entry → Lyrics HUD: registers HUD (evidence: `src/client/java/xien/jxsh/spotymc/Spotymc.java`)
- Minecraft user → Backend setup: configures setup (evidence: `README.md`)
- Backend setup → Librespot installer: installs backend (evidence: `src/client/java/xien/jxsh/spotymc/gui/LibrespotSettingsController.java`)
- Backend setup → Mod configuration: saves settings (evidence: `src/client/java/xien/jxsh/spotymc/gui/LibrespotSettingsController.java`)
- Minecraft user → Spotify login: logs in (evidence: `README.md`)
- Spotify login → Spotify services: exchanges tokens (evidence: `src/client/java/xien/jxsh/spotymc/auth/SpotifyAuth.java`)
- Spotify login → Mod configuration: stores tokens (evidence: `src/client/java/xien/jxsh/spotymc/auth/SpotifyAuth.java`)
- Playback coordinator → Spotify API client: requests playback (evidence: `src/client/java/xien/jxsh/spotymc/PlaybackPoller.java`)
- Spotify API client → Spotify services: calls Web API (evidence: `src/client/java/xien/jxsh/spotymc/api/SpotifyApiClient.java`)
- Spotify API client → Spotify login: uses credentials (evidence: `src/client/java/xien/jxsh/spotymc/api/SpotifyApiClient.java`)
- Playback coordinator → Playback snapshot: updates snapshot (evidence: `src/client/java/xien/jxsh/spotymc/PlaybackPoller.java`)
- Playback coordinator → Librespot process: starts backend (evidence: `src/client/java/xien/jxsh/spotymc/PlaybackPoller.java`)
- Playback coordinator → Audio output: streams audio (evidence: `src/client/java/xien/jxsh/spotymc/PlaybackPoller.java`)
- Player screen → Playback coordinator: reads playback (evidence: `src/client/java/xien/jxsh/spotymc/gui/PlayerControlScreen.java`)
- Player screen → Search and library: manages browsing (evidence: `src/client/java/xien/jxsh/spotymc/gui/PlayerControlScreen.java`)
- Player screen → Player input: delegates input (evidence: `src/client/java/xien/jxsh/spotymc/gui/PlayerControlScreen.java`)
- Player screen → Player rendering: renders panels (evidence: `src/client/java/xien/jxsh/spotymc/gui/PlayerControlScreen.java`)
- Search and library → Playback coordinator: loads library (evidence: `src/client/java/xien/jxsh/spotymc/gui/browse/BrowseController.java`)
- Player input → Playback coordinator: sends controls (evidence: `src/client/java/xien/jxsh/spotymc/gui/input/PlayerControlInput.java`)
- Player input → Search and library: selects entries (evidence: `src/client/java/xien/jxsh/spotymc/gui/input/PlayerControlInput.java`)
- Playback coordinator → Lyrics service: fetches lyrics (evidence: `src/client/java/xien/jxsh/spotymc/PlaybackPoller.java`)
- Lyrics HUD → Playback coordinator: reads playback (evidence: `src/client/java/xien/jxsh/spotymc/hud/LyricsHud.java`)
- Lyrics HUD → Playback snapshot: displays track (evidence: `src/client/java/xien/jxsh/spotymc/hud/LyricsHud.java`)
- Lyrics HUD → Mod configuration: reads preferences (evidence: `src/client/java/xien/jxsh/spotymc/hud/LyricsHud.java`)
