# mrtytanic/hakoto architecture

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

- Interactive diagram: https://gitdiagram.com/mrtytanic/hakoto
- Repository: https://github.com/mrtytanic/hakoto

## Overview

Hakoto is a local-first desktop catalog for physical music collections. Users manage albums and wishlist entries, organize owned albums into crates or virtual shelves, and review collection statistics; profile and display preferences personalize the workspace. Collection data and artwork remain local, with CSV portability and backup/restore. The React interface invokes a Tauri/Rust backend, which provides domain operations and local persistence. README capability descriptions support several unsampled branches; their specific frontend-to-backend wiring is not established by the excerpts, so those links are dashed and uncited.

Main entry points: [`src/App.tsx`](https://github.com/mrtytanic/hakoto/blob/main/src/App.tsx) (App shell), [`src-tauri/src/lib.rs`](https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/lib.rs) (Tauri commands), [`src-tauri/src/storage.rs`](https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/storage.rs) (Local storage), [`src-tauri/src/database.rs`](https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/database.rs) (Album operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Desktop workspace"]
  node_app["App shell<br/>[App.tsx]"]
end

subgraph group_organize["Collection organization"]
  node_collection["Album collection<br/>[Collection.tsx]"]
  node_albumdetail["Album editing<br/>[AlbumDetails.tsx]"]
  node_artworkui["Artwork handling<br/>[artwork.ts]"]
  node_crates["Custom crates<br/>[Crates.tsx]"]
  node_shelves["Virtual shelves<br/>[Shelves.tsx]"]
  node_shelfgrid["Shelf layout<br/>[ShelfGrid.tsx]"]
  node_shelfarrangement["Shelf arrangement"]
  node_shelfdrag["Drag placement<br/>[useShelfDrag.ts]"]
  node_favorites["Favorites and wishlist<br/>[Favorites.tsx]"]
end

subgraph group_insights["Insights and preferences"]
  node_statistics["Collection statistics<br/>[Statistics.tsx]"]
  node_profile["Profile settings<br/>[Settings.tsx]"]
  node_preferences["Display preferences<br/>[settings.ts]"]
end

subgraph group_portability["Data portability"]
  node_csv["CSV transfer<br/>[CollectionCsv.tsx]"]
  node_backup["Backup and restore"]
end

subgraph group_native["Native services"]
  node_nativeapi["Tauri commands<br/>[lib.rs]"]
  node_albumservice["Album operations<br/>[database.rs]"]
  node_crate_service["Crate operations<br/>[crates.rs]"]
  node_shelf_service["Shelf operations<br/>[shelves.rs]"]
  node_profile_service["Profile operations<br/>[profile.rs]"]
  node_artwork_service["Artwork storage<br/>[artwork.rs]"]
  node_storage[("Local storage<br/>[storage.rs]")]
  node_metadata["Metadata logic<br/>[metadata.rs]"]
  node_undo["Undo operations<br/>[undo.rs]"]
  node_csv_service["CSV service<br/>[collection_csv.rs]"]
  node_backup_service["Backup service<br/>[backup.rs]"]
end

node_user(("Collector"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_collection
node_app -->|"routes to"| node_crates
node_app -->|"routes to"| node_shelves
node_app -->|"routes to"| node_favorites
node_app -->|"routes to"| node_statistics
node_app -->|"routes to"| node_profile
node_app -->|"applies"| node_preferences
node_collection -->|"opens"| node_albumdetail
node_albumdetail -->|"encodes"| node_artworkui
node_shelves -->|"renders"| node_shelfgrid
node_shelfgrid -->|"uses"| node_shelfarrangement
node_shelfgrid -.->|"supports placement"| node_shelfdrag
node_shelfdrag -->|"uses"| node_shelfarrangement
node_collection -->|"invokes"| node_nativeapi
node_app -->|"invokes"| node_nativeapi
node_nativeapi -.->|"dispatches"| node_albumservice
node_nativeapi -.->|"dispatches"| node_crate_service
node_nativeapi -.->|"dispatches"| node_shelf_service
node_nativeapi -.->|"dispatches"| node_profile_service
node_nativeapi -.->|"dispatches"| node_csv_service
node_nativeapi -.->|"dispatches"| node_backup_service
node_albumservice -->|"persists in"| node_storage
node_crate_service -.->|"persists in"| node_storage
node_shelf_service -.->|"persists in"| node_storage
node_profile_service -.->|"persists in"| node_storage
node_artwork_service -->|"uses"| node_storage
node_albumservice -.->|"uses"| node_metadata
node_crate_service -->|"uses"| node_metadata
node_albumservice -.->|"supports undo"| node_undo
node_app -.->|"offers transfer"| node_csv
node_app -.->|"offers backup"| node_backup
node_csv -.->|"transfers data"| node_csv_service
node_backup -.->|"backs up"| node_backup_service
node_app -->|"supports favorites"| node_favorites
node_app -->|"shows insights"| node_statistics
node_app -->|"personalizes"| node_profile

click node_app "https://github.com/mrtytanic/hakoto/blob/main/src/App.tsx"
click node_collection "https://github.com/mrtytanic/hakoto/blob/main/src/pages/Collection.tsx"
click node_albumdetail "https://github.com/mrtytanic/hakoto/blob/main/src/components/albumdetails/AlbumDetails.tsx"
click node_artworkui "https://github.com/mrtytanic/hakoto/blob/main/src/artwork.ts"
click node_crates "https://github.com/mrtytanic/hakoto/blob/main/src/pages/Crates.tsx"
click node_shelves "https://github.com/mrtytanic/hakoto/blob/main/src/pages/Shelves.tsx"
click node_shelfgrid "https://github.com/mrtytanic/hakoto/blob/main/src/components/ShelfGrid.tsx"
click node_shelfarrangement "https://github.com/mrtytanic/hakoto/blob/main/src/shelfArrangement.ts"
click node_shelfdrag "https://github.com/mrtytanic/hakoto/blob/main/src/useShelfDrag.ts"
click node_favorites "https://github.com/mrtytanic/hakoto/blob/main/src/pages/Favorites.tsx"
click node_statistics "https://github.com/mrtytanic/hakoto/blob/main/src/pages/Statistics.tsx"
click node_profile "https://github.com/mrtytanic/hakoto/blob/main/src/pages/Settings.tsx"
click node_preferences "https://github.com/mrtytanic/hakoto/blob/main/src/settings.ts"
click node_csv "https://github.com/mrtytanic/hakoto/blob/main/src/components/CollectionCsv.tsx"
click node_backup "https://github.com/mrtytanic/hakoto/blob/main/src/components/CollectionBackup.tsx"
click node_nativeapi "https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/lib.rs"
click node_albumservice "https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/database.rs"
click node_crate_service "https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/crates.rs"
click node_shelf_service "https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/shelves.rs"
click node_profile_service "https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/profile.rs"
click node_artwork_service "https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/artwork.rs"
click node_storage "https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/storage.rs"
click node_metadata "https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/metadata.rs"
click node_undo "https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/undo.rs"
click node_csv_service "https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/collection_csv.rs"
click node_backup_service "https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/backup.rs"

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_app toneBlue
class node_collection,node_albumdetail,node_artworkui,node_crates,node_shelves,node_shelfgrid,node_shelfarrangement,node_shelfdrag,node_favorites toneAmber
class node_statistics,node_profile,node_preferences toneMint
class node_csv,node_backup toneRose
class node_nativeapi,node_albumservice,node_crate_service,node_shelf_service,node_profile_service,node_artwork_service,node_storage,node_metadata,node_undo,node_csv_service,node_backup_service,node_user toneIndigo
```

## Components

### Desktop workspace

- [App shell](https://github.com/mrtytanic/hakoto/blob/main/src/App.tsx): `src/App.tsx`

### Collection organization

- [Album collection](https://github.com/mrtytanic/hakoto/blob/main/src/pages/Collection.tsx): `src/pages/Collection.tsx`
- [Album editing](https://github.com/mrtytanic/hakoto/blob/main/src/components/albumdetails/AlbumDetails.tsx): `src/components/albumdetails/AlbumDetails.tsx`
- [Artwork handling](https://github.com/mrtytanic/hakoto/blob/main/src/artwork.ts): `src/artwork.ts`
- [Custom crates](https://github.com/mrtytanic/hakoto/blob/main/src/pages/Crates.tsx): `src/pages/Crates.tsx`
- [Virtual shelves](https://github.com/mrtytanic/hakoto/blob/main/src/pages/Shelves.tsx): `src/pages/Shelves.tsx`
- [Shelf layout](https://github.com/mrtytanic/hakoto/blob/main/src/components/ShelfGrid.tsx): `src/components/ShelfGrid.tsx`
- [Shelf arrangement](https://github.com/mrtytanic/hakoto/blob/main/src/shelfArrangement.ts): `src/shelfArrangement.ts`
- [Drag placement](https://github.com/mrtytanic/hakoto/blob/main/src/useShelfDrag.ts): `src/useShelfDrag.ts`
- [Favorites and wishlist](https://github.com/mrtytanic/hakoto/blob/main/src/pages/Favorites.tsx): `src/pages/Favorites.tsx`

### Insights and preferences

- [Collection statistics](https://github.com/mrtytanic/hakoto/blob/main/src/pages/Statistics.tsx): `src/pages/Statistics.tsx`
- [Profile settings](https://github.com/mrtytanic/hakoto/blob/main/src/pages/Settings.tsx): `src/pages/Settings.tsx`
- [Display preferences](https://github.com/mrtytanic/hakoto/blob/main/src/settings.ts): `src/settings.ts`

### Data portability

- [CSV transfer](https://github.com/mrtytanic/hakoto/blob/main/src/components/CollectionCsv.tsx): `src/components/CollectionCsv.tsx`
- [Backup and restore](https://github.com/mrtytanic/hakoto/blob/main/src/components/CollectionBackup.tsx): `src/components/CollectionBackup.tsx`

### Native services

- [Tauri commands](https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`
- [Album operations](https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/database.rs): `src-tauri/src/database.rs`
- [Crate operations](https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/crates.rs): `src-tauri/src/crates.rs`
- [Shelf operations](https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/shelves.rs): `src-tauri/src/shelves.rs`
- [Profile operations](https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/profile.rs): `src-tauri/src/profile.rs`
- [Artwork storage](https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/artwork.rs): `src-tauri/src/artwork.rs`
- [Local storage](https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/storage.rs): `src-tauri/src/storage.rs`
- [Metadata logic](https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/metadata.rs): `src-tauri/src/metadata.rs`
- [Undo operations](https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/undo.rs): `src-tauri/src/undo.rs`
- [CSV service](https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/collection_csv.rs): `src-tauri/src/collection_csv.rs`
- [Backup service](https://github.com/mrtytanic/hakoto/blob/main/src-tauri/src/backup.rs): `src-tauri/src/backup.rs`

### Other components

- **Collector**

## Connections

- Collector → App shell: uses
- App shell → Album collection: routes to (evidence: `src/App.tsx`)
- App shell → Custom crates: routes to (evidence: `src/App.tsx`)
- App shell → Virtual shelves: routes to (evidence: `src/App.tsx`)
- App shell → Favorites and wishlist: routes to (evidence: `src/App.tsx`)
- App shell → Collection statistics: routes to (evidence: `src/App.tsx`)
- App shell → Profile settings: routes to (evidence: `src/App.tsx`)
- App shell → Display preferences: applies (evidence: `src/App.tsx`)
- Album collection → Album editing: opens (evidence: `src/pages/Collection.tsx`)
- Album editing → Artwork handling: encodes (evidence: `src/components/albumdetails/AlbumDetails.tsx`)
- Virtual shelves → Shelf layout: renders (evidence: `src/pages/Shelves.tsx`)
- Shelf layout → Shelf arrangement: uses (evidence: `src/components/ShelfGrid.tsx`)
- Shelf layout → Drag placement: supports placement
- Drag placement → Shelf arrangement: uses (evidence: `src/useShelfDrag.ts`)
- Album collection → Tauri commands: invokes (evidence: `src/pages/Collection.tsx`)
- App shell → Tauri commands: invokes (evidence: `src/App.tsx`)
- Tauri commands → Album operations: dispatches (evidence: `src-tauri/src/lib.rs`)
- Tauri commands → Crate operations: dispatches (evidence: `src-tauri/src/lib.rs`)
- Tauri commands → Shelf operations: dispatches (evidence: `src-tauri/src/lib.rs`)
- Tauri commands → Profile operations: dispatches (evidence: `src-tauri/src/lib.rs`)
- Tauri commands → CSV service: dispatches (evidence: `src-tauri/src/lib.rs`)
- Tauri commands → Backup service: dispatches (evidence: `src-tauri/src/lib.rs`)
- Album operations → Local storage: persists in (evidence: `src-tauri/src/database.rs`)
- Crate operations → Local storage: persists in (evidence: `src-tauri/src/storage.rs`)
- Shelf operations → Local storage: persists in (evidence: `src-tauri/src/shelves.rs`)
- Profile operations → Local storage: persists in (evidence: `src-tauri/src/profile.rs`)
- Artwork storage → Local storage: uses (evidence: `src-tauri/src/artwork.rs`)
- Album operations → Metadata logic: uses (evidence: `src-tauri/src/database.rs`)
- Crate operations → Metadata logic: uses (evidence: `src-tauri/src/crates.rs`)
- Album operations → Undo operations: supports undo (evidence: `src-tauri/src/database.rs`)
- App shell → CSV transfer: offers transfer
- App shell → Backup and restore: offers backup
- CSV transfer → CSV service: transfers data
- Backup and restore → Backup service: backs up
- App shell → Favorites and wishlist: supports favorites (evidence: `src/App.tsx`)
- App shell → Collection statistics: shows insights (evidence: `src/App.tsx`)
- App shell → Profile settings: personalizes (evidence: `src/App.tsx`)
