How michaelchung888/audiostash works
AudioStash is an offline-first Android music library backed by an API and a home-PC worker. The principal workflow is: request a download in the app, queue and process it on the worker, store the audio, then synchronize the resulting library entry and file back to the phone for offline playback. The graph also includes catalog discovery, playlists, and the server/mobile data layers. Some subsystem links are documented only at a high level in the README; unsampled implementation details are not asserted.
Main entry points: item.ts Worker job runtime · worker-jobs.ts Download orchestration · app Library and discovery UI · api API client and queries
Components 26
Android app
- Library and discovery UI
apps/mobile/src/app - API client and queries
apps/mobile/src/api - Two-way sync engine
apps/mobile/src/sync/engine.ts - Offline library database
apps/mobile/src/db/database.ts - Music folder mirror
apps/mobile/src/files - Offline player and queue
apps/mobile/src/player
API and data
- HTTP API and routing
apps/api/src/app.ts - Service composition
apps/api/src/context.ts - Download orchestration
apps/api/src/services/worker-jobs.ts - Catalog services
apps/api/src/services/catalog.ts - Object storage access
apps/api/src/services/storage.ts - Library and job data
apps/api/src/db - Postgres
packages/db/src/schema.ts - Live event stream
apps/api/src/realtime
Home worker
- Worker job runtime
apps/worker/src/jobs/item.ts - Source resolution
apps/worker/src/pipeline/find-source.ts - YouTube downloader
apps/worker/src/tools/ytdlp.ts - Metadata and lyrics
apps/worker/src/pipeline/metadata.ts - Audio conversion and tagging
apps/worker/src/tools/ffmpeg.ts - Worker API client
apps/worker/src/api/client.ts
Shared packages
- Job queues and events
packages/messaging/src/jobs.ts - Music catalog clients
packages/catalog/src - Shared request and event shapes
packages/contracts/src/common.ts - Matching and path logic
packages/core/src/match.ts
Other components
- Music listener
- Object storage
Connections 31
- Music listener → Library and discovery UI: requests music
- Library and discovery UI → API client and queries: requests downloads
apps/mobile/src/app/(tabs)/search.tsx - API client and queries → HTTP API and routing: calls API
- HTTP API and routing → Service composition: uses services
apps/api/src/app.ts - HTTP API and routing → Download orchestration: routes worker actions
- Download orchestration → Job queues and events: enqueues jobs
- Job queues and events → Worker job runtime: dispatches jobs
- Worker job runtime → Source resolution: finds source
apps/worker/src/jobs/item.ts - Source resolution → YouTube downloader: probes and downloads
apps/worker/src/pipeline/find-source.ts - Worker job runtime → Metadata and lyrics: looks up metadata
apps/worker/src/jobs/item.ts - Worker job runtime → Audio conversion and tagging: processes audio
apps/worker/src/jobs/item.ts - Worker job runtime → Worker API client: reports completion
apps/worker/src/jobs/item.ts - Worker API client → HTTP API and routing: posts worker updates
apps/worker/src/api/client.ts - Download orchestration → Library and job data: records results
apps/api/src/services/worker-jobs.ts - Library and job data → Postgres: reads and writes
apps/api/src/db/items.ts - Download orchestration → Object storage access: requests upload access
apps/api/src/services/worker-jobs.ts - Object storage access → Object storage: signs object access
apps/api/src/services/storage.ts - Worker job runtime → Object storage: uploads audio
- Download orchestration → Live event stream: publishes updates
apps/api/src/context.ts - Live event stream → API client and queries: streams events
- API client and queries → Two-way sync engine: syncs library
apps/mobile/src/api/queries.ts - Two-way sync engine → Offline library database: applies changes
apps/mobile/src/sync/engine.ts - Library and discovery UI → Music folder mirror: saves offline files
- Music folder mirror → Object storage: downloads audio
- Offline library database → Offline player and queue: supplies library
- Library and discovery UI → Catalog services: searches catalog
- Catalog services → Music catalog clients: queries providers
- Worker job runtime → Job queues and events: consumes jobs
- Worker job runtime → Shared request and event shapes: uses job shapes
apps/worker/src/jobs/item.ts - Two-way sync engine → Shared request and event shapes: uses sync shapes
apps/mobile/src/sync/engine.ts - Download orchestration → Matching and path logic: uses path logic
apps/api/src/services/worker-jobs.ts