# sen-to/mochi_player architecture

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

- Interactive diagram: https://gitdiagram.com/sen-to/mochi_player
- Repository: https://github.com/sen-to/mochi_player

## Overview

Mochi Player is a local-first desktop media library and player. Users configure TMDB and media sources, scan local or network locations, browse the resulting catalog and metadata, then play media and resume from saved progress. The graph also includes documented home, detail, playback-window, subtitle/audio, and appearance capabilities. README statements support the workflow links; sampled source is limited to native window runners, so internal Dart call ownership is not verified and is not inferred.

Main entry points: [`lib/features/library/infrastructure/storage_media_scanner.dart`](https://github.com/sen-to/mochi_player/blob/master/lib/features/library/infrastructure/storage_media_scanner.dart) (Media scanning), [`lib/features/settings/presentation/pages/settings_page.dart`](https://github.com/sen-to/mochi_player/blob/master/lib/features/settings/presentation/pages/settings_page.dart) (Settings interface), [`lib/core/infrastructure/tmdb/tmdb_service.dart`](https://github.com/sen-to/mochi_player/blob/master/lib/core/infrastructure/tmdb/tmdb_service.dart) (TMDB service), [`lib/features/playback/application/playback_session_controller.dart`](https://github.com/sen-to/mochi_player/blob/master/lib/features/playback/application/playback_session_controller.dart) (Playback session)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application UI"]
  node_shell["App shell"]
  node_home["Home discovery<br/>[home_content.dart]"]
end

subgraph group_library["Media Library"]
  node_library_ui["Library browsing<br/>[library_page.dart]"]
  node_file_browser["File browser"]
  node_detail["Media details"]
  node_scanner["Media scanning"]
  node_catalog["Library catalog"]
  node_scraper["Metadata scraping"]
end

subgraph group_infra["Core Infrastructure"]
  node_media_domain["Media models<br/>[models.dart]"]
  node_db[("Local database")]
  node_sources["Source management"]
  node_local["Local storage"]
  node_webdav["WebDAV storage"]
  node_smb["SMB storage"]
  node_tmdb["TMDB service<br/>[tmdb_service.dart]"]
end

subgraph group_playback["Playback"]
  node_player["Player interface<br/>[player_page.dart]"]
  node_session["Playback session"]
  node_progress["Progress writer"]
end

subgraph group_settings["Settings"]
  node_settings_ui["Settings interface<br/>[settings_page.dart]"]
  node_settings_service["Settings service"]
  node_theme["Theme controls"]
end

node_user(("Viewer"))
node_tmdb_api{{"TMDB API"}}
node_media_files{{"Media locations"}}

node_user -->|"opens"| node_shell
node_shell -->|"shows"| node_home
node_user -->|"configures"| node_settings_ui
node_settings_ui -->|"sets preferences"| node_settings_service
node_settings_ui -->|"adds sources"| node_sources
node_settings_ui -->|"sets API key"| node_tmdb
node_settings_ui -->|"chooses appearance"| node_theme
node_user -->|"starts scan"| node_scanner
node_scanner -->|"enumerates local"| node_local
node_scanner -->|"enumerates WebDAV"| node_webdav
node_scanner -->|"enumerates SMB"| node_smb
node_scanner -->|"discovers files"| node_media_files
node_scanner -->|"indexes media"| node_catalog
node_catalog -->|"stores catalog"| node_db
node_scanner -->|"matches metadata"| node_scraper
node_scraper -->|"requests metadata"| node_tmdb
node_tmdb -->|"queries"| node_tmdb_api
node_tmdb -->|"enriches catalog"| node_catalog
node_user -->|"browses"| node_library_ui
node_user -->|"browses files"| node_file_browser
node_library_ui -->|"opens details"| node_detail
node_user -->|"plays media"| node_player
node_player -->|"controls playback"| node_session
node_session -->|"plays locations"| node_media_files
node_session -->|"records progress"| node_progress
node_progress -->|"saves progress"| node_db
node_detail -.->|"starts playback"| node_player

click node_shell "https://github.com/sen-to/mochi_player/blob/master/lib/app/presentation/pages/app_shell_page.dart"
click node_home "https://github.com/sen-to/mochi_player/blob/master/lib/features/home/presentation/widgets/home_content.dart"
click node_library_ui "https://github.com/sen-to/mochi_player/blob/master/lib/features/library/presentation/pages/library_page.dart"
click node_file_browser "https://github.com/sen-to/mochi_player/blob/master/lib/features/library/presentation/pages/file_browser_page.dart"
click node_detail "https://github.com/sen-to/mochi_player/blob/master/lib/features/library/presentation/pages/media_detail_page.dart"
click node_scanner "https://github.com/sen-to/mochi_player/blob/master/lib/features/library/infrastructure/storage_media_scanner.dart"
click node_catalog "https://github.com/sen-to/mochi_player/blob/master/lib/features/library/application/media_library_catalog.dart"
click node_scraper "https://github.com/sen-to/mochi_player/blob/master/lib/features/library/infrastructure/metadata_scraper.dart"
click node_media_domain "https://github.com/sen-to/mochi_player/blob/master/lib/core/domain/media/models.dart"
click node_db "https://github.com/sen-to/mochi_player/blob/master/lib/core/infrastructure/database/database_service.dart"
click node_sources "https://github.com/sen-to/mochi_player/blob/master/lib/core/infrastructure/storage/storage_source_service.dart"
click node_local "https://github.com/sen-to/mochi_player/blob/master/lib/core/infrastructure/storage/local_storage_provider.dart"
click node_webdav "https://github.com/sen-to/mochi_player/blob/master/lib/core/infrastructure/storage/webdav_storage_provider.dart"
click node_smb "https://github.com/sen-to/mochi_player/blob/master/lib/core/infrastructure/storage/smb_storage_provider.dart"
click node_tmdb "https://github.com/sen-to/mochi_player/blob/master/lib/core/infrastructure/tmdb/tmdb_service.dart"
click node_player "https://github.com/sen-to/mochi_player/blob/master/lib/features/playback/presentation/pages/player_page.dart"
click node_session "https://github.com/sen-to/mochi_player/blob/master/lib/features/playback/application/playback_session_controller.dart"
click node_progress "https://github.com/sen-to/mochi_player/blob/master/lib/features/playback/application/playback_progress_writer.dart"
click node_settings_ui "https://github.com/sen-to/mochi_player/blob/master/lib/features/settings/presentation/pages/settings_page.dart"
click node_settings_service "https://github.com/sen-to/mochi_player/blob/master/lib/features/settings/infrastructure/app_settings_service.dart"
click node_theme "https://github.com/sen-to/mochi_player/blob/master/lib/features/settings/application/theme_provider.dart"

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_shell,node_home,node_user toneBlue
class node_library_ui,node_file_browser,node_detail,node_scanner,node_catalog,node_scraper toneAmber
class node_media_domain,node_db,node_sources,node_local,node_webdav,node_smb,node_tmdb,node_tmdb_api toneMint
class node_player,node_session,node_progress toneRose
class node_settings_ui,node_settings_service,node_theme,node_media_files toneIndigo
```

## Components

### Application UI

- [App shell](https://github.com/sen-to/mochi_player/blob/master/lib/app/presentation/pages/app_shell_page.dart): `lib/app/presentation/pages/app_shell_page.dart`
- [Home discovery](https://github.com/sen-to/mochi_player/blob/master/lib/features/home/presentation/widgets/home_content.dart): `lib/features/home/presentation/widgets/home_content.dart`

### Media Library

- [Library browsing](https://github.com/sen-to/mochi_player/blob/master/lib/features/library/presentation/pages/library_page.dart): `lib/features/library/presentation/pages/library_page.dart`
- [File browser](https://github.com/sen-to/mochi_player/blob/master/lib/features/library/presentation/pages/file_browser_page.dart): `lib/features/library/presentation/pages/file_browser_page.dart`
- [Media details](https://github.com/sen-to/mochi_player/blob/master/lib/features/library/presentation/pages/media_detail_page.dart): `lib/features/library/presentation/pages/media_detail_page.dart`
- [Media scanning](https://github.com/sen-to/mochi_player/blob/master/lib/features/library/infrastructure/storage_media_scanner.dart): `lib/features/library/infrastructure/storage_media_scanner.dart`
- [Library catalog](https://github.com/sen-to/mochi_player/blob/master/lib/features/library/application/media_library_catalog.dart): `lib/features/library/application/media_library_catalog.dart`
- [Metadata scraping](https://github.com/sen-to/mochi_player/blob/master/lib/features/library/infrastructure/metadata_scraper.dart): `lib/features/library/infrastructure/metadata_scraper.dart`

### Core Infrastructure

- [Media models](https://github.com/sen-to/mochi_player/blob/master/lib/core/domain/media/models.dart): `lib/core/domain/media/models.dart`
- [Local database](https://github.com/sen-to/mochi_player/blob/master/lib/core/infrastructure/database/database_service.dart): `lib/core/infrastructure/database/database_service.dart`
- [Source management](https://github.com/sen-to/mochi_player/blob/master/lib/core/infrastructure/storage/storage_source_service.dart): `lib/core/infrastructure/storage/storage_source_service.dart`
- [Local storage](https://github.com/sen-to/mochi_player/blob/master/lib/core/infrastructure/storage/local_storage_provider.dart): `lib/core/infrastructure/storage/local_storage_provider.dart`
- [WebDAV storage](https://github.com/sen-to/mochi_player/blob/master/lib/core/infrastructure/storage/webdav_storage_provider.dart): `lib/core/infrastructure/storage/webdav_storage_provider.dart`
- [SMB storage](https://github.com/sen-to/mochi_player/blob/master/lib/core/infrastructure/storage/smb_storage_provider.dart): `lib/core/infrastructure/storage/smb_storage_provider.dart`
- [TMDB service](https://github.com/sen-to/mochi_player/blob/master/lib/core/infrastructure/tmdb/tmdb_service.dart): `lib/core/infrastructure/tmdb/tmdb_service.dart`

### Playback

- [Player interface](https://github.com/sen-to/mochi_player/blob/master/lib/features/playback/presentation/pages/player_page.dart): `lib/features/playback/presentation/pages/player_page.dart`
- [Playback session](https://github.com/sen-to/mochi_player/blob/master/lib/features/playback/application/playback_session_controller.dart): `lib/features/playback/application/playback_session_controller.dart`
- [Progress writer](https://github.com/sen-to/mochi_player/blob/master/lib/features/playback/application/playback_progress_writer.dart): `lib/features/playback/application/playback_progress_writer.dart`

### Settings

- [Settings interface](https://github.com/sen-to/mochi_player/blob/master/lib/features/settings/presentation/pages/settings_page.dart): `lib/features/settings/presentation/pages/settings_page.dart`
- [Settings service](https://github.com/sen-to/mochi_player/blob/master/lib/features/settings/infrastructure/app_settings_service.dart): `lib/features/settings/infrastructure/app_settings_service.dart`
- [Theme controls](https://github.com/sen-to/mochi_player/blob/master/lib/features/settings/application/theme_provider.dart): `lib/features/settings/application/theme_provider.dart`

### Other components

- **Viewer**
- **TMDB API**
- **Media locations**

## Connections

- Viewer → App shell: opens (evidence: `README.md`)
- App shell → Home discovery: shows (evidence: `README.md`)
- Viewer → Settings interface: configures (evidence: `README.md`)
- Settings interface → Settings service: sets preferences (evidence: `README.md`)
- Settings interface → Source management: adds sources (evidence: `README.md`)
- Settings interface → TMDB service: sets API key (evidence: `README.md`)
- Settings interface → Theme controls: chooses appearance (evidence: `README.md`)
- Viewer → Media scanning: starts scan (evidence: `README.md`)
- Media scanning → Local storage: enumerates local (evidence: `README.md`)
- Media scanning → WebDAV storage: enumerates WebDAV (evidence: `README.md`)
- Media scanning → SMB storage: enumerates SMB (evidence: `README.md`)
- Media scanning → Media locations: discovers files (evidence: `README.md`)
- Media scanning → Library catalog: indexes media (evidence: `README.md`)
- Library catalog → Local database: stores catalog (evidence: `README.md`)
- Media scanning → Metadata scraping: matches metadata (evidence: `README.md`)
- Metadata scraping → TMDB service: requests metadata (evidence: `README.md`)
- TMDB service → TMDB API: queries (evidence: `README.md`)
- TMDB service → Library catalog: enriches catalog (evidence: `README.md`)
- Viewer → Library browsing: browses (evidence: `README.md`)
- Viewer → File browser: browses files (evidence: `README.md`)
- Library browsing → Media details: opens details (evidence: `README.md`)
- Viewer → Player interface: plays media (evidence: `README.md`)
- Player interface → Playback session: controls playback (evidence: `README.md`)
- Playback session → Media locations: plays locations (evidence: `README.md`)
- Playback session → Progress writer: records progress (evidence: `README.md`)
- Progress writer → Local database: saves progress (evidence: `README.md`)
- Media details → Player interface: starts playback
