Overview
The library data model: one SQLite file, the tables behind each surface, and how third-party DJ libraries feed it.
Mixar has exactly one library per user. The library crate (LibraryManager) implements the library-core traits Library + WritableLibrary and stores everything in a single SQLite file, library.db. Storage is an implementation detail: nothing outside the crate depends on the schema.
Runtime contracts: docs/tech-spec.md §5 (Library Manager (Collections Model)). Analysis policy, storage schema, and tag write-back: docs/audio-analyzer-spec.md.
What lives where
| Data | Home |
|---|---|
| Tracks, collections (folders + playlists), membership | library.db tables tracks, collections, collection_entries |
| Offline analysis (BPM, key, confidences, beat grid JSON, loudness) | track_analysis |
| Hot cues and saved loops | track_hot_cue, track_loop |
| Waveform overviews | track_waveform |
| Performance history | XSPF files under app support + a session index in library.db |
| Stem caches, models | app-support directories owned by the stem pipeline |
Adapters
Third-party DJ libraries are read through library-adapters, which implement Library + Migratable and write into the user’s one library rather than a second parallel manager. Shipped sources are Mixxx and Rekordbox 6/7. Rekordbox’s SQLCipher master.db and its -wal are copied into a private directory and opened read-only there; the shared-memory -shm is never copied, because SQLite rebuilds it. The crate README gives the passphrase and the workspace-wide SQLCipher build that enables it. Cues and loops come through WritableLibrary::import_hot_cue / import_loop, so an importer can populate track_hot_cue / track_loop without touching the store.
Source of truth
library.db is always the source of truth for track information. File tags are an input on import and analysis (see the merge policy in docs/audio-analyzer-spec.md §9), and an optional output; see below.
Pages
- Tag write-back: the opt-in mirror of app-managed BPM/key into file tags, with the per-format field matrix and its lossiness.
- CDJ USB export: the DeviceSQL database and ANLZ analysis writers, the drive layout they produce, and how the output is verified.
- Import adapters (Mixxx, Rekordbox): the repository’s
crates/library-adapters/README.mddocuments detection, schema mapping, dropped data, and the cue import path.
Related
- Engine handoff:
LibraryManager::prepare_track_for_playback→PreparedTrackPlayback(deck load path, including pre-analysis and stem resolution). - Deck UI and library table:
docs/deck-spec.md.