In August 2026, developer Bulat Bikmukhametov defended his thesis, and his habit of coding in the evenings stuck around. He had a personal collection of over two thousand tracks on disk, and one day needed to move a quarter of that library into a separate playlist. On Yandex Music, that meant either five hundred identical clicks or wrestling with a script against someone else's API — plus the constant risk of a subscription ending or songs vanishing from the platform. So a modest idea took shape: upload his MP3s to a server and play them in a browser.
A few months later, that study player had grown into Caimack, an open-source self-hosted streaming platform under AGPL-3.0: with a Rust backend, neural-network recommendations, a native Android app, and a home server running on an old gaming laptop. The most interesting part is three engineering problems that show up the moment 'just serve files over HTTP' stops being enough.
Why Build Your Own Player When Navidrome and Jellyfin Exist?
Home music servers like Navidrome and Jellyfin have been around for years. Still, when you build for yourself, you want painless bulk library edits, a custom OLED dark theme, audio-based recommendations, and reliable offline playback on the road.
Over time, Caimack settled on a down-to-earth stack. The backend started in C# before moving to Rust. Audio files, cover art, and streaming caches live on disk, while the catalog, accounts, and play history live in PostgreSQL. Everything boots via Docker Compose. The desktop app currently uses Electron, though Bulat treats that as temporary.
| Subsystem | Technology | Role in Project |
|---|---|---|
| Backend | Rust (from C#) | API, folder scanner, normalization, sync |
| Database | PostgreSQL | Catalog, history, confirmed UUID journal |
| Storage | Local disk | Original tracks, cover art, HLS cache |
| Audio pipeline | Symphonia, Lofty, FFmpeg | Decoding, tags, adaptive HLS |
| ML module | MERT-v1-330M (PyTorch) | Sound vectors, optional GPU worker |
| Web client | Next.js (TypeScript) | Player, waveform, lyrics, 'music galaxy' |
| Android | Kotlin, Compose, Media3 | Native player, LAN sync, offline journal |
| Desktop | Electron (temporary) | Desktop wrapper around the web client |
| Network & deploy | Caddy, Docker Compose | Auto-TLS, reverse proxy, laptop hosting |
The architecture looks compact while it's empty. The real work begins when you drop a messy, years-old MP3 folder into it.
Audio in Rust: MP3 Normalization, Adaptive HLS, and Synced Lyrics
Tracks enter Caimack through the web UI or by copying files into a server folder. A scanner extracts cover art, artists, albums, and genres. With a real collection, mismatched volume levels and broken tags appear right away, so file normalization had to be added early.
Audio processing is split across three tools. Symphonia decodes audio in pure Rust, Lofty parses metadata, and FFmpeg slices streams.
Spotty mobile internet in the city brings its own headache. Sending a raw file whole doesn't work: on the subway or outside town, playback stutters immediately. Caimack switched to HLS streaming (HTTP Live Streaming), which splits each track into short segments and lets the client switch bitrates on the fly. When the connection drops, the server drops quality through FFmpeg with aggressive caching on top. Nice touches in the player include a clickable waveform for seeking and synced lyrics that highlight line by line in time with the music when timestamps are available.
Recommendations for One Listener and a Sleeping GPU
Big streaming services build recommendations from millions of listeners with overlapping tastes. When a home server has basically one user, there's nobody to compare against — the system has to listen to the tracks itself.
The project first tried CLAP before switching to MERT-v1-330M from M-A-P. It's a pretrained 330-million-parameter model tuned for music audio. Running thousands of full songs takes too long, so the worker samples three to eight 5-second windows per track (fewer for short clips), downmixes to 24 kHz mono, and feeds them to the network.
The output is an audio embedding — a normalized 1,024-number vector. Tracks with similar sound and mood land close together in that space. Caimack uses them to build personal mixes and track radio alongside play history. Those same vectors also power a 'music galaxy' — an interactive map of the whole library where similar tracks cluster together. Its practical value is debatable, though it's fun to explore.
Then VRAM became the bottleneck. MERT-v1-330M weights take about 1.26 GB, and inference needs more. New tracks don't arrive every second, so keeping a GPU occupied 24/7 makes no sense. A lazy-loading GPU worker solved it:
- The ML HTTP service starts 'empty' — no PyTorch import and no GPU context (0 MB VRAM idle).
- On the first request, it spawns a child process and loads the model onto the GPU (supporting NVIDIA via CUDA and compatible AMD cards via ROCm).
- While warming up, it replies
HTTP 503with aRetry-Afterheader. The Rust backend queues the job and retries later. - After five minutes of idle time, the child process exits and frees all VRAM. The next job loads weights back from local cache.
The entire ML module is optional: the player works fine without a GPU. There is one licensing catch: Caimack itself is AGPL-3.0, while MERT-v1-330M weights use non-commercial CC-BY-NC-4.0. That's fine at home, though you can't drop the model into a commercial product.
Offline on Android: Why Downloading Files Is Only Half the Job
A home server has a simple weakness: if the power goes out, the ISP drops, or you travel off-grid, your library vanishes. To stay independent of the network, Bulat built a native Android client in Kotlin using Jetpack Compose and Android Media3.
Android Media3 architecture for playback and background streaming (Source: developer.android.com)
The app downloads individual albums, playlists, or your entire collection over your home LAN. Alongside the audio, the phone receives cover art, metadata, lyrics, waveforms, embeddings, and ready-made mixes. Each file carries a version so the app can quickly compare local copies against the server.
Downloading MP3s is only half the problem, though. Say you're on a flight without internet: you like tracks, listen to an album, build a playlist, and reorder songs. How do you merge those edits with the server cleanly once you're back online?
Caimack uses an idempotent operation journal. Every offline action gets a unique UUID and stays on the phone until the server confirms it. Once online, the client sends events in batches of up to 100. The server applies each operation and records its UUID in PostgreSQL. If the connection drops mid-batch and the phone resends it, the server sees the known UUID and ignores the duplicate — no double scrobbles and no cloned playlists.
If you send the entire track list of a playlist at once, concurrent edits overwrite each other. You add a song offline on your phone while deleting an old one on your desktop — a full overwrite loses one of those changes. Caimack syncs playlists as individual operations (add or remove track), and last-write-wins only applies when editing the exact same field.
Devices on the same account also support remote playback control: music plays on your desktop while you skip tracks from your phone.
From a Cramped VPS to a Home Laptop: CGNAT, Caddy, and an Evening with tcpdump
The service originally lived on a rented VPS with 2 GB of RAM. Keeping memory under control meant constant babysitting, adding swap, and guessing whether the early backend's garbage collector or a bug was eating RAM. Eventually, Bulat moved everything home onto an old MSI Katana gaming laptop.
That immediately exposed the real cost of home hosting. His ISP put customers behind CGNAT (Carrier-Grade NAT), where many subscribers share a single public IPv4 address and incoming connections can't reach your router directly. He had to buy a dedicated public IP, forward ports, and put Caddy in front as a reverse proxy with automatic TLS.
Certificates and routes didn't work on the first try — debugging took a whole evening with tcpdump, Caddy logs, and router settings. Eventually the laptop came online and started streaming from home. Of course, a home data center has an obvious downside: the project's public domain from his GitHub profile occasionally times out, and uptime is entirely on you.

![Node.JS [ru]](/api/digests/it_development/daily/20261201/assets/sources/we-use-js.jpg?v=1afe99fd2b60f929709c637aa2979c455e3144c69388ab6e6ddb13994c70e746)


