# hgphutjb/mochy-ios architecture

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

- Interactive diagram: https://gitdiagram.com/hgphutjb/mochy-ios
- Repository: https://github.com/hgphutjb/mochy-ios

## Overview

Mochy is an iOS music player. The main workflow runs from app navigation into home/search or music pages, through song selection and actions, to playback; users can also manage a library, downloads, lyrics, accounts, and listening history. The graph includes those documented-by-source capabilities and the main playback, discovery, and persistence layers. The README is empty and many files were not excerpted, so some subsystem links are omitted rather than inferred.

Main entry points: [`Sources/PlayerEngine.swift`](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/PlayerEngine.swift) (Player engine), [`Sources/Library.swift`](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/Library.swift) (Music library), [`Sources/NowPlayingViewController.swift`](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/NowPlayingViewController.swift) (Now playing), [`Sources/SongActions.swift`](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/SongActions.swift) (Song actions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["App and discovery"]
  node_root["App navigation"]
  node_home["Home feed"]
  node_search["Music search"]
  node_musicpage["Artist and album"]
  node_songcell["Song rows<br/>[SongCell.swift]"]
  node_actions["Song actions<br/>[SongActions.swift]"]
end

subgraph group_playback["Playback experience"]
  node_nowplaying["Now playing"]
  node_player["Player engine<br/>[PlayerEngine.swift]"]
  node_queue["Playback queue"]
  node_lyrics["Lyrics<br/>[Lyrics.swift]"]
  node_reverb["Audio effects<br/>[Reverb.swift]"]
end

subgraph group_library["Library and accounts"]
  node_libraryview["Library screens"]
  node_library[("Music library<br/>[Library.swift]")]
  node_downloads["Download manager"]
  node_downloadstore[("Download records")]
  node_import["Playlist import"]
  node_account["Account screens"]
end

subgraph group_services["Music services"]
  node_cloud["Mochy cloud<br/>[MochyCloud.swift]"]
  node_social["Cloud social<br/>[CloudSocial.swift]"]
  node_innertube["YouTube Music API<br/>[InnerTube.swift]"]
  node_lastfm["Last.fm integration<br/>[LastFM.swift]"]
  node_playlog[("Listening history<br/>[PlayLog.swift]")]
  node_imageloader["Image loading<br/>[ImageLoader.swift]"]
  node_theme["Theme system<br/>[Theme.swift]"]
  node_spotifycanvas["Canvas media"]
  node_recap["Listening recap"]
end

node_user(("Listener"))

node_user -->|"opens app"| node_root
node_root -->|"routes to"| node_home
node_root -->|"routes to"| node_libraryview
node_root -->|"routes to"| node_search
node_root -->|"opens player"| node_nowplaying
node_home -.->|"opens search"| node_search
node_home -->|"opens pages"| node_musicpage
node_home -->|"loads artwork"| node_imageloader
node_home -->|"loads social"| node_social
node_search -->|"searches catalog"| node_innertube
node_search -->|"searches cloud"| node_cloud
node_musicpage -->|"loads catalog pages"| node_innertube
node_musicpage -->|"loads artwork"| node_imageloader
node_musicpage -->|"renders songs"| node_songcell
node_songcell -->|"opens actions"| node_actions
node_actions -->|"controls playback"| node_player
node_actions -->|"changes library"| node_library
node_actions -->|"starts downloads"| node_downloads
node_actions -->|"loves tracks"| node_lastfm
node_nowplaying -->|"controls playback"| node_player
node_nowplaying -->|"shows lyrics"| node_lyrics
node_nowplaying -->|"controls effects"| node_reverb
node_nowplaying -->|"shows canvas"| node_spotifycanvas
node_nowplaying -->|"shows music pages"| node_innertube
node_player -->|"resolves streams"| node_innertube
node_player -->|"reads tracks"| node_library
node_player -->|"checks downloads"| node_downloadstore
node_player -->|"records plays"| node_playlog
node_queue -->|"controls queue"| node_player
node_libraryview -->|"reads library"| node_library
node_libraryview -->|"offers actions"| node_actions
node_libraryview -->|"opens importer"| node_import
node_libraryview -->|"renders songs"| node_songcell
node_downloads -->|"resolves tracks"| node_innertube
node_downloads -->|"stores status"| node_downloadstore
node_downloads -->|"updates library"| node_library
node_downloadstore -->|"reads library"| node_library
node_import -.->|"imports playlists"| node_library
node_account -->|"manages account"| node_cloud
node_cloud -->|"syncs library"| node_library
node_cloud -->|"uses social"| node_social
node_cloud -->|"uses history"| node_playlog
node_lyrics -->|"checks cached media"| node_downloadstore
node_lyrics -->|"reads tracks"| node_library
node_lyrics -->|"reads playback state"| node_player
node_lastfm -->|"reads playback"| node_player
node_lastfm -->|"uses history"| node_playlog
node_recap -->|"reads history"| node_playlog

click node_root "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/RootViewController.swift"
click node_home "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/HomeViewController.swift"
click node_search "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/SearchViewController.swift"
click node_musicpage "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/MusicPageViewController.swift"
click node_songcell "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/SongCell.swift"
click node_actions "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/SongActions.swift"
click node_nowplaying "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/NowPlayingViewController.swift"
click node_player "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/PlayerEngine.swift"
click node_queue "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/QueueViewController.swift"
click node_lyrics "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/Lyrics.swift"
click node_reverb "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/Reverb.swift"
click node_libraryview "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/LibraryViewController.swift"
click node_library "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/Library.swift"
click node_downloads "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/DownloadManager.swift"
click node_downloadstore "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/DownloadStore.swift"
click node_import "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/PlaylistImporter.swift"
click node_account "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/MochyAccountViewController.swift"
click node_cloud "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/MochyCloud.swift"
click node_social "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/CloudSocial.swift"
click node_innertube "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/InnerTube.swift"
click node_lastfm "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/LastFM.swift"
click node_playlog "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/PlayLog.swift"
click node_imageloader "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/ImageLoader.swift"
click node_theme "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/Theme.swift"
click node_spotifycanvas "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/SpotifyCanvas.swift"
click node_recap "https://github.com/hgphutjb/mochy-ios/blob/main/Sources/RecapViewController.swift"

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_root,node_home,node_search,node_musicpage,node_songcell,node_actions toneBlue
class node_nowplaying,node_player,node_queue,node_lyrics,node_reverb toneAmber
class node_libraryview,node_library,node_downloads,node_downloadstore,node_import,node_account toneMint
class node_cloud,node_social,node_innertube,node_lastfm,node_playlog,node_imageloader,node_theme,node_spotifycanvas,node_recap toneRose
class node_user toneIndigo
```

## Components

### App and discovery

- [App navigation](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/RootViewController.swift): `Sources/RootViewController.swift`
- [Home feed](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/HomeViewController.swift): `Sources/HomeViewController.swift`
- [Music search](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/SearchViewController.swift): `Sources/SearchViewController.swift`
- [Artist and album](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/MusicPageViewController.swift): `Sources/MusicPageViewController.swift`
- [Song rows](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/SongCell.swift): `Sources/SongCell.swift`
- [Song actions](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/SongActions.swift): `Sources/SongActions.swift`

### Playback experience

- [Now playing](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/NowPlayingViewController.swift): `Sources/NowPlayingViewController.swift`
- [Player engine](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/PlayerEngine.swift): `Sources/PlayerEngine.swift`
- [Playback queue](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/QueueViewController.swift): `Sources/QueueViewController.swift`
- [Lyrics](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/Lyrics.swift): `Sources/Lyrics.swift`
- [Audio effects](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/Reverb.swift): `Sources/Reverb.swift`

### Library and accounts

- [Library screens](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/LibraryViewController.swift): `Sources/LibraryViewController.swift`
- [Music library](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/Library.swift): `Sources/Library.swift`
- [Download manager](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/DownloadManager.swift): `Sources/DownloadManager.swift`
- [Download records](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/DownloadStore.swift): `Sources/DownloadStore.swift`
- [Playlist import](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/PlaylistImporter.swift): `Sources/PlaylistImporter.swift`
- [Account screens](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/MochyAccountViewController.swift): `Sources/MochyAccountViewController.swift`

### Music services

- [Mochy cloud](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/MochyCloud.swift): `Sources/MochyCloud.swift`
- [Cloud social](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/CloudSocial.swift): `Sources/CloudSocial.swift`
- [YouTube Music API](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/InnerTube.swift): `Sources/InnerTube.swift`
- [Last.fm integration](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/LastFM.swift): `Sources/LastFM.swift`
- [Listening history](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/PlayLog.swift): `Sources/PlayLog.swift`
- [Image loading](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/ImageLoader.swift): `Sources/ImageLoader.swift`
- [Theme system](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/Theme.swift): `Sources/Theme.swift`
- [Canvas media](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/SpotifyCanvas.swift): `Sources/SpotifyCanvas.swift`
- [Listening recap](https://github.com/hgphutjb/mochy-ios/blob/main/Sources/RecapViewController.swift): `Sources/RecapViewController.swift`

### Other components

- **Listener**

## Connections

- Listener → App navigation: opens app (evidence: `Sources/RootViewController.swift`)
- App navigation → Home feed: routes to (evidence: `Sources/RootViewController.swift`)
- App navigation → Library screens: routes to (evidence: `Sources/RootViewController.swift`)
- App navigation → Music search: routes to (evidence: `Sources/RootViewController.swift`)
- App navigation → Now playing: opens player (evidence: `Sources/RootViewController.swift`)
- Home feed → Music search: opens search
- Home feed → Artist and album: opens pages (evidence: `Sources/HomeViewController.swift`)
- Home feed → Image loading: loads artwork (evidence: `Sources/HomeViewController.swift`)
- Home feed → Cloud social: loads social (evidence: `Sources/HomeViewController.swift`)
- Music search → YouTube Music API: searches catalog (evidence: `Sources/SearchViewController.swift`)
- Music search → Mochy cloud: searches cloud (evidence: `Sources/SearchViewController.swift`)
- Artist and album → YouTube Music API: loads catalog pages (evidence: `Sources/MusicPageViewController.swift`)
- Artist and album → Image loading: loads artwork (evidence: `Sources/MusicPageViewController.swift`)
- Artist and album → Song rows: renders songs (evidence: `Sources/MusicPageViewController.swift`)
- Song rows → Song actions: opens actions (evidence: `Sources/SongCell.swift`)
- Song actions → Player engine: controls playback (evidence: `Sources/SongActions.swift`)
- Song actions → Music library: changes library (evidence: `Sources/SongActions.swift`)
- Song actions → Download manager: starts downloads (evidence: `Sources/SongActions.swift`)
- Song actions → Last.fm integration: loves tracks (evidence: `Sources/SongActions.swift`)
- Now playing → Player engine: controls playback (evidence: `Sources/NowPlayingViewController.swift`)
- Now playing → Lyrics: shows lyrics (evidence: `Sources/NowPlayingViewController.swift`)
- Now playing → Audio effects: controls effects (evidence: `Sources/NowPlayingViewController.swift`)
- Now playing → Canvas media: shows canvas (evidence: `Sources/NowPlayingViewController.swift`)
- Now playing → YouTube Music API: shows music pages (evidence: `Sources/NowPlayingViewController.swift`)
- Player engine → YouTube Music API: resolves streams (evidence: `Sources/PlayerEngine.swift`)
- Player engine → Music library: reads tracks (evidence: `Sources/PlayerEngine.swift`)
- Player engine → Download records: checks downloads (evidence: `Sources/PlayerEngine.swift`)
- Player engine → Listening history: records plays (evidence: `Sources/PlayerEngine.swift`)
- Playback queue → Player engine: controls queue (evidence: `Sources/QueueViewController.swift`)
- Library screens → Music library: reads library (evidence: `Sources/LibraryViewController.swift`)
- Library screens → Song actions: offers actions (evidence: `Sources/LibraryViewController.swift`)
- Library screens → Playlist import: opens importer (evidence: `Sources/LibraryViewController.swift`)
- Library screens → Song rows: renders songs (evidence: `Sources/LibraryViewController.swift`)
- Download manager → YouTube Music API: resolves tracks (evidence: `Sources/DownloadManager.swift`)
- Download manager → Download records: stores status (evidence: `Sources/DownloadManager.swift`)
- Download manager → Music library: updates library (evidence: `Sources/DownloadManager.swift`)
- Download records → Music library: reads library (evidence: `Sources/DownloadStore.swift`)
- Playlist import → Music library: imports playlists
- Account screens → Mochy cloud: manages account (evidence: `Sources/MochyAccountViewController.swift`)
- Mochy cloud → Music library: syncs library (evidence: `Sources/MochyCloud.swift`)
- Mochy cloud → Cloud social: uses social (evidence: `Sources/MochyCloud.swift`)
- Mochy cloud → Listening history: uses history (evidence: `Sources/MochyCloud.swift`)
- Lyrics → Download records: checks cached media (evidence: `Sources/Lyrics.swift`)
- Lyrics → Music library: reads tracks (evidence: `Sources/Lyrics.swift`)
- Lyrics → Player engine: reads playback state (evidence: `Sources/Lyrics.swift`)
- Last.fm integration → Player engine: reads playback (evidence: `Sources/LastFM.swift`)
- Last.fm integration → Listening history: uses history (evidence: `Sources/LastFM.swift`)
- Listening recap → Listening history: reads history (evidence: `Sources/RecapViewController.swift`)
