# hydrened/heko architecture

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

- Interactive diagram: https://gitdiagram.com/hydrened/heko
- Repository: https://github.com/hydrened/heko

## Overview

Heko Player is an Electron desktop music player. The renderer workflow initializes the account and opens the playlist manager; playlist actions support managing and ordering playlists, while the current-playlist view represents selected and merged playlists. The renderer API also reaches the remote Heko service, and the main process exposes desktop capabilities through a preload bridge. The graph preserves the visible account, artist, song, playlist, playback, and desktop-API areas. Some main-process wiring and manager behavior are not shown in excerpts, so uncertain relationships are omitted.

Main entry points: [`src/ts/renderer/app.ts`](https://github.com/hydrened/heko/blob/main/src/ts/renderer/app.ts) (App lifecycle), [`src/ts/main/api/api.ts`](https://github.com/hydrened/heko/blob/main/src/ts/main/api/api.ts) (Main API), [`src/ts/renderer/utils/utils.api.ts`](https://github.com/hydrened/heko/blob/main/src/ts/renderer/utils/utils.api.ts) (Renderer API), [`src/ts/renderer/playlist-manager/playlist-manager.events.ts`](https://github.com/hydrened/heko/blob/main/src/ts/renderer/playlist-manager/playlist-manager.events.ts) (Playlist events)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_renderer["Player interface"]
  node_renderer_entry["Renderer entry<br/>[main.ts]"]
  node_app["App lifecycle<br/>[app.ts]"]
end

subgraph group_library["Library management"]
  node_account["Account manager<br/>[account-manager.ts]"]
  node_playlist["Playlist manager"]
  node_playlist_events["Playlist events"]
  node_playlist_order["Playlist ordering"]
  node_current_playlist["Current playlist"]
  node_current_events["Current playlist events"]
  node_song["Song manager<br/>[song-manager.ts]"]
  node_artist["Artist manager<br/>[artist-manager.ts]"]
end

subgraph group_desktop["Desktop integration"]
  node_renderer_api["Renderer API<br/>[utils.api.ts]"]
  node_main_api["Main API<br/>[api.ts]"]
  node_dialog_api["File dialogs<br/>[api.dialog.ts]"]
  node_files_api["File access<br/>[api.files.ts]"]
  node_temp_api["Temporary files<br/>[api.temp.ts]"]
  node_preload["Preload bridge<br/>[preload.ts]"]
  node_main_window["Desktop window<br/>[window.ts]"]
  node_main_process["Main process<br/>[index.ts]"]
end

subgraph group_presentation["Interface presentation"]
  node_ui_document["Player document<br/>[index.html]"]
  node_ui_styles["Player styles<br/>[main.css]"]
end

node_user(("Listener"))
node_remote_service["Heko service"]

node_user -.->|"uses"| node_renderer_entry
node_renderer_entry -->|"starts"| node_app
node_app -->|"initializes"| node_account
node_app -->|"opens"| node_playlist
node_app -->|"creates"| node_song
node_app -->|"creates"| node_artist
node_app -->|"creates"| node_current_playlist
node_app -->|"registers lifecycle"| node_renderer_api
node_playlist -->|"uses events"| node_playlist_events
node_playlist_events -->|"dispatches input"| node_playlist_order
node_playlist_order -->|"sets position"| node_renderer_api
node_playlist_events -->|"updates opened state"| node_renderer_api
node_playlist_events -.->|"requests playlist actions"| node_remote_service
node_renderer_api -->|"posts requests"| node_remote_service
node_renderer_api -->|"uses desktop bridge"| node_preload
node_main_process -->|"imports"| node_main_window
node_main_process -->|"imports"| node_main_api
node_main_api -.->|"registers"| node_dialog_api
node_main_api -.->|"registers"| node_files_api
node_main_api -.->|"registers"| node_temp_api
node_preload -.->|"exposes API"| node_main_api
node_renderer_entry -.->|"renders in"| node_ui_document
node_ui_document -.->|"uses styles"| node_ui_styles

click node_renderer_entry "https://github.com/hydrened/heko/blob/main/src/ts/renderer/main.ts"
click node_app "https://github.com/hydrened/heko/blob/main/src/ts/renderer/app.ts"
click node_account "https://github.com/hydrened/heko/blob/main/src/ts/renderer/account-manager/account-manager.ts"
click node_playlist "https://github.com/hydrened/heko/blob/main/src/ts/renderer/playlist-manager/playlist-manager.ts"
click node_playlist_events "https://github.com/hydrened/heko/blob/main/src/ts/renderer/playlist-manager/playlist-manager.events.ts"
click node_playlist_order "https://github.com/hydrened/heko/blob/main/src/ts/renderer/playlist-manager/playlist-manager.ordering.ts"
click node_current_playlist "https://github.com/hydrened/heko/blob/main/src/ts/renderer/current-playlist-manager/current-playlist-manager.ts"
click node_current_events "https://github.com/hydrened/heko/blob/main/src/ts/renderer/current-playlist-manager/current-playlist-manager.events.ts"
click node_song "https://github.com/hydrened/heko/blob/main/src/ts/renderer/song-manager/song-manager.ts"
click node_artist "https://github.com/hydrened/heko/blob/main/src/ts/renderer/artist-manager/artist-manager.ts"
click node_renderer_api "https://github.com/hydrened/heko/blob/main/src/ts/renderer/utils/utils.api.ts"
click node_main_api "https://github.com/hydrened/heko/blob/main/src/ts/main/api/api.ts"
click node_dialog_api "https://github.com/hydrened/heko/blob/main/src/ts/main/api/api.dialog.ts"
click node_files_api "https://github.com/hydrened/heko/blob/main/src/ts/main/api/api.files.ts"
click node_temp_api "https://github.com/hydrened/heko/blob/main/src/ts/main/api/api.temp.ts"
click node_preload "https://github.com/hydrened/heko/blob/main/src/ts/main/preload.ts"
click node_main_window "https://github.com/hydrened/heko/blob/main/src/ts/main/window.ts"
click node_main_process "https://github.com/hydrened/heko/blob/main/src/ts/main/index.ts"
click node_ui_document "https://github.com/hydrened/heko/blob/main/src/index.html"
click node_ui_styles "https://github.com/hydrened/heko/blob/main/src/css/main.css"

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_renderer_entry,node_app toneBlue
class node_account,node_playlist,node_playlist_events,node_playlist_order,node_current_playlist,node_current_events,node_song,node_artist toneAmber
class node_renderer_api,node_main_api,node_dialog_api,node_files_api,node_temp_api,node_preload,node_main_window,node_main_process toneMint
class node_ui_document,node_ui_styles toneRose
class node_user,node_remote_service toneIndigo
```

## Components

### Player interface

- [Renderer entry](https://github.com/hydrened/heko/blob/main/src/ts/renderer/main.ts): `src/ts/renderer/main.ts`
- [App lifecycle](https://github.com/hydrened/heko/blob/main/src/ts/renderer/app.ts): `src/ts/renderer/app.ts`

### Library management

- [Account manager](https://github.com/hydrened/heko/blob/main/src/ts/renderer/account-manager/account-manager.ts): `src/ts/renderer/account-manager/account-manager.ts`
- [Playlist manager](https://github.com/hydrened/heko/blob/main/src/ts/renderer/playlist-manager/playlist-manager.ts): `src/ts/renderer/playlist-manager/playlist-manager.ts`
- [Playlist events](https://github.com/hydrened/heko/blob/main/src/ts/renderer/playlist-manager/playlist-manager.events.ts): `src/ts/renderer/playlist-manager/playlist-manager.events.ts`
- [Playlist ordering](https://github.com/hydrened/heko/blob/main/src/ts/renderer/playlist-manager/playlist-manager.ordering.ts): `src/ts/renderer/playlist-manager/playlist-manager.ordering.ts`
- [Current playlist](https://github.com/hydrened/heko/blob/main/src/ts/renderer/current-playlist-manager/current-playlist-manager.ts): `src/ts/renderer/current-playlist-manager/current-playlist-manager.ts`
- [Current playlist events](https://github.com/hydrened/heko/blob/main/src/ts/renderer/current-playlist-manager/current-playlist-manager.events.ts): `src/ts/renderer/current-playlist-manager/current-playlist-manager.events.ts`
- [Song manager](https://github.com/hydrened/heko/blob/main/src/ts/renderer/song-manager/song-manager.ts): `src/ts/renderer/song-manager/song-manager.ts`
- [Artist manager](https://github.com/hydrened/heko/blob/main/src/ts/renderer/artist-manager/artist-manager.ts): `src/ts/renderer/artist-manager/artist-manager.ts`

### Desktop integration

- [Renderer API](https://github.com/hydrened/heko/blob/main/src/ts/renderer/utils/utils.api.ts): `src/ts/renderer/utils/utils.api.ts`
- [Main API](https://github.com/hydrened/heko/blob/main/src/ts/main/api/api.ts): `src/ts/main/api/api.ts`
- [File dialogs](https://github.com/hydrened/heko/blob/main/src/ts/main/api/api.dialog.ts): `src/ts/main/api/api.dialog.ts`
- [File access](https://github.com/hydrened/heko/blob/main/src/ts/main/api/api.files.ts): `src/ts/main/api/api.files.ts`
- [Temporary files](https://github.com/hydrened/heko/blob/main/src/ts/main/api/api.temp.ts): `src/ts/main/api/api.temp.ts`
- [Preload bridge](https://github.com/hydrened/heko/blob/main/src/ts/main/preload.ts): `src/ts/main/preload.ts`
- [Desktop window](https://github.com/hydrened/heko/blob/main/src/ts/main/window.ts): `src/ts/main/window.ts`
- [Main process](https://github.com/hydrened/heko/blob/main/src/ts/main/index.ts): `src/ts/main/index.ts`

### Interface presentation

- [Player document](https://github.com/hydrened/heko/blob/main/src/index.html): `src/index.html`
- [Player styles](https://github.com/hydrened/heko/blob/main/src/css/main.css): `src/css/main.css`

### Other components

- **Listener**
- **Heko service**

## Connections

- Listener → Renderer entry: uses
- Renderer entry → App lifecycle: starts (evidence: `src/ts/renderer/main.ts`)
- App lifecycle → Account manager: initializes (evidence: `src/ts/renderer/app.ts`)
- App lifecycle → Playlist manager: opens (evidence: `src/ts/renderer/app.ts`)
- App lifecycle → Song manager: creates (evidence: `src/ts/renderer/app.ts`)
- App lifecycle → Artist manager: creates (evidence: `src/ts/renderer/app.ts`)
- App lifecycle → Current playlist: creates (evidence: `src/ts/renderer/app.ts`)
- App lifecycle → Renderer API: registers lifecycle (evidence: `src/ts/renderer/app.ts`)
- Playlist manager → Playlist events: uses events (evidence: `src/ts/renderer/playlist-manager/playlist-manager.ts`)
- Playlist events → Playlist ordering: dispatches input (evidence: `src/ts/renderer/playlist-manager/playlist-manager.events.ts`)
- Playlist ordering → Renderer API: sets position (evidence: `src/ts/renderer/playlist-manager/playlist-manager.ordering.ts`)
- Playlist events → Renderer API: updates opened state (evidence: `src/ts/renderer/playlist-manager/playlist-manager.events.ts`)
- Playlist events → Heko service: requests playlist actions
- Renderer API → Heko service: posts requests (evidence: `src/ts/renderer/utils/utils.api.ts`)
- Renderer API → Preload bridge: uses desktop bridge (evidence: `src/ts/renderer/utils/utils.api.ts`)
- Main process → Desktop window: imports (evidence: `src/ts/main/index.ts`)
- Main process → Main API: imports (evidence: `src/ts/main/index.ts`)
- Main API → File dialogs: registers (evidence: `src/ts/main/api/api.ts`)
- Main API → File access: registers (evidence: `src/ts/main/api/api.ts`)
- Main API → Temporary files: registers (evidence: `src/ts/main/api/api.ts`)
- Preload bridge → Main API: exposes API
- Renderer entry → Player document: renders in
- Player document → Player styles: uses styles
