
For road trips and parties
Jukebox Republic
The people's queue.
2018 to 2026
Raspberry Pi, Mopidy, Node.js, Socket.IO, Spotify Web API, Cloud Run, Firestore
A shared song queue the whole room votes on, now on its third architecture. The 2018 version, cartunes, ran Mopidy on a Raspberry Pi in the car, broadcasting its own WiFi so passengers could queue songs with no accounts and no internet. After the Pi was wiped it became a hosted Node and Socket.IO app with Spotify sign-in, room codes and fair-rotation voting. Today it's Jukebox Republic, live at music.pi.co.nz: one host plays through Spotify, guests join from their phone's browser with a code, and half the room can vote a song out. It runs on a scale-to-zero Cloud Run backend behind Firebase Hosting, keeps sessions in Firestore, and ships through tagged releases with automated tests.
The problem
On road trips and at house parties, one person always ends up in charge of the music, and everyone else either puts up with it or keeps reaching for the phone. I wanted everyone in the car or the room to add songs from their own phone and get a fair say in what plays next. My regular drives also lose signal for 10 to 15 minutes at a time, so it had to keep going through that.
How it works
Connectivity is the constraint that survived all three rebuilds. Real drives cross 10 to 15 minute dead zones, so a phone dropping off is the normal case, not an error. Phones reconnect by themselves and carry on where they left off, the server keeps watching playback so the next song still starts when a track ends mid-outage, and a guest who loses signal or locks their screen still counts as present for 30 minutes. Without that grace period, the number of votes needed to skip a song would shrink every time someone’s phone went to sleep.
Staying on free tiers shaped the rest. A session is a single Firestore document, capped at 1 MiB, and three large playlists in the fallback mix measured 1.5 MiB, so the mix stops at 600 tracks. Progress updates every four seconds were each turning into a database write, around 900 an hour against a free allowance of 20,000 a day, so those updates now go out to phones without being saved. The fallback playlists are cached in Firestore too, so a session starting on a cold server doesn’t wait on Spotify for them.
Hardening it in 2026
A security pass found that any guest could take over a session just by claiming to be the host, because the host’s page told the server who it was. Host powers now need a token the server creates at login. It travels in the part of the link browsers never send to a server, so it can’t end up in logs, and it’s checked in constant time. The same pass fixed music jumping to a nearby AirPlay speaker when the host’s phone was asleep: the app now plays on whatever is already playing, or the host’s phone, and otherwise waits and says so. The screens were redesigned as a live board, with a gold strip carrying the room code and a running tally of up and down votes on every song, so everyone can see how close a song is to being skipped.



