Architecture

Codebase structure

Moku’s frontend is SvelteKit; its native shell is Tauri v2. Routes are thin, almost all UI logic lives under src/lib.

Top level

src/SvelteKit frontend (Svelte 5 runes, TypeScript)
src-tauri/Tauri v2 Rust shell
static/Assets served as-is
packaging/Flatpak, AppStream, and Arch PKGBUILD packaging
nix/Nix package derivation, dev shell, and pinned versions
scripts/Build helpers, including staging the Tsunagu sidecar binary

src/lib

components/One folder per feature area: reader/player under media/, plus library, extensions, downloads, tracking, series, settings, chrome, and more
state/Global state, one *.svelte.ts file per domain, built on Svelte 5 runes rather than the older store API
server-adapters/tsunagu/One file per backend domain (library, folders, downloads, extensions, trackers, and so on), aggregated into a single tsunagu object
graphql/A small hand-written fetch-based GraphQL client, no codegen
platform-adapters/ + platform-service/A shared interface with separate Tauri and web implementations, so the same codebase targets both a desktop build and a plain web build
core/Framework-agnostic logic: caching, keybind engine, persistence, cover resolution

src-tauri

src/lib.rsApp bootstrap: single-instance handling, plugin registration, tray icon, shutdown
src/backend.rsSupervises the bundled Tsunagu process, see Design choices
src/commands/Tauri commands grouped by domain: backup, biometric auth, storage, system, updater