Web app for an Icecast radio station.

Live: tunes.lastra.us
A single-page player for one Icecast stream. It shows what is playing with album art from Last.fm, and draws a visualizer around the art from the audio itself.
Features
- Now playing, pushed live. Title, artist and album update over a server-sent event stream as soon as the track changes; no page polling.
- Album art and details from Last.fm. Hovering the artist shows a short bio, tags, listeners and plays; hovering the album shows its summary, tags and tracklist.
- Audio-reactive visualizer. Rings in the Rosé Pine palette pulse around the album art, bass on the inside and treble on the outside, with a core glow driven by the bass.
- Track changes animate: the old album art fades out under the new one and the new title slides in.
- Stream health. A Live / buffering / error indicator with the current listener count and how long playback has run; a dropped stream retries after 3 seconds.
- Offline state when the Icecast server has no source.
How it works
The server polls Icecast's status-json.xsl every 3 seconds, but only while at least one browser is connected to /api/now-playing/stream. It takes the first mount, splits its title on - into artist and track, and looks the track up on Last.fm (track.getInfo) for the album and its art, caching up to 500 lookups. Only changes are pushed to subscribers, with a heartbeat every 15 seconds to hold the connection open.
/api/artist-info and /api/album-info fetch the hover-card details from Last.fm on demand. The browser plays the stream directly and feeds it through a Web Audio analyser for the visualizer.
The public stream address is hard-coded: the listen URL sent to browsers is https://radio.lastra.us plus the mount's path, in src/lib/server/icecast.ts. Change it there if you run this for another station.
Development
Two variables, read from .env and inlined at build time:
| Variable | Purpose |
|---|---|
ICECAST_URL |
Icecast server base URL, where the status JSON is read from |
LASTFM_API_KEY |
Last.fm API key for album art and artist info |
bun install
bun run dev
bun run type-check # svelte-check
bun run lint # eslint
Stack: SvelteKit 3 · Svelte 5 runes · Tailwind 4 · shadcn-svelte · lucide · bun
Deploying
nixpacks.toml installs with Bun on Node 22 and starts the adapter-node server with node build/index.js. Because both variables are inlined at build time, they have to be set for the build, not only at runtime. A Dockerfile that builds and serves with Bun is included too.