docs/public-demo.md
Public demo
One permanent instance anyone can open, press play and see Stats and mixes with real-looking data. There is no login:
the player signs every visitor in as the demo account. Nothing a visitor does survives the nightly reset.
Status: live at https://demo.lodesong.findmalek.engineer (PUBLIC_DEMO_HOST), hosted on the owner's Dokploy
server; DNS is a CNAME to home.findmalek.engineer. The site's "try the live demo" buttons point here by default (DEMO_URL on Vercel overrides it).
How it works
- Library: the same generated demo library the PR previews use, baked into the
lodesong-demoNavidrome image. No real music. - Player:
ghcr.io/findmalek/lodesong:latestwithPUBLIC_DEMO=onandDEMO_SEED=on(six months of generated listening for thedemoaccount). It has no uploads, no feedback, no AI key, no lyrics lookups, no update check. - No login: with
PUBLIC_DEMO=onandDEMO_USER/DEMO_PASSWORDset,/api/healthsaysdemo: trueand the sign-in screen callsPOST /auth/demo, which opens an ordinary session for that account (same cookie, same CSRF header) and returns no password. The route answers 404 whenPUBLIC_DEMOis off or no demo account is set. It is rate limited per address (the one the proxy appended toX-Forwarded-For) and in total, keeps at most 500 demo sessions (the longest unused go first), and/auth/loginis closed, so wrong passwords can't lock visitors out. If the Navidrome is down the visitor sees the usual error with a "try again" button. A thin strip says "public demo, resets every night"; there is no log out button. This starts once a release with it is deployed (the nightly run uses:latest); until then the form anddemo/demostill work. - Warning:
DEMO_USERis signed in for anyone who opens the site. Give it a throwaway account, never an admin or your own. It is separate fromINDEX_USERon purpose: settingPUBLIC_DEMO=onon a real server doesn't hand its index account to the public. PUBLIC_DEMO=onalso makes nobody an admin (no doctor, no index rebuilds, no lyrics writes), refuses to make API and terminal tokens, and refusesdeletePlaylist. There is no shared playback session, play queue sync or "playing elsewhere", and a visitor sees and ends only their own session. Everyone is the samedemoaccount, so a visitor can star songs, make a playlist, change or empty a playlist and change settings; the nightly reset puts it all back.- Reset: the Public demo workflow (
.github/workflows/public-demo.yml) runs every night at 03:15 UTC. It redeploys the Navidrome from its image (library and account back to the baked state) and the player with no volume (sessions, settings, history and search index start empty, then the history is seeded again). - Own Navidrome: the public demo has its own
lodesong-public-demo-libraryapp (hostpublic-demo.<PREVIEW_DOMAIN>, tailnet-only), separate from the one PR previews share. The Demo workflow redeploys the shared one wheneverscripts/deploy/dokploy.mjsor the generator changes, which would otherwise wipe the demo account and leave the demo unable to sign anyone in until the next nightly run. - Network: the Navidrome stays tailnet-only; only the player host is public. The player is the only thing that talks to it, over Dokploy's internal network.
What is left
These need the owner's server, DNS or repo settings, so they are not done in code:
- Run the Demo workflow once so
ghcr.io/findmalek/lodesong-demoand thelodesong-demoapp exist (see previews). - Pick the host, e.g.
demo.<site domain>, and point its DNS at the server's public address. The preview hosts (demo.<PREVIEW_DOMAIN>) are tailnet-only and stay that way, so the public one needs its own name. - Set the repo variable
PUBLIC_DEMO_HOSTto that host (the existingDEPLOY_ENABLED,DOKPLOY_PUBLIC_URL,PREVIEW_DOMAINand theDOKPLOY_API_KEYsecret are reused). Check the Dokploy certificate resolver used inensureDomain(scripts/deploy/dokploy.mjs) can issue a certificate for a public name; it is set tovercel. - Run Public demo from the Actions tab once, then check the next morning that a star or playlist made the day
before is gone. If Dokploy keeps the old container filesystem on redeploy, add a volume-less "stop, start" or
delete-and-recreate step to
publicDemoUp. - The site's demo buttons already point at
https://demo.lodesong.findmalek.engineer; setDEMO_URLon Vercel only to change that. - Consider putting a rate limit or Cloudflare in front: the host is public and everyone is signed in as
demo. Cloudflare in front needs Traefik'strustedIPsand an adjustedclientIp(apps/api/src/api.ts), or the per-IP sign-in cap becomes one cap shared by everybody. The global cap (300 sign-ins a minute) can be used up to stop new visitors for a while; that is accepted for a throwaway demo.
Trying it locally
bash
| 1 | PUBLIC_DEMO=on DEMO_SEED=on INDEX_USER=demo INDEX_PASSWORD=demo DEMO_USER=demo DEMO_PASSWORD=demo NAVIDROME_URL=http://127.0.0.1:4533 bun run start |
with compose.demo.yaml running (demo library).