<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Elliot Richards</title><description>Thoughts on technology and modern life. No filter, some philosophy, occasional beauty. This is where I think out loud about the hard questions that keep me up at night.</description><link>https://elliotx.com/</link><item><title>Building the Movie Dashboard</title><link>https://elliotx.com/projects/2026/building-the-movie-dashboard</link><guid isPermaLink="true">https://elliotx.com/projects/2026/building-the-movie-dashboard</guid><description>Spec-Driven Development to create a movie watch log using Google Sheets, enriched with TMDB metadata</description><pubDate>Sun, 08 Nov 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-heroimage-building-the-movie-dashboard.jpg&quot; alt=&quot;Architecture diagram of the film stats pipeline, from a Google Sheet through Cloud Run and TMDB to a static dashboard&quot; /&gt;
&lt;p&gt;The &lt;a href=&quot;https://elliotx.com/data/music&quot;&gt;music dashboard&lt;/a&gt; I created turned eighteen years, give or take, of listening history into charts, and I wanted something for films and TV. The catch is that nothing scrobbles my film or TV watching, so I’d be logging them by hand.&lt;/p&gt;
&lt;p&gt;That part had to stay as low-effort as possible, so I opted to use a Google sheet with one row per film. All I track is the date, the title, give it a rating, locate the TMDB ID, mark if it’s a movie or tv show, and have two columns for notes.&lt;/p&gt;
&lt;p&gt;If I want to add a review I can write a short piece of text in the &lt;code&gt;public_note&lt;/code&gt; column. If it’s a tv show, denote the season/series and episode, again one episode per row. Everything else (posters, runtimes, genres, directors, streaks) should be worked out for me without me touching anything.&lt;/p&gt;
&lt;p&gt;This dashboard and log was built with Claude Code, across three of my repos in a single evening. Once a basic system was built it was ready for a backfill of several years worth of data from various watch logs (Letterboxd and Trakt).&lt;/p&gt;
&lt;p&gt;As I imported data into Google Sheets, I then spent some time reworking how the pages fit together and how the data flowed. Seeing it come together with real data makes all the difference.&lt;/p&gt;
&lt;h2 id=&quot;film-watch-log--daily-stats-pipeline&quot;&gt;Film Watch Log → Daily Stats Pipeline&lt;/h2&gt;
&lt;p&gt;Before any code, I wrote a simple spec. It covered the goal, an architecture sketch of what I thought it would look like, the spreadsheet schema and the use of the TMDB API.&lt;/p&gt;
&lt;p&gt;The underlying infrastructure needs to be considered, there are a fair few moving pieces built to accommodate what looks like simple pages of data. There are cloud functions, buckets, data pulls, a website build, GitHub actions; the application itself which is a small collection of Python scripts to pull in data from Google Sheets, to match it with TMDB data via its API, and to store my enriched and transformed data in a GCS bucket. Then there’s the website itself which is built on Astro. All of this is published as dependency-free static pages, a page for every film. There’s no server or compute so everything needs to be built.&lt;/p&gt;
&lt;h2 id=&quot;goal&quot;&gt;Goal&lt;/h2&gt;
&lt;p&gt;Log films in a personal Google Sheet. Every day, a scheduled GCP job reads the sheet, enriches each entry with TMDB metadata, computes dashboard stats, and publishes a &lt;code&gt;stats.json&lt;/code&gt; that my personal website consumes.&lt;/p&gt;
&lt;p&gt;Hand-edited data stays in Sheets. Everything else is derived and rebuildable.&lt;/p&gt;
&lt;h2 id=&quot;architecture&quot;&gt;Architecture&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-film-stats-architecture.svg&quot; alt=&quot;Architecture of the film stats pipeline: Google Sheet, Cloud Scheduler, Cloud Run, Secret Manager, a private cache bucket, a public stats bucket, TMDB, a GitHub Action, Cloud Build and the visitor&amp;#x27;s browser&quot;&gt;&lt;/p&gt;
&lt;p&gt;Following a film from the sheet to the page:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;I add a row to the sheet: date, rating, TMDB ID.&lt;/li&gt;
&lt;li&gt;At 05:00 UK time, Cloud Scheduler calls the private Cloud Run service, proving who it is with a short-lived OIDC token. Nothing else is allowed to call it.&lt;/li&gt;
&lt;li&gt;The service reads the whole Google sheet through the Sheets API. It has read-only access because the sheet is shared with its service account, exactly like sharing it with a person. No key file is involved.&lt;/li&gt;
&lt;li&gt;For each film, it checks a private cache bucket first and only asks TMDB on a miss. The TMDB token comes from Secret Manager.&lt;/li&gt;
&lt;li&gt;It writes one file to a public bucket: &lt;code&gt;films.json&lt;/code&gt;, every viewing plus the TMDB metadata for each title.&lt;/li&gt;
&lt;li&gt;At 06:30 UTC, a GitHub Action in the website repo downloads it. If anything changed, it commits it, which triggers the normal site build and deploy. The build works out every stat from that file.&lt;/li&gt;
&lt;li&gt;Visitors get plain static HTML. Only the poster images come from TMDB, directly into their browser.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If a run fails, Cloud Scheduler retries it three times, and a Cloud Monitoring alert emails me.&lt;/p&gt;
&lt;h2 id=&quot;three-repos-one-pipeline&quot;&gt;Three repos, one pipeline&lt;/h2&gt;
&lt;p&gt;The site is already split across three repos: one for small backend apps, one for Terraform, and one for the website itself. This project touched all three.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-film-stats-repos.svg&quot; alt=&quot;The apps, infra and website repos, what runs on a pull request and on merge to main in each, and which part of Google Cloud each one deploys to&quot;&gt;&lt;/p&gt;
&lt;p&gt;Each repo has its own CI and deploys its own piece, and none of them hold a Google Cloud key. GitHub Actions swap their own OIDC token for short-lived credentials through Workload Identity Federation. The only link between repos at runtime is the one public file.&lt;/p&gt;
&lt;h2 id=&quot;the-service&quot;&gt;The service&lt;/h2&gt;
&lt;p&gt;The service is Python, laid out the way the spec suggested: one small module per job, and a thin &lt;code&gt;main.py&lt;/code&gt; that runs them in order.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-film-stats-run-flow.svg&quot; alt=&quot;The five steps of one run, and what each does when something goes wrong&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Reading the sheet.&lt;/strong&gt; Dates were the first trap. Asked for dates as &lt;em&gt;formatted&lt;/em&gt; text, the Sheets API formats them in the sheet’s locale, so &lt;code&gt;03/04/2026&lt;/code&gt; could be March or April. The service asks for dates as serial numbers instead, which mean the same thing in any locale.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Validating.&lt;/strong&gt; Bad rows follow the spec: they’re skipped, and recorded in the output with their row number and the reason, such as &lt;code&gt;non-numeric tmdb_id&lt;/code&gt;. An out-of-range rating is treated more gently: the viewing still counts, it’s just unrated.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Enriching.&lt;/strong&gt; TMDB responses are big, so the service keeps only the ten or so fields it needs and caches them in a private bucket. Cache entries are refreshed after 30 days so posters and scores don’t go permanently stale, and if TMDB is down, the old copy is used. (The cache started out as one small file per film; &lt;a href=&quot;#scaling-for-a-backfill&quot;&gt;scaling for a backfill&lt;/a&gt; explains why it became a single index file.)&lt;/p&gt;
&lt;p&gt;The TMDB client itself retries rate limits and server errors with exponential backoff, and respects TMDB’s &lt;code&gt;Retry-After&lt;/code&gt; header when it sends one.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Computing the stats.&lt;/strong&gt; This is the part I most wanted tested, so it’s pure functions: films and metadata in, a dictionary out. They don’t touch the network or even read the clock; “today” is passed in. That makes them easy to test against fixtures, covering the edge cases the spec listed: rewatches, empty months, streaks that cross a month or year end, and bad rows. In the first version this ran in the service and published a ready-made &lt;code&gt;stats.json&lt;/code&gt;. Since &lt;a href=&quot;#the-redesign&quot;&gt;the redesign&lt;/a&gt; the service only builds the export, and the same kind of tested pure functions run in the website’s build instead.&lt;/p&gt;
&lt;p&gt;One small design choice I like: the &lt;em&gt;current&lt;/em&gt; streak survives until the end of the day after your last film. Otherwise the 05:00 run would reset it every morning, before I’d had a chance to watch anything that evening.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Publishing.&lt;/strong&gt; The file is uploaded under a staging name, then copied over the live one, so a failed upload never touches the live file. It’s served with a one-hour cache header.&lt;/p&gt;
&lt;h2 id=&quot;data-contract-the-sheet&quot;&gt;Data contract: the Sheet&lt;/h2&gt;
&lt;p&gt;Tab name: &lt;code&gt;Watch Log&lt;/code&gt;. Row 1 is headers. One row per viewing (rewatches are separate rows with the same ID).&lt;/p&gt;

































































&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Col&lt;/th&gt;&lt;th&gt;Header&lt;/th&gt;&lt;th&gt;Type&lt;/th&gt;&lt;th&gt;Notes&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;A&lt;/td&gt;&lt;td&gt;&lt;code&gt;watched_date&lt;/code&gt;&lt;/td&gt;&lt;td&gt;date&lt;/td&gt;&lt;td&gt;Real date cell or ISO &lt;code&gt;YYYY-MM-DD&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;B&lt;/td&gt;&lt;td&gt;&lt;code&gt;title&lt;/code&gt;&lt;/td&gt;&lt;td&gt;text&lt;/td&gt;&lt;td&gt;Human label only, not trusted for lookup&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;C&lt;/td&gt;&lt;td&gt;&lt;code&gt;score&lt;/code&gt;&lt;/td&gt;&lt;td&gt;number&lt;/td&gt;&lt;td&gt;optional&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;D&lt;/td&gt;&lt;td&gt;&lt;code&gt;tmdb_id&lt;/code&gt;&lt;/td&gt;&lt;td&gt;integer&lt;/td&gt;&lt;td&gt;source of truth for enrichment&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;E&lt;/td&gt;&lt;td&gt;&lt;code&gt;media_type&lt;/code&gt;&lt;/td&gt;&lt;td&gt;text &lt;code&gt;movie&lt;/code&gt; or &lt;code&gt;tv&lt;/code&gt;&lt;/td&gt;&lt;td&gt;blank means &lt;code&gt;movie&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;F&lt;/td&gt;&lt;td&gt;&lt;code&gt;season&lt;/code&gt;&lt;/td&gt;&lt;td&gt;integer&lt;/td&gt;&lt;td&gt;&lt;code&gt;season&lt;/code&gt; if tv, what &lt;code&gt;season&lt;/code&gt;?&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;G&lt;/td&gt;&lt;td&gt;&lt;code&gt;episode&lt;/code&gt;.&lt;/td&gt;&lt;td&gt;integer&lt;/td&gt;&lt;td&gt;&lt;code&gt;episode&lt;/code&gt; if tv, what &lt;code&gt;episode&lt;/code&gt;?&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;H&lt;/td&gt;&lt;td&gt;&lt;code&gt;public_note&lt;/code&gt;&lt;/td&gt;&lt;td&gt;text&lt;/td&gt;&lt;td&gt;Optional; this is my review for publishing&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;I&lt;/td&gt;&lt;td&gt;&lt;code&gt;notes&lt;/code&gt;&lt;/td&gt;&lt;td&gt;text&lt;/td&gt;&lt;td&gt;Optional; not published&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Rules: skip blank rows, skip rows with a missing or non-numeric &lt;code&gt;tmdb_id&lt;/code&gt; or an unparsable date, and record each skipped row (row number plus reason) in &lt;code&gt;warnings&lt;/code&gt; in the output rather than failing the run.&lt;/p&gt;
&lt;h2 id=&quot;components&quot;&gt;Components&lt;/h2&gt;
&lt;h3 id=&quot;1-cloud-run-function-python-312-src&quot;&gt;1. Cloud Run function (Python 3.12), &lt;code&gt;src/&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Runs as a dedicated service account (&lt;code&gt;film-stats-runner&lt;/code&gt;). &lt;strong&gt;No service account keys.&lt;/strong&gt; Use Application Default Credentials with scope &lt;code&gt;https://www.googleapis.com/auth/spreadsheets.readonly&lt;/code&gt;; the runtime SA is shared on the sheet as Viewer.&lt;/p&gt;
&lt;p&gt;Suggested layout:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;src/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  main.py          # entrypoint: orchestrates the run&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  sheet.py         # read + validate rows&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  tmdb.py          # fetch with cache, retry/backoff, rate-limit politeness&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  stats.py         # pure functions: rows + metadata -&gt; stats dict (unit tested)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  publish.py       # write stats.json to GCS&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;tests/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  test_stats.py&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  fixtures/&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Flow in &lt;code&gt;main.py&lt;/code&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Read the sheet via &lt;code&gt;sheets.spreadsheets().values().get(range=&quot;&apos;Watch Log&apos;!A2:F&quot;, valueRenderOption=&quot;UNFORMATTED_VALUE&quot;, dateTimeRenderOption=&quot;FORMATTED_STRING&quot;)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Validate and normalise rows (&lt;code&gt;sheet.py&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;For each unique &lt;code&gt;(media_type, tmdb_id)&lt;/code&gt;: load from GCS cache, otherwise call TMDB &lt;code&gt;GET /{type}/{id}?append_to_response=credits&lt;/code&gt; and write the trimmed result to cache. Cache only the fields needed: title, release date, runtime, genres, director(s), poster path, original language, TMDB vote average. If TMDB errors and a cache entry exists, use it. If neither exists, add a warning and continue.&lt;/li&gt;
&lt;li&gt;Compute stats (&lt;code&gt;stats.py&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Write &lt;code&gt;stats.json&lt;/code&gt; to the public bucket with &lt;code&gt;Cache-Control: public, max-age=3600&lt;/code&gt;. Write atomically (upload under a temp name, then copy/rename) so the site never reads a half-written file.&lt;/li&gt;
&lt;li&gt;Log a one-line summary (rows read, rows skipped, TMDB calls made, cache hits).&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The function should be idempotent: running it twice produces the same output.&lt;/p&gt;
&lt;h3 id=&quot;2-stats-to-compute-statsjson&quot;&gt;2. Stats to compute (&lt;code&gt;stats.json&lt;/code&gt;)&lt;/h3&gt;
&lt;p&gt;Include &lt;code&gt;schema_version&lt;/code&gt;, &lt;code&gt;generated_at&lt;/code&gt; (UTC ISO), and &lt;code&gt;warnings&lt;/code&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;totals&lt;/code&gt;: films watched (viewings), unique films, rewatches, total runtime hours&lt;/li&gt;
&lt;li&gt;&lt;code&gt;by_year&lt;/code&gt; and &lt;code&gt;by_month&lt;/code&gt;: viewing counts (fill empty months with 0 for charting)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;genres&lt;/code&gt;: counts, sorted descending&lt;/li&gt;
&lt;li&gt;&lt;code&gt;decades&lt;/code&gt;: counts by release decade&lt;/li&gt;
&lt;li&gt;&lt;code&gt;directors&lt;/code&gt;: top 10 by count&lt;/li&gt;
&lt;li&gt;&lt;code&gt;languages&lt;/code&gt;: counts&lt;/li&gt;
&lt;li&gt;&lt;code&gt;streaks&lt;/code&gt;: current and longest run of consecutive days with a viewing&lt;/li&gt;
&lt;li&gt;&lt;code&gt;busiest&lt;/code&gt;: busiest month, busiest weekday&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ratings&lt;/code&gt;: distribution plus average (only if ratings exist)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;recent&lt;/code&gt;: last 12 viewings with title, year, poster path, watch date, rating, TMDB ID&lt;/li&gt;
&lt;li&gt;&lt;code&gt;attribution&lt;/code&gt;: the TMDB attribution string required by their terms&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Keep it a single JSON file for now. If it grows past a few hundred KB, split &lt;code&gt;recent&lt;/code&gt; or &lt;code&gt;all_viewings&lt;/code&gt; into a second file.&lt;/p&gt;
&lt;h3 id=&quot;3-terraform-infra&quot;&gt;3. Terraform, &lt;code&gt;infra/&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Follow the repo’s existing conventions for backend, naming and variable layout. Resources:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;APIs enabled: &lt;code&gt;sheets.googleapis.com&lt;/code&gt;, &lt;code&gt;run.googleapis.com&lt;/code&gt;, &lt;code&gt;cloudscheduler.googleapis.com&lt;/code&gt;, &lt;code&gt;secretmanager.googleapis.com&lt;/code&gt;, &lt;code&gt;storage.googleapis.com&lt;/code&gt;, &lt;code&gt;cloudbuild.googleapis.com&lt;/code&gt;, &lt;code&gt;artifactregistry.googleapis.com&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Service accounts:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;film-stats-runner&lt;/code&gt;: runtime identity for the function&lt;/li&gt;
&lt;li&gt;&lt;code&gt;film-stats-scheduler&lt;/code&gt;: used only by Scheduler to invoke the function&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Secret Manager: &lt;code&gt;tmdb-api-token&lt;/code&gt; (resource only; I’ll add the secret version manually so the value never touches state or the repo). &lt;code&gt;film-stats-runner&lt;/code&gt; gets &lt;code&gt;secretAccessor&lt;/code&gt; on that secret only.&lt;/li&gt;
&lt;li&gt;Buckets (uniform bucket-level access, public access prevention as appropriate):
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;#x3C;project&gt;-film-tmdb-cache&lt;/code&gt;: private. Runner gets &lt;code&gt;objectAdmin&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;#x3C;project&gt;-film-stats-public&lt;/code&gt;: runner gets &lt;code&gt;objectAdmin&lt;/code&gt;. &lt;code&gt;allUsers&lt;/code&gt; gets &lt;code&gt;objectViewer&lt;/code&gt; &lt;strong&gt;on this bucket only&lt;/strong&gt;. CORS restricted to my website origin (variable). Lifecycle: none needed.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Cloud Run function (2nd gen): Python 3.12, runs as &lt;code&gt;film-stats-runner&lt;/code&gt;, env vars for sheet ID, bucket names, sheet tab and range; TMDB token mounted from Secret Manager. Not publicly invocable. Modest limits (256–512 MiB, 120s timeout, max 1 instance).&lt;/li&gt;
&lt;li&gt;Cloud Scheduler job: daily at 05:00 &lt;code&gt;Europe/London&lt;/code&gt;, HTTP target is the function, OIDC token from &lt;code&gt;film-stats-scheduler&lt;/code&gt;, which has &lt;code&gt;run.invoker&lt;/code&gt; on the function only. Retry config: 3 attempts with backoff.&lt;/li&gt;
&lt;li&gt;Variables: &lt;code&gt;project_id&lt;/code&gt;, &lt;code&gt;region&lt;/code&gt;, &lt;code&gt;sheet_id&lt;/code&gt;, &lt;code&gt;site_origin&lt;/code&gt;, &lt;code&gt;schedule&lt;/code&gt;. Outputs: function URL, public stats URL, runner SA email (I need this to share the sheet).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As on the &lt;a href=&quot;https://elliotx.com/projects/2026/building-a-contact-form/&quot;&gt;contact form&lt;/a&gt;, Terraform creates the secret but never its value, so the TMDB token never touches Terraform state or git. That brings back the same chicken-and-egg problem: Cloud Run won’t create a service whose secret has no value. So the first apply builds everything except the service. Then I add the token by hand, and a one-line change switches the service on.&lt;/p&gt;
&lt;h3 id=&quot;4-manual-steps-claude-code-should-list-these-for-me-at-the-end-not-try-to-do-them&quot;&gt;4. Manual steps (Claude Code should list these for me at the end, not try to do them)&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Create the Sheet with the headers above and a few test rows.&lt;/li&gt;
&lt;li&gt;Share it (Viewer) with the &lt;code&gt;film-stats-runner&lt;/code&gt; SA email from Terraform output.&lt;/li&gt;
&lt;li&gt;Create a TMDB account and get an API Read Access Token; add it as a version of &lt;code&gt;tmdb-api-token&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Trigger the scheduler job once manually and check the output.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;5-cicd&quot;&gt;5. CI/CD&lt;/h3&gt;
&lt;p&gt;Use whatever the repo already uses (GitHub → Cloud Build, Release Please, etc.). At minimum: lint and run unit tests on PR, &lt;code&gt;terraform fmt&lt;/code&gt;/&lt;code&gt;validate&lt;/code&gt;/&lt;code&gt;plan&lt;/code&gt; on PR, deploy on merge to main.&lt;/p&gt;
&lt;h2 id=&quot;website-side-separate-task-after-the-pipeline-works&quot;&gt;Website side (separate task, after the pipeline works)&lt;/h2&gt;
&lt;p&gt;Fetch &lt;code&gt;stats.json&lt;/code&gt; from the public bucket URL (at build time for a static site, or at runtime if it’s a client-side dashboard). Render the stats as charts and a recent-films poster grid. Poster images come from &lt;code&gt;https://image.tmdb.org/t/p/w342{poster_path}&lt;/code&gt;. Show the TMDB attribution and logo as their terms require.&lt;/p&gt;
&lt;h2 id=&quot;phases&quot;&gt;Phases&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Skeleton&lt;/strong&gt;: Terraform for APIs, SAs, buckets, secret; hello-world function; scheduler hitting it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Read&lt;/strong&gt;: Sheets read with validation and warnings; log output.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Enrich&lt;/strong&gt;: TMDB client plus GCS cache; retry/backoff.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Stats&lt;/strong&gt;: pure functions with unit tests against fixtures (include edge cases: rewatches, empty months, year boundaries, streak across month end, bad rows).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Publish&lt;/strong&gt;: write &lt;code&gt;stats.json&lt;/code&gt;, set CORS and cache headers, verify from the browser.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Harden&lt;/strong&gt;: alert if the job fails (log-based alert or Scheduler failure notification), README with the manual steps.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;acceptance-criteria&quot;&gt;Acceptance criteria&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Adding a row to the sheet changes &lt;code&gt;stats.json&lt;/code&gt; after the next run, with no code changes.&lt;/li&gt;
&lt;li&gt;A bad row never breaks the run; it shows up in &lt;code&gt;warnings&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;A TMDB outage doesn’t break the run for already-cached films.&lt;/li&gt;
&lt;li&gt;No secrets or key files in the repo or Terraform state.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;terraform apply&lt;/code&gt; from a clean project, plus the manual steps above, yields a working pipeline.&lt;/li&gt;
&lt;li&gt;Unit tests cover &lt;code&gt;stats.py&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That’s essentially it, but one can’t just hand it off without understanding what is being built and how.&lt;/p&gt;
&lt;p&gt;A film’s &lt;a href=&quot;https://www.themoviedb.org&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;TMDB&lt;/a&gt; ID is the key to everything. Titles are ambiguous (there are a lot of films called &lt;em&gt;Troy&lt;/em&gt;), but an ID points at exactly one film, and TMDB’s API turns it into a poster, a runtime, genres and a director.&lt;/p&gt;
&lt;p&gt;The acceptance criteria were written so they could be checked, not just agreed with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Adding a row to the sheet changes the stats after the next run, with no code changes.&lt;/li&gt;
&lt;li&gt;A bad row never breaks the run; it shows up in &lt;code&gt;warnings&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;A TMDB outage doesn’t break the run for films already seen.&lt;/li&gt;
&lt;li&gt;No secrets or key files in any repo or in Terraform state.&lt;/li&gt;
&lt;li&gt;Unit tests cover the stats.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;decisions-before-any-code&quot;&gt;Decisions before any code&lt;/h2&gt;
&lt;p&gt;Claude Code read the spec, then read all three of my repos (Terraform infra, website applications, and the content website itself) before asking anything.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A public data file.&lt;/strong&gt; It’s a watch log I’m putting on a public web page. A public bucket means the site can fetch it with no credentials at all.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Notes are never published.&lt;/strong&gt; The &lt;code&gt;notes&lt;/code&gt; column is for me. The code doesn’t just leave it out of the output: it never reads the column in the first place.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;TV counts too.&lt;/strong&gt; Each TV row counts as one episode. TMDB labels TV genres differently (“Sci-Fi &amp;#x26; Fantasy” rather than “Science Fiction”), so those get split into the film genre names and counted together.&lt;/p&gt;
&lt;h2 id=&quot;the-page&quot;&gt;The page&lt;/h2&gt;
&lt;p&gt;The &lt;a href=&quot;https://elliotx.com/data/movies&quot;&gt;movies page&lt;/a&gt; follows the music page’s rule: no charting library and no client-side fetching. The first version was a single dashboard laid out from the job’s &lt;code&gt;stats.json&lt;/code&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;headline numbers for films, rewatches, hours, average rating and streaks&lt;/li&gt;
&lt;li&gt;a grid of posters for the last twelve films&lt;/li&gt;
&lt;li&gt;films by month, genres, directors, release decades, ratings, day of the week and original language&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The charts are plain HTML and CSS. Every value is also available as text, through hover tooltips and tables for screen readers. Posters come from TMDB’s image service, and the TMDB logo and attribution sit at the bottom of every page, as their terms require.&lt;/p&gt;
&lt;p&gt;The download script is deliberately suspicious of what it fetches. It checks the file’s schema version, checks that every viewing has a film to go with it, and refuses to replace a file full of films with one that has none. That last rule came from a real incident, described below.&lt;/p&gt;
&lt;p&gt;It also leaves the file alone if the only thing that changed is its timestamp. Otherwise the site would rebuild and redeploy every morning for nothing.&lt;/p&gt;
&lt;h2 id=&quot;the-watch-log&quot;&gt;The watch log&lt;/h2&gt;
&lt;p&gt;The dashboard originally showed totals, charts and the last twelve posters, but the films behind them weren’t visible anywhere so I made a few changes after testing it. I’m currently backfilling several years worth of history, which will mean thousands of rows, all exported from other platforms and cleaned up before automatically being added. This meant the full list got &lt;a href=&quot;https://elliotx.com/data/movies/log&quot;&gt;its own page&lt;/a&gt; rather than a section on the dashboard.&lt;/p&gt;
&lt;p&gt;The first version was a simple archive: newest first, grouped by year and then month, with a row of year links at the top that stays pinned as you scroll. Each film showed the date, a small poster, the title and release year, my rating and a link to TMDB. There was no search box; the browser’s own find did that job. Like the dashboard, it was static HTML with no script, and it came from a second file, &lt;code&gt;viewings.json&lt;/code&gt;, so the dashboard’s file stayed small however long the log got. The redesign replaced both files, and gave the log search and filters.&lt;/p&gt;
&lt;p&gt;I tested it with 3,000 made-up films across eight years before any real backfill. The page comes to about 2.5 MB of HTML, but only about 115 KB once compressed in transit, and it’s ready in about 0.3 seconds on a desktop and about a second on a phone-speed processor. Posters are tiny (92 pixels wide) and only load as you scroll to them.&lt;/p&gt;
&lt;h2 id=&quot;scaling-for-a-backfill&quot;&gt;Scaling for a backfill&lt;/h2&gt;
&lt;p&gt;The service had been built for dozens of films. A first run over a backfill of thousands would have broken it in two ways:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;The cache was one file per film&lt;/strong&gt;, so checking it meant one storage read per title, one after another. For a few thousand titles, that alone takes most of a minute.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Every new title needs a TMDB lookup&lt;/strong&gt;, also one at a time, at about three a second. That’s over ten minutes, and the service gives up after two. Every run would have timed out and emailed me an alert, every day.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Three changes fixed it:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;The cache became a single index file&lt;/strong&gt;, read once at the start of a run and written once at the end.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Lookups run four at a time&lt;/strong&gt;, which still stays well under TMDB’s rate limit.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Each run does at most 600 lookups.&lt;/strong&gt; Titles with no cache entry come first, then the stalest refreshes. Anything over the cap still counts in the totals straight away; it just has no poster or genre yet, and gets a single “N titles are waiting for a TMDB lookup” warning instead of thousands of individual ones.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;todo &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; (missing &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; stale)[:max_fetches]  &lt;/span&gt;&lt;span style=&quot;color:#6A737D&quot;&gt;# new titles first, then the stalest&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;with&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; ThreadPoolExecutor(&lt;/span&gt;&lt;span style=&quot;color:#FFAB70&quot;&gt;max_workers&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;workers) &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;as&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; pool:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;    results &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; list&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;(pool.map(lookup, todo))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; key, (data, exc) &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; zip&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;(todo, results, &lt;/span&gt;&lt;span style=&quot;color:#FFAB70&quot;&gt;strict&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;True&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;    if&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; data &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;is&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt; not&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; None&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;        metadata[key] &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; data&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;        entries[key] &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; (data, now)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;    elif&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; key &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;not&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt; in&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; metadata:  &lt;/span&gt;&lt;span style=&quot;color:#6A737D&quot;&gt;# no stale copy to fall back on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;        warnings.append({&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;&quot;tmdb_id&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: key[&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;], &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;&quot;reason&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;str&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;(exc)})&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A simulated backfill of 2,000 new titles, with a realistic delay on every TMDB response, catches up in four runs, each comfortably inside the time limit:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-film-stats-backfill.svg&quot; alt=&quot;Four runs over a 2,000-title backfill: each looks up at most 600 titles, so the titles with metadata go from 600 to 1,200 to 1,800 to 2,000, and each run takes 38 seconds or less of its 120-second limit&quot;&gt;&lt;/p&gt;
&lt;p&gt;The daily schedule would get there in four days. Running the job by hand a few times gets there in a few minutes.&lt;/p&gt;
&lt;h2 id=&quot;the-redesign&quot;&gt;The redesign&lt;/h2&gt;
&lt;p&gt;The first version answered “what have I watched?”, but every film was a dead end: a poster and a link to TMDB. Once it was live I wanted to click through to a film, see every time I’d watched it, and find my way to other films by the same director or from the same decade. So I wrote a second spec, this time with mockups of the overview, the log and a film page, and gave it to Claude Code with an instruction to build it in stages and stop for review after each one.&lt;/p&gt;
&lt;p&gt;The biggest change was underneath. The service had been working out the stats and publishing them ready-made, which meant every new chart needed a change to the service, a deploy, and a day’s wait to see real numbers. Now the service publishes one file, &lt;code&gt;films.json&lt;/code&gt;: every viewing, plus one entry per title with the metadata from TMDB. That includes things the first version threw away, such as the cast, the collection a film belongs to and the UK age rating. The website works out every stat at build time, in TypeScript, with its own tests. A new chart is now just a change to the site.&lt;/p&gt;
&lt;p&gt;It went in four stages, each a pull request I looked over before the next began:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;The data layer.&lt;/strong&gt; The new file from the service, and the stats code and tests on the site. Dates are handled as plain &lt;code&gt;YYYY-MM-DD&lt;/code&gt; strings, and “today” is worked out in UK time, so a build that runs in UTC just after midnight in summer doesn’t think it’s still yesterday.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The log and film pages.&lt;/strong&gt; The log gained list, grid and table views, search, filters and sorting, with the filters kept in the URL. Without JavaScript it’s still the full list. Every film and show has its own page, with every viewing, my rating against TMDB’s average, the cast, and links to films by the same director, from the same decade and watched around the same time.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The overview.&lt;/strong&gt; A calendar of every day of the year, month by month cards, favourites and low points, where I disagree most with TMDB’s crowd, and release year against rating.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Browse, years and feeds.&lt;/strong&gt; A page for every genre, director, decade, rating, country and collection, a review of each year, a public JSON copy of the log and an RSS feed. The old &lt;code&gt;stats.json&lt;/code&gt; and &lt;code&gt;viewings.json&lt;/code&gt; were retired.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Two rules from the spec shaped every page. Each part of the page declares a minimum amount of data it needs, and hides completely, heading and all, until there’s enough. With a few dozen films, “rated vs the crowd” or “directors seen more than once” would just be empty boxes. And everything had to hold up for the backfill, so each stage was checked against made-up logs of 1,000 and 5,000 viewings as well as the real one. At 5,000 viewings the site builds about 4,700 movie pages in around ten seconds, and once there are more than 150 viewings the log splits into a page per year, so no single page gets too heavy.&lt;/p&gt;
&lt;h2 id=&quot;things-that-went-sideways&quot;&gt;Things that went sideways&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;The alert needed a logging permission.&lt;/strong&gt; The failure alert watches for a log entry, and Cloud Logging stores that kind of alert as a “notification rule”, which needs a permission that no Monitoring role includes. The first apply failed with a 403 until Terraform’s own account was given the extra role.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The columns were in a different order.&lt;/strong&gt; The real problem was quieter. When I set up the sheet, I put the date in column A and the title in column B, not the order my own spec’s table laid out, and the code had followed the spec. Every single row failed validation, so the run “succeeded” and published a perfectly valid file with zero films and twelve warnings. The skip-and-warn design did its job, but it also hid how wrong things were.&lt;/p&gt;
&lt;p&gt;The fix had three parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The service now finds columns by their header names, so the order doesn’t matter.&lt;/li&gt;
&lt;li&gt;If a required header is missing, the run fails loudly instead of publishing an empty file.&lt;/li&gt;
&lt;li&gt;The website’s download script refuses to overwrite real data with an empty file.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Logs that never arrived.&lt;/strong&gt; While chasing that, the service’s own log lines were nowhere to be seen. Python buffers its output when it isn’t writing to a terminal, so a short daily job’s logs might never get flushed. One environment variable, &lt;code&gt;PYTHONUNBUFFERED=1&lt;/code&gt;, fixed it, and fixed the same latent problem in my music pipeline too.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The file was right; the URL was stale.&lt;/strong&gt; After a successful run, the public URL kept serving the old, empty file, and could have for up to an hour. That’s the one-hour cache header doing exactly what I asked it to: Google’s edge serves its cached copy until it expires. The download script now adds a throwaway query string to the URL, which gets a fresh copy.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The page didn’t update the next morning.&lt;/strong&gt; The job ran at 05:00 and published the new numbers, but the site still showed the old ones. GitHub treats a workflow’s schedule as “not before”, not “at”, and this repo’s scheduled runs have started about seven hours late. Nothing was broken; the site just hadn’t pulled yet. Running the workflow by hand caught it up, and the schedule now gets to run when GitHub gets round to it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The year links slid under the header.&lt;/strong&gt; On the new log page, the pinned row of year links was set to stick to the top of the screen. But the site’s own header already sticks there, and sits on top, so the year links slid underneath it as soon as you scrolled. They now stick just below the header.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A speed-up that broke the year links.&lt;/strong&gt; I’d also told the browser it could skip drawing months that were off screen, with a guess at how tall each one was. With smooth scrolling, months were drawn at their real height partway through a jump, so the year links overshot their headings by hundreds of pixels. Even with much better height guesses, it didn’t land reliably. Measured without the trick, the page was still quick, so it went.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stars that weighed too much.&lt;/strong&gt; Each row of the redesigned log showed my rating as five small star drawings. Multiplied across a year of rows, those drawings were almost a third of the page. Drawing the stars with a single shape repeated by CSS took the page from 670 KB to 523 KB.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Titles in curly quotes.&lt;/strong&gt; TMDB’s title for &lt;em&gt;Wuthering Heights&lt;/em&gt; comes wrapped in stylised quotation marks, so sorting by title put it ahead of everything starting with A. The title is still shown exactly as TMDB has it, but it now sorts by its first letter or number.&lt;/p&gt;
&lt;h2 id=&quot;result&quot;&gt;Result&lt;/h2&gt;
&lt;p&gt;There’s now a &lt;a href=&quot;https://elliotx.com/data/movies&quot;&gt;movies page&lt;/a&gt;, and a &lt;a href=&quot;https://elliotx.com/data/movies/log&quot;&gt;watch log&lt;/a&gt; behind it, a page for every film, and ways in by &lt;a href=&quot;https://elliotx.com/data/movies/browse&quot;&gt;genre, director, decade and more&lt;/a&gt; or &lt;a href=&quot;https://elliotx.com/data/movies/year&quot;&gt;by year&lt;/a&gt;. Logging a film is still just a row in a spreadsheet.&lt;/p&gt;
&lt;p&gt;Writing the spec first is what made one evening enough for the first version, and the second spec is what made the redesign a series of small, reviewable steps rather than one big rewrite. It gave Claude Code a precise target, a set of checks to test against, and a short list of things to ask me about rather than guess.&lt;/p&gt;
&lt;p&gt;There you have it. An interesting and fun little project, and something that I can spend literally hours clicking and browsing through. I had a lot of fun building this.&lt;/p&gt;</content:encoded><category>api</category><category>astro</category><category>automation</category><category>cloud-run</category><category>data-visualisation</category><category>gcp</category><category>python</category><category>terraform</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/projects/2026/project-heroimage-building-the-movie-dashboard.jpg" length="0" type="image/jpeg"/></item><item><title>Building Infocom games from source</title><link>https://elliotx.com/projects/2026/building-infocom-games-from-source</link><guid isPermaLink="true">https://elliotx.com/projects/2026/building-infocom-games-from-source</guid><description>Compiling the original Infocom ZIL source for Zork, Planetfall, Hitchhiker’s Guide and 30 more into playable games.</description><pubDate>Sun, 18 Oct 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-heroimage-building-infocom-games-from-source.png&quot; alt=&quot;Building Infocom games from source&quot; /&gt;
&lt;p&gt;I love games, have done ever since owning a ZX Spectrum in the early-80s; seeing &lt;a href=&quot;https://en.wikipedia.org/wiki/Jetpac&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Jetpac&lt;/a&gt; on a friend’s machine was love at first sight, as were a lot of games by &lt;a href=&quot;https://en.wikipedia.org/wiki/Ultimate_Play_the_Game&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Ultimate Play The Game&lt;/a&gt;. This was followed by a C64 with a tape unit and &lt;a href=&quot;https://en.wikipedia.org/wiki/Commodore_1541&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;1541 disk drive&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I was a big fan of Infocom games back then. The large cardboard boxes with 5.25” disks and accessories, maps, artwork…there was something to behold of those games. Admittedly I wasn’t very good at adventure games, but they had a way of capturing one’s imagination in a way that not a lot of games did at that time.&lt;/p&gt;
&lt;p&gt;Half the frustration was in working out what the parser would accept, and getting very annoyed with it. I’ve not really looked at the games much since then, but from time to time I like to play retro games, 8bit, 16bit, and sometimes these text-based adventure games come up.&lt;/p&gt;
&lt;p&gt;I came across &lt;a href=&quot;https://github.com/the-infocom-files&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;the-infocom-files&lt;/a&gt; on GitHub. I was browsing retro game stuff and seeing the Infocom stuff kind of got my juices flowing again. I wonder if I’d be any good at them now that I’m older, with more patience, or whether I would invent new swear words.&lt;/p&gt;
&lt;p&gt;The repo hosts tidied-up source code for Infocom’s games. I wanted to know if I could turn that source into something I could actually play. It turns out you can: I started with Zork I and finished with 35 playable Infocom games.&lt;/p&gt;
&lt;p&gt;First off, I did all of this on a Mac. If you’re on Windows or Linux, the steps are almost the same, and there’s a &lt;a href=&quot;#on-windows-or-linux&quot;&gt;section near the end&lt;/a&gt; covering the differences, but fair warning, I’ve not tested it on those platforms.&lt;/p&gt;
&lt;h2 id=&quot;whats-in-the-repo&quot;&gt;What’s in the repo&lt;/h2&gt;
&lt;p&gt;Infocom wrote its games in &lt;strong&gt;ZIL&lt;/strong&gt; (Zork Implementation Language), a Lisp-like language descended from MDL, which was used at MIT. ZIL doesn’t compile to native code. It compiles to a story file for the &lt;strong&gt;Z-machine&lt;/strong&gt;, a virtual machine Infocom designed so the same game could run on every home computer of the era. All you need to play a story file today is a Z-machine interpreter.&lt;/p&gt;
&lt;h2 id=&quot;step-1-install-zilf-on-macos&quot;&gt;Step 1: Install ZILF on macOS&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://zilf.io/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;ZILF&lt;/a&gt; is written in C# and is distributed via pre-compiled binaries.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Go to the ZILF Download Page and grab the latest &lt;strong&gt;macOS arm64&lt;/strong&gt; (for Apple Silicon M1/M2/M3/M4) or &lt;strong&gt;macOS x64&lt;/strong&gt; (for older Intel Macs) bundle. Other OS are available via &lt;a href=&quot;https://github.com/taradinoc/zilf/releases&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Extract the downloaded archive into a folder named &lt;code&gt;zilf&lt;/code&gt; inside your development environment (e.g., &lt;code&gt;~/developer/zilf&lt;/code&gt;).&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;shell&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;tar&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -xvf&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; zilf-1.9.0-osx-arm64.tar.gz&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;&lt;strong&gt;Handle macOS Gatekeeper:&lt;/strong&gt; Because ZILF is downloaded outside the Mac App Store, your terminal might kill the process upon launch (&lt;code&gt;Process killed&lt;/code&gt;) or flag it. You can bypass this by clearing the quarantine flag via Terminal:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;shell&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;xattr&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -dr&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; com.apple.quarantine&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; ~/developer/zilf/&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For ease of use put ZILF on your path.&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;shell&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;cd&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; ~/developer/zilf&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;export&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; PATH&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;$PWD&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;/zilf/bin:&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;$PATH&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;step-2-grab-the-original-zil-source-files&quot;&gt;Step 2: Grab the Original ZIL Source Files&lt;/h2&gt;
&lt;p&gt;The official historical ZIL files released during the open-source initiative are hosted online.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Clone or download the &lt;strong&gt;Zork I&lt;/strong&gt; source code from the official archive on GitHub:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;shell&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;git&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; clone&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; https://github.com/historicalsource/zork1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;step-3-run-the-multi-stage-compilation&quot;&gt;Step 3: Run the Multi-Stage Compilation&lt;/h2&gt;
&lt;p&gt;ZIL source files cannot be transformed directly into a game file in one click. It requires two distinct components inside your ZILF folder: &lt;strong&gt;&lt;code&gt;zilf&lt;/code&gt;&lt;/strong&gt; (the compiler) and &lt;strong&gt;&lt;code&gt;zapf&lt;/code&gt;&lt;/strong&gt; (the assembler).&lt;/p&gt;
&lt;p&gt;From inside the game folder, it’s two commands:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;zsh&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;cd&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; zork1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;zilf&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; zork1.zil&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;zapf&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; zork1.zap&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This compiles the assembly text into the final game file, producing &lt;code&gt;zork1.z3&lt;/code&gt; (or &lt;code&gt;.z5&lt;/code&gt; depending on the version target).&lt;/p&gt;
&lt;p&gt;When I ran it ZILF printed warnings, but nothing serious.&lt;/p&gt;
&lt;p&gt;That’s it: an 84 KB file, &lt;code&gt;zork1.z3&lt;/code&gt;, in the same format Infocom shipped on floppy disks in the early 80s.&lt;/p&gt;
&lt;h2 id=&quot;step-4-play-and-test-your-build&quot;&gt;Step 4: Play and Test Your Build&lt;/h2&gt;
&lt;p&gt;The resulting game file is a virtual machine image. To run it, you need a Z-machine interpreter.&lt;/p&gt;
&lt;p&gt;You have two choices:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Download &lt;strong&gt;&lt;a href=&quot;https://github.com/angstsmurf/spatterlight&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Spatterlight&lt;/a&gt;&lt;/strong&gt;, a modern Interactive Fiction interpreter designed for macOS.&lt;/li&gt;
&lt;li&gt;Install the classic command-line interpreter &lt;strong&gt;Frotz&lt;/strong&gt; via Homebrew.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I’m going with the latter:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;shell&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;brew&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; install&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; frotz&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;frotz&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; zork1.z3&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/projects/2026/project-building-infocom-from-source-zork1-799.webp&quot; alt=&quot;image&quot; srcset=&quot;/thumbs/images/projects/2026/project-building-infocom-from-source-zork1-480.webp 480w, /thumbs/images/projects/2026/project-building-infocom-from-source-zork1-799.webp 799w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;799&quot; height=&quot;235&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; data-full=&quot;/images/projects/2026/project-building-infocom-from-source-zork1.png&quot;&gt;&lt;/p&gt;
&lt;p&gt;That installs three versions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;frotz&lt;/code&gt;, the full-screen terminal version with a status bar&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dfrotz&lt;/code&gt;, a “dumb” version that just reads and writes plain text&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sfrotz&lt;/code&gt;, a graphical SDL version&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;dfrotz&lt;/code&gt; is handy for testing, because you can pipe a list of commands in and check that the game responds properly:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;zsh&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; &apos;open mailbox\nread leaflet\nnorth\nnorth\nup\ntake egg\n...&apos;&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt; |&lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt; dfrotz&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -m&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -p&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; zork1.z3&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;zork-ii-and-iii&quot;&gt;Zork II and III&lt;/h2&gt;
&lt;p&gt;The sequels use exactly the same layout.&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;zsh&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;git&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; clone&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; https://github.com/the-infocom-files/zork2.git&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;git&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; clone&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; https://github.com/the-infocom-files/zork3.git&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;cd&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; zork2&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; &amp;#x26;&amp;#x26; &lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;zilf&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; zork2.zil&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; &amp;#x26;&amp;#x26; &lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;zapf&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; zork2.zap&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;cd&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; zork3&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; &amp;#x26;&amp;#x26; &lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;zilf&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; zork3.zil&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; &amp;#x26;&amp;#x26; &lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;zapf&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; zork3.zap&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Both compiled with no errors (26 warnings each), producing an 89 KB &lt;code&gt;zork2.z3&lt;/code&gt; and an 85 KB &lt;code&gt;zork3.z3&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Zork II starts in the Barrow with the lantern and sword. Zork III opens with the Dungeon Master’s dream sequence at the bottom of the Endless Stair.&lt;/p&gt;
&lt;p&gt;One quirk: the banner shows &lt;strong&gt;Release 1&lt;/strong&gt; and a serial number based on the build date, not the original Infocom release numbers. That’s expected when you build from source yourself.&lt;/p&gt;
&lt;h2 id=&quot;the-rest-of-the-catalogue&quot;&gt;The rest of the catalogue&lt;/h2&gt;
&lt;p&gt;With Zork working, I wanted to try other titles. You can find the Infocom source repo here on &lt;a href=&quot;https://github.com/the-infocom-files&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;The Infocom Files&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I tried Deadline, Planetfall, Leather Goddesses of Phobos and The Hitchhiker’s Guide to the Galaxy. These turned out to be easier than Zork: each repo includes its own parser and verbs, so there’s no shared engine to clone. It’s just clone, &lt;code&gt;zilf&lt;/code&gt;, &lt;code&gt;zapf&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;That worked so well that I went through the rest of the titles. Almost every game has a main file with the same name as its repo, so a simple loop builds most of them:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;zsh&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; g &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; amfv&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; ballyhoo&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; beyondzork&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; borderzone&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; bureaucracy&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; cutthroats&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; deadline&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;         enchanter&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; hitchhiker&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; hollywoodhijinx&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; infidel&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; journey&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; leathergoddesses&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;         lurkinghorror&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; moonmist&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; nordandbert&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; planetfall&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; plunderedhearts&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; seastalker&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;         sherlock&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; sorcerer&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; spellbreaker&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; starcross&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; stationfall&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; suspect&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; suspended&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;         trinity&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; wishbringer&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; witness&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;do&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;  git&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; clone&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; https://github.com/the-infocom-files/&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;$g&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;.git&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;  (&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;cd&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; $g &amp;#x26;&amp;#x26; &lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;zilf&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; $g&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;.zil&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; &amp;#x26;&amp;#x26; &lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;zapf&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; $g&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;.zap&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;done&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Every one of those compiled first time. A few things stood out:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Not all &lt;code&gt;.z3&lt;/code&gt;.&lt;/strong&gt; Infocom extended the Z-machine as its games got bigger. Most of the classics are version 3 (&lt;code&gt;.z3&lt;/code&gt;). A Mind Forever Voyaging, Trinity, Bureaucracy and Nord and Bert are version 4 (&lt;code&gt;.z4&lt;/code&gt;). Beyond Zork, Border Zone and Sherlock are version 5 (&lt;code&gt;.z5&lt;/code&gt;). ZILF picks the right version from the &lt;code&gt;&amp;#x3C;VERSION&gt;&lt;/code&gt; line in the source.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Bigger games.&lt;/strong&gt; The early titles are 80 to 125 KB. Trinity, A Mind Forever Voyaging and Beyond Zork are around 250 KB.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Some odd openings, all expected.&lt;/strong&gt; Beyond Zork asks “Is this a VT220?”. Bureaucracy makes you fill in a licence application form before you can play. Leather Goddesses opens with a content warning and has you choose a toilet in Joe’s Bar, which is how the game decides your character’s gender.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;the-tricky-ones-infocoms-new-parser&quot;&gt;The tricky ones: Infocom’s new parser&lt;/h3&gt;
&lt;p&gt;Four of the later games, &lt;strong&gt;Zork Zero&lt;/strong&gt;, &lt;strong&gt;Shogun&lt;/strong&gt;, &lt;strong&gt;Journey&lt;/strong&gt; and &lt;strong&gt;Arthur&lt;/strong&gt;, are version 6 games that originally had graphics. Journey built with the loop above, but the other three failed with around a hundred errors each.&lt;/p&gt;
&lt;p&gt;The cause was that they use Infocom’s later &lt;strong&gt;“new parser”&lt;/strong&gt;, a shared library that isn’t in their repos. It lives in a separate repo, &lt;a href=&quot;https://github.com/the-infocom-files/zillib&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;zillib&lt;/a&gt;, and ZILF needs to be told where to find it with &lt;code&gt;-ip&lt;/code&gt; (include path):&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;zsh&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;git&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; clone&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; https://github.com/the-infocom-files/zillib.git&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;cd&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; zork0&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; &amp;#x26;&amp;#x26; &lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;zilf&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -ip&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; ../zillib&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -ip&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; ../zillib/parser&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; zork0.zil&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; &amp;#x26;&amp;#x26; &lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;zapf&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; zork0.zap&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;cd&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; shogun&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; &amp;#x26;&amp;#x26; &lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;zilf&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -ip&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; ../zillib&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -ip&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; ../zillib/parser&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; a5.zil&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; &amp;#x26;&amp;#x26; &lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;zapf&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; a5.zap&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note that Shogun’s main file is &lt;code&gt;a5.zil&lt;/code&gt;, its old internal project name, so you’ll want to rename the output to &lt;code&gt;shogun.z6&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;That fixed Zork Zero and Shogun. &lt;strong&gt;Arthur&lt;/strong&gt; needed a few small edits to its source before it would build:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Old file paths.&lt;/strong&gt; Arthur loads the parser with &lt;code&gt;&amp;#x3C;XFLOAD &quot;~PARSER/PARSER.REST&quot;&gt;&lt;/code&gt; and the hints with &lt;code&gt;&amp;#x3C;INSERT-FILE &quot;~ZILLIB/CLUES&quot;&gt;&lt;/code&gt;. Those &lt;code&gt;~PARSER&lt;/code&gt; and &lt;code&gt;~ZILLIB&lt;/code&gt; paths pointed at folders on Infocom’s own systems. Changing them to &lt;code&gt;&amp;#x3C;INSERT-FILE &quot;parser.rest&quot;&gt;&lt;/code&gt; and &lt;code&gt;&amp;#x3C;INSERT-FILE &quot;clues&quot;&gt;&lt;/code&gt; lets ZILF find them on the include path.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Upper-case package names.&lt;/strong&gt; Arthur writes things like &lt;code&gt;&amp;#x3C;INCLUDE &quot;PDEFS&quot;&gt;&lt;/code&gt;, while the parser library itself uses &lt;code&gt;&amp;#x3C;INCLUDE &quot;pdefs&quot;&gt;&lt;/code&gt;. ZILF treats those as &lt;strong&gt;two different packages&lt;/strong&gt;, so it loaded the parser definitions twice and complained that everything was “already defined”. Lower-casing the names in Arthur’s &lt;code&gt;INCLUDE&lt;/code&gt; and &lt;code&gt;USE&lt;/code&gt; lines fixed that.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;One missing constant.&lt;/strong&gt; The shared parser checks whether the player’s action is &lt;code&gt;V?DO?&lt;/code&gt;, the action for a &lt;code&gt;DO&lt;/code&gt; command. Arthur’s developers commented that command out, so the constant never exists and ZILF refuses to compile. Adding &lt;code&gt;&amp;#x3C;CONSTANT V?DO? -1&gt;&lt;/code&gt; gives it a value that can never match a real action.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;After that, Arthur compiled cleanly, and it starts properly in the Churchyard, with Merlin, a torque and a chivalry score.&lt;/p&gt;
&lt;p&gt;One caveat for all four version 6 games: the artwork was stored in &lt;strong&gt;separate picture files&lt;/strong&gt; that aren’t part of the source code. The games still run, but text-only, with a one-off “picture resources are missing” warning from Frotz. Journey is the least comfortable of the four, because it’s built around menus rather than typed commands.&lt;/p&gt;
&lt;h3 id=&quot;what-i-didnt-build&quot;&gt;What I didn’t build&lt;/h3&gt;
&lt;p&gt;I skipped the repos that aren’t full games: the InvisiClues hint files, the three Infocom samplers, the German and “mini” versions of Zork, and a second, raw copy of Hitchhiker’s Guide.&lt;/p&gt;
&lt;h2 id=&quot;a-shortcut-to-play-them&quot;&gt;A shortcut to play them&lt;/h2&gt;
&lt;p&gt;I copied every story file into its own folder under &lt;code&gt;~/Games&lt;/code&gt; (for example &lt;code&gt;~/Games/planetfall/planetfall.z3&lt;/code&gt;), then added a function to my &lt;code&gt;.zshrc&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;zsh&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6A737D&quot;&gt;# Play Infocom games in ~/Games: `infocom` lists them, `infocom planetfall` plays one&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;infocom&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;() {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;  if&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; [[ &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;-z&lt;/span&gt;&lt;span style=&quot;color:#FFAB70&quot;&gt; $1&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; ]]; &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;    print&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -l&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; ~/Games/&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;.z[1-8]&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;N:t:r&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;    return&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;  fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;  local&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; game&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;( &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;~&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;/Games/&lt;/span&gt;&lt;span style=&quot;color:#FFAB70&quot;&gt;$1&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color:#FFAB70&quot;&gt;$1&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;.z&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;[1-8](&lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;N&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;) )&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;  (( $#game )) &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;||&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;print&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -u2&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; &quot;infocom: no game &apos;&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;$1&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;&apos; in ~/Games&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; 1&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;  frotz&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; $game&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;[1]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;_infocom&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;() { &lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;compadd&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; ~/Games/&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;.z[1-8]&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;N:t:r&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;compdef&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; _infocom&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; infocom&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6A737D&quot;&gt;# Play Zork: `zork` for Zork I, `zork 2` / `zork 3` for the sequels&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;zork&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;() { &lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;infocom&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; zork&lt;/span&gt;&lt;span style=&quot;color:#FFAB70&quot;&gt;${1&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;:-&lt;/span&gt;&lt;span style=&quot;color:#FFAB70&quot;&gt;1}&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; }&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Typing &lt;code&gt;infocom&lt;/code&gt; lists everything, &lt;code&gt;infocom hitchhiker&lt;/code&gt; starts a game, and Tab completes the names. &lt;code&gt;zork&lt;/code&gt; still drops me straight into the field west of the white house.&lt;/p&gt;
&lt;h2 id=&quot;on-windows-or-linux&quot;&gt;On Windows or Linux&lt;/h2&gt;
&lt;p&gt;I only tested this on macOS, but nothing in the process is Mac-specific. ZILF publishes official builds for all three platforms, and Frotz is everywhere. The only changes are how you install the two tools.&lt;/p&gt;





























&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;/th&gt;&lt;th&gt;macOS&lt;/th&gt;&lt;th&gt;Linux&lt;/th&gt;&lt;th&gt;Windows&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;ZILF&lt;/td&gt;&lt;td&gt;&lt;code&gt;osx-arm64&lt;/code&gt; tarball&lt;/td&gt;&lt;td&gt;&lt;code&gt;linux-x64&lt;/code&gt; or &lt;code&gt;linux-arm64&lt;/code&gt; tarball, &lt;code&gt;.deb&lt;/code&gt; or &lt;code&gt;.rpm&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;win-x64&lt;/code&gt; zip or &lt;code&gt;.msi&lt;/code&gt; installer&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Interpreter&lt;/td&gt;&lt;td&gt;&lt;code&gt;brew install frotz&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;sudo apt install frotz&lt;/code&gt; (or your distro’s equivalent)&lt;/td&gt;&lt;td&gt;&lt;a href=&quot;https://www.davidkinder.co.uk/frotz.html&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Windows Frotz&lt;/a&gt; or &lt;a href=&quot;https://github.com/garglk/garglk&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Gargoyle&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Shell&lt;/td&gt;&lt;td&gt;zsh&lt;/td&gt;&lt;td&gt;bash or zsh&lt;/td&gt;&lt;td&gt;PowerShell&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Linux&lt;/strong&gt; is almost identical to macOS. Download the Linux tarball for your CPU from the &lt;a href=&quot;https://foss.heptapod.net/zilf/zilf/-/releases&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;ZILF releases page&lt;/a&gt;, put its &lt;code&gt;bin&lt;/code&gt; folder on your &lt;code&gt;PATH&lt;/code&gt;, and every command above works as written. If you use bash rather than zsh, this simpler shortcut does the same job:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;infocom&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;() { &lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;frotz&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; ~/Games/&quot;&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;$1&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;$1&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;&quot;.z[1-8]&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;; }&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Windows&lt;/strong&gt; needs the most translation, but it’s still straightforward. Install Git, download the ZILF Windows zip, and run the same &lt;code&gt;zilf&lt;/code&gt; and &lt;code&gt;zapf&lt;/code&gt; commands from PowerShell. The zip has no top-level folder, so extract it into one. The Zork I build looks like this:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;powershell&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;git clone https:&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;github.com&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;the&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;infocom&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;files&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;zork&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;substrate.git&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;git clone https:&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;github.com&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;the&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;infocom&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;files&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;zork1.git&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;Expand-Archive&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; zilf&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;0.11&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;win&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;x64.zip &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;DestinationPath zilf&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;env:&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;Path &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;$PWD&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;\zilf\bin;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;env:&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;Path&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;cd zork1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;zilf zork1.zil&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;zapf zork1.zap&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then open &lt;code&gt;zork1.z3&lt;/code&gt; in Windows Frotz. It has a proper windowed interface, so there’s no terminal shortcut to set up. Alternatively, Windows users can install WSL and follow the Linux steps exactly.&lt;/p&gt;
&lt;p&gt;Whichever platform you build on, the story files are identical. A &lt;code&gt;.z3&lt;/code&gt; built on a Mac plays the same in Windows Frotz, Gargoyle, or a phone app.&lt;/p&gt;
&lt;h2 id=&quot;a-note-on-licences&quot;&gt;A note on licences&lt;/h2&gt;
&lt;p&gt;The Zork repos carry an &lt;strong&gt;MIT licence from Microsoft&lt;/strong&gt;, so those are fine to share. You can read the &lt;a href=&quot;https://opensource.microsoft.com/blog/2025/11/20/preserving-code-that-shaped-generations-zork-i-ii-and-iii-go-open-source/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;press release about Zork on the Microsoft website&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The other games’ repos have no licence file, so building and playing them yourself is fine.&lt;/p&gt;
&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;





























&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Step&lt;/th&gt;&lt;th&gt;Tool&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Get the game source&lt;/td&gt;&lt;td&gt;&lt;code&gt;git clone&lt;/code&gt; (one repo per game)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Get shared code&lt;/td&gt;&lt;td&gt;&lt;code&gt;zork-substrate&lt;/code&gt; for Zork, &lt;code&gt;zillib&lt;/code&gt; for V6&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Compile ZIL to assembly&lt;/td&gt;&lt;td&gt;&lt;code&gt;zilf&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Assemble the story file&lt;/td&gt;&lt;td&gt;&lt;code&gt;zapf&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Play&lt;/td&gt;&lt;td&gt;&lt;code&gt;frotz&lt;/code&gt; (or any Z-machine interpreter)&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;All 35 games now start and respond in Frotz. It still amazes me that code written more than 40 years ago compiles with a modern open-source toolchain and runs exactly as intended.&lt;/p&gt;
&lt;p&gt;In some ways, I think playing these text-only adventures are a nice antidote to modern games, and perfect for winter evenings and lazy Sunday’s! Just remember, save often, and watch out for grues.&lt;/p&gt;</content:encoded><category>zork</category><category>infocom</category><category>interactive-fiction</category><category>retro-gaming</category><category>zil</category><category>macos</category><category>tools</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/projects/2026/project-heroimage-building-infocom-games-from-source.png" length="0" type="image/png"/></item><item><title>Building a Contact Form</title><link>https://elliotx.com/projects/2026/building-a-contact-form</link><guid isPermaLink="true">https://elliotx.com/projects/2026/building-a-contact-form</guid><description>Adding a captcha-protected contact form to a static website with Cloudflare Turnstile, Cloud Run and Resend</description><pubDate>Sat, 17 Oct 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-heroimage-building-a-contact-form.jpg&quot; alt=&quot;Building a Contact Form&quot; /&gt;
&lt;p&gt;This website has never had a way for anyone to get in touch. That’s partly by design, since a &lt;code&gt;mailto:&lt;/code&gt; link is an open invitation to spam harvesters, but mostly because the site is entirely static. Astro builds it into HTML files, Cloud Build copies them into a Cloud Storage bucket, and a Google Cloud load balancer serves them through Cloud CDN, with Cloudflare in front of the lot. There’s no server sitting there waiting to receive a form submission.&lt;/p&gt;
&lt;p&gt;So a contact form meant building a small one, and putting a captcha in front of it so it doesn’t become a spam pipe straight into my inbox. I paired with Claude Code on this one.&lt;/p&gt;
&lt;h2 id=&quot;the-choices&quot;&gt;The choices&lt;/h2&gt;
&lt;p&gt;There were four decisions to make before writing any code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The captcha: Cloudflare Turnstile.&lt;/strong&gt; Google’s reCAPTCHA is the obvious default, but it sets tracking cookies, and I’d rather not hand my visitors to Google just so they can say hello. &lt;a href=&quot;https://developers.cloudflare.com/turnstile/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Turnstile&lt;/a&gt; is free, usually invisible (most people never see a challenge at all), and works whether or not your DNS is on Cloudflare. Mine is, which made it an easy pick.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Somewhere to receive the form: Cloud Run.&lt;/strong&gt; I already run a small Cloud Run service for the &lt;a href=&quot;https://elliotx.com/projects/2026/building-the-now-playing-widget/&quot;&gt;now playing widget&lt;/a&gt;, with Terraform and a GitHub Actions deploy pipeline around it. A contact form backend is the same shape: a tiny service that scales to zero and costs next to nothing when nobody is using it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Delivering messages: Resend.&lt;/strong&gt; The form needs to end up as an email. &lt;a href=&quot;https://resend.com/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Resend&lt;/a&gt; is a transactional email API with a free tier that comfortably covers a personal website. I also considered sending through Gmail with an app password, which felt fragile, and storing messages in a database, which I’d never remember to check.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Routing: the site’s own domain.&lt;/strong&gt; The browser could post straight to Cloud Run’s &lt;code&gt;*.run.app&lt;/code&gt; address, but that’s a cross-site request, with CORS to configure. Instead I added a path rule to the existing load balancer so &lt;code&gt;elliotx.com/api/contact&lt;/code&gt; goes to the service. The form posts to its own domain, there’s no CORS at all, and the Cloud Run service can be locked down to accept traffic &lt;em&gt;only&lt;/em&gt; from the load balancer.&lt;/p&gt;
&lt;h2 id=&quot;architecture&quot;&gt;Architecture&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-contact-form-architecture.svg&quot; alt=&quot;image&quot;&gt;&lt;/p&gt;
&lt;p&gt;Following a message through:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The visitor loads &lt;code&gt;/contact&lt;/code&gt; like any other page: through Cloudflare, then the load balancer, then the bucket.&lt;/li&gt;
&lt;li&gt;The Turnstile widget on the page quietly checks the browser and issues a token.&lt;/li&gt;
&lt;li&gt;On submit, the page posts the form and the token to &lt;code&gt;/api/contact&lt;/code&gt;. The load balancer’s path rule sends that one path to Cloud Run instead of the bucket.&lt;/li&gt;
&lt;li&gt;The service checks the token with Cloudflare’s &lt;code&gt;siteverify&lt;/code&gt; API, then hands the message to Resend.&lt;/li&gt;
&lt;li&gt;Resend delivers it to my inbox, with the reply-to set to the visitor, so hitting reply just works.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The secrets (the Turnstile secret key, the Resend API key and my inbox address) live in Secret Manager. Cloud Run passes them to the service as environment variables at startup.&lt;/p&gt;
&lt;h2 id=&quot;the-page&quot;&gt;The page&lt;/h2&gt;
&lt;p&gt;The page itself is plain Astro: name, email and message fields, plus the Turnstile widget, which is one &lt;code&gt;div&lt;/code&gt; and a script tag.&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;html&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt; class&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;&quot;cf-turnstile&quot;&lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt; data-sitekey&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#FDAEB7;font-style:italic&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;your-site-key&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt; data-theme&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;&quot;auto&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt; src&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;&quot;https://challenges.cloudflare.com/turnstile/v0/api.js&quot;&lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt; async&lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt; defer&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The site key is public by design, since it ships in the page. The matching &lt;em&gt;secret&lt;/em&gt; key never leaves the server.&lt;/p&gt;
&lt;p&gt;When the widget finishes, it drops a hidden &lt;code&gt;cf-turnstile-response&lt;/code&gt; input into the form. A few lines of JavaScript post the fields and that token as JSON, show a “sent” or “something went wrong” message inline, and reset the widget afterwards, because each token can only be used once.&lt;/p&gt;
&lt;p&gt;There’s one more field you can’t see. A hidden “website” input sits off-screen, out of the tab order and hidden from screen readers. People never fill it in. Naive bots fill in every field they find, which gives them away.&lt;/p&gt;
&lt;h2 id=&quot;the-backend&quot;&gt;The backend&lt;/h2&gt;
&lt;p&gt;The service is a small TypeScript app with no runtime dependencies: Node’s built-in HTTP server and &lt;code&gt;fetch&lt;/code&gt; cover everything. It follows the same pattern as my other apps, with a distroless container image, linting and type checks on every pull request, and a shared GitHub Actions workflow that builds, scans and deploys it.&lt;/p&gt;
&lt;p&gt;Every submission runs a gauntlet of checks, cheapest first, so junk is thrown out before it costs a call to Cloudflare or Resend.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-contact-form-request-checks.svg&quot; alt=&quot;image&quot;&gt;&lt;/p&gt;
&lt;p&gt;A few of these are worth explaining.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The origin check.&lt;/strong&gt; The form is only ever served from my own domain, so any &lt;code&gt;POST&lt;/code&gt; that arrives from another site’s page is rejected outright. That stops someone embedding my form somewhere else.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The honeypot answers “200 OK”.&lt;/strong&gt; If the hidden field has anything in it, the service pretends everything went fine and quietly drops the message. Returning an error would tell the bot it had been caught.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The rate limit counts after validation.&lt;/strong&gt; It’s a small per-visitor limit, held in memory, as a backstop behind the captcha. I deliberately count only submissions that pass validation, so someone who fumbles the email field a few times doesn’t lock themselves out.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The captcha is checked on the server.&lt;/strong&gt; This is the step that actually matters. The widget on its own stops nothing: a bot can skip the page entirely and post straight to the API. The real check is the server asking Cloudflare whether the token is genuine:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;ts&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; form&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt; new&lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt; URLSearchParams&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;({ secret, response: token });&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; (remoteIp) form.&lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;&apos;remoteip&apos;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;, remoteIp);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; res&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt; await&lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt; fetch&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;&apos;https://challenges.cloudflare.com/turnstile/v0/siteverify&apos;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;, {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;  method: &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;&apos;POST&apos;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;  body: form,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;  signal: AbortSignal.&lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;timeout&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;10_000&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; data&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt; await&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; res.&lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;json&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6A737D&quot;&gt;// Also check the token was issued on my site, not someone else&apos;s.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; data.success &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;&amp;#x26;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; data.hostname &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;===&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; expectedHostname;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Tokens are single-use and expire after five minutes, so a captured token can’t be replayed.&lt;/p&gt;
&lt;p&gt;Finally, the message goes to Resend’s API with &lt;code&gt;reply_to&lt;/code&gt; set to the visitor’s address. The email comes from a send-only address on my domain, with no mailbox behind it.&lt;/p&gt;
&lt;h2 id=&quot;infrastructure&quot;&gt;Infrastructure&lt;/h2&gt;
&lt;p&gt;Everything is in Terraform, in the same repo as the rest of the site’s infrastructure, with one folder (and one state file) per app. The contact form’s stack creates:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a runtime service account that can read its own three secrets and nothing else&lt;/li&gt;
&lt;li&gt;a deploy service account for GitHub Actions, authenticated with Workload Identity Federation, so there are no long-lived keys&lt;/li&gt;
&lt;li&gt;an Artifact Registry repository for the container images&lt;/li&gt;
&lt;li&gt;three Secret Manager secrets, created &lt;em&gt;empty&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;the Cloud Run service, with its ingress set to accept traffic only from the load balancer&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Notice that Terraform creates the secrets but never their values. Anything Terraform writes ends up in its state file, so the values are added by hand afterwards:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;shell&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6A737D&quot;&gt;# zsh: read&apos;s &quot;name?prompt&quot; syntax&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; s &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; turnstile-secret-key&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; resend-api-key&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; contact-to-email&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;do&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;  read&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -rs&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; &quot;v?&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;$s&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;: &quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; &amp;#x26;&amp;#x26; &lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; &amp;#x26;&amp;#x26; &lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; &apos;%s&apos;&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;$v&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt; |&lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt; gcloud&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; secrets&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; versions&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; add&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;$s&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; --data-file=-&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;done&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;read -rs&lt;/code&gt; prompts without echoing what you type, so nothing lands on screen or in shell history.&lt;/p&gt;
&lt;p&gt;On the load balancer side, the change is a serverless network endpoint group pointing at the Cloud Run service, a backend service, and one path rule on the existing URL map. Every other path still goes to the bucket:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;hcl&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;path_matcher&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;  name&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;            =&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; &quot;site&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;  default_service&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; google_compute_backend_bucket&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;static_backend&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;id&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;  path_rule&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;    paths&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;   =&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;&quot;/api/contact&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;    service&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; google_compute_backend_service&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;contact_form[&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;id&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;rolling-it-out&quot;&gt;Rolling it out&lt;/h2&gt;
&lt;p&gt;This took more steps than I expected, because of one Cloud Run rule: &lt;strong&gt;it won’t create a service whose secrets have no value yet.&lt;/strong&gt; And the values can’t exist until Terraform has created the secrets. It’s a chicken-and-egg problem.&lt;/p&gt;
&lt;p&gt;The fix was a &lt;code&gt;create_service&lt;/code&gt; switch, defaulting to off. The first Terraform run creates everything except the service, then I add the secret values, then a second, one-line change flips the switch. The load balancer route sits behind a matching switch, so the live site doesn’t change until there’s something behind &lt;code&gt;/api/contact&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-contact-form-rollout.svg&quot; alt=&quot;image&quot;&gt;&lt;/p&gt;
&lt;p&gt;The page went out last of all, so nobody could ever find a form with nothing behind it.&lt;/p&gt;
&lt;h2 id=&quot;gotchas&quot;&gt;Gotchas&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Cloudflare in front changes the visitor’s IP.&lt;/strong&gt; With Cloudflare proxying the site, the load balancer’s idea of “the visitor” is actually a Cloudflare edge server. The rate limit’s first draft used the first entry of the &lt;code&gt;X-Forwarded-For&lt;/code&gt; header, which looks right but is the one part of that header a client controls. Anyone could have sent a fake one. The service now uses Cloudflare’s &lt;code&gt;CF-Connecting-IP&lt;/code&gt; header, which Cloudflare sets itself, overwriting anything the client sent.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Email DNS records must not be proxied.&lt;/strong&gt; Resend verifies your domain with a couple of DNS records, and Cloudflare proxies new records by default. A proxied record doesn’t return what Resend is looking for, so they need to be “DNS only” (the grey cloud). In the end Resend connected to Cloudflare and set them up itself, correctly.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Test with Cloudflare’s test keys.&lt;/strong&gt; The real Turnstile site key only works on the hostname it’s registered for, so it fails on &lt;code&gt;localhost&lt;/code&gt;. Cloudflare publishes &lt;a href=&quot;https://developers.cloudflare.com/turnstile/troubleshooting/testing/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;dummy keys&lt;/a&gt; that always pass or always fail, which made it easy to test both paths locally.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;gcloud&lt;/code&gt; stamps every deploy.&lt;/strong&gt; Each &lt;code&gt;gcloud run deploy&lt;/code&gt; labels the service with the client that deployed it. Terraform then showed a pointless change on every plan, and the next deploy put the label straight back. Telling Terraform to ignore those two fields stopped the noise for every Cloud Run service on the site, not just this one.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;testing&quot;&gt;Testing&lt;/h2&gt;
&lt;p&gt;Before anything went near production, I ran the whole chain locally. That was the built site plus the backend, behind a tiny Node script standing in for the load balancer, so &lt;code&gt;/api/contact&lt;/code&gt; was routed exactly as it would be in production. Using Cloudflare’s test keys and a deliberately fake Resend key, I submitted the form in a real browser and watched the token get issued, verified, and handed to Resend (which rejected the fake key, as expected). Every rejection path in the checks diagram was tested with &lt;code&gt;curl&lt;/code&gt; too.&lt;/p&gt;
&lt;p&gt;Once it was all deployed, the real test was simple: I sent myself a message. It arrived.&lt;/p&gt;
&lt;h2 id=&quot;result&quot;&gt;Result&lt;/h2&gt;
&lt;p&gt;There’s now a &lt;a href=&quot;https://elliotx.com/contact&quot;&gt;contact page&lt;/a&gt;. For visitors, it’s a short form and a captcha that usually passes without them doing anything. Behind it sits a stateless service that costs nothing when idle, sets no tracking cookies, keeps every secret out of git and Terraform state, and refuses to talk to anything except my own load balancer.&lt;/p&gt;
&lt;p&gt;It’s a lot of plumbing for one form. But most of it was already there from earlier projects, and the new pieces (the path rule, the secrets, the two-step rollout) are now a pattern I can reuse the next time the site needs a little bit of backend.&lt;/p&gt;</content:encoded><category>cloud-run</category><category>cloudflare</category><category>gcp</category><category>security</category><category>terraform</category><category>typescript</category><category>website</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/projects/2026/project-heroimage-building-a-contact-form.jpg" length="0" type="image/jpeg"/></item><item><title>JFrog Log Purge Tool</title><link>https://elliotx.com/projects/2026/jfrog-log-purge-tool</link><guid isPermaLink="true">https://elliotx.com/projects/2026/jfrog-log-purge-tool</guid><description>A scheduled Cloud Run Job that clears year-old logs out of JFrog Artifactory, and the three deployment designs it took to get there.</description><pubDate>Wed, 14 Oct 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-heroimage-jfrog-log-purge-tool.jpg&quot; alt=&quot;Architecture diagram of a scheduled Cloud Run Job purging old log files from JFrog Artifactory&quot; /&gt;
&lt;p&gt;This is another work project, a companion to the &lt;a href=&quot;https://elliotx.com/projects/2026/jfrog-artifact-scanner&quot;&gt;JFrog Artifact Scanner&lt;/a&gt;. As before I can’t share the source code, but I can share the problem, the design and what I learned. This one taught me less about JFrog and more about choosing how to deploy something small.&lt;/p&gt;
&lt;h2 id=&quot;the-problem&quot;&gt;The problem&lt;/h2&gt;
&lt;p&gt;JFrog Artifactory keeps its own system and request logs in a built-in repository called &lt;code&gt;jfrog-logs&lt;/code&gt;. Artifactory writes to it constantly, and nothing ever removes anything from it.&lt;/p&gt;
&lt;p&gt;So it just grows. Old logs sit next to yesterday’s, counting towards storage, and nobody will ever read them. There are no mechanisms to create a clean up retention policy which is surprising as this is something one becomes used to using as a matter of lifecycle policy with vendors.&lt;/p&gt;
&lt;p&gt;Cleaning it up manually meant someone deleting old files by hand now and then, which is a real pain as every 2-hours there’s a new archive file, and each file needs to be selected and deleted. Imagine doing this for years worth of logs? Who’s going to do it?&lt;/p&gt;
&lt;p&gt;As a result of the JFrog Artifact Scanner I created, I investigated if a function could be created to delete old logs. I created a proof-of-concept (POC) script which I ran manually, it hit the API and deleted old logs. Once I showed it to my team I got the go ahead to automate it.&lt;/p&gt;
&lt;h2 id=&quot;the-idea&quot;&gt;The idea&lt;/h2&gt;
&lt;p&gt;Delete anything older than a year, once a week at 02:00 on Monday, and keep each run small enough to be safe:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Find files in &lt;code&gt;jfrog-logs&lt;/code&gt; older than the retention period, oldest first&lt;/li&gt;
&lt;li&gt;Delete a capped batch of them&lt;/li&gt;
&lt;li&gt;Leave whatever’s left for the next run&lt;/li&gt;
&lt;li&gt;Record what happened&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The first few runs work through whatever backlog has built up. After that, each run only has a week’s worth of newly expired logs.&lt;/p&gt;
&lt;h2 id=&quot;architecture&quot;&gt;Architecture&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-log-purge-architecture.svg&quot; alt=&quot;Log purge tool cloud architecture&quot;&gt;&lt;/p&gt;
&lt;p&gt;Like the scanner, the purge tool is a containerised Python app running as a &lt;strong&gt;Cloud Run Job&lt;/strong&gt;. It’s a batch task with a clear start and end. It doesn’t need to listen for requests, and a failed run should show up as a failed execution, which is exactly how Cloud Run Jobs behave.&lt;/p&gt;
&lt;p&gt;It reuses the scanner’s layout:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ci-project&lt;/strong&gt; holds the build side. Cloud Build builds the image when changes merge to main, and Artifact Registry stores it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;runtime-project&lt;/strong&gt; holds the runtime side: Cloud Scheduler, the Cloud Run Job and Secret Manager. It’s the same project the scanner runs in.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The job pulls its image from the CI project’s registry across the project boundary, so the runtime side needs an IAM binding on that registry, just as the scanner does. Outbound traffic goes through the project’s serverless VPC connector to reach Artifactory.&lt;/p&gt;
&lt;p&gt;Getting to this architecture took three attempts. More on that &lt;a href=&quot;#getting-to-boring&quot;&gt;below&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;how-a-run-works&quot;&gt;How a run works&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-log-purge-run-flow.svg&quot; alt=&quot;Log purge tool run flow&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;1-fail-fast&quot;&gt;1. Fail fast&lt;/h3&gt;
&lt;p&gt;The job reads all its settings at start-up: the JFrog URL, the token, the repository name, the retention period and the batch limits. If any of them is missing, it fails immediately. It then pings Artifactory before touching any data. Either failure exits non-zero, and Cloud Run marks the execution as failed.&lt;/p&gt;
&lt;h3 id=&quot;2-find-the-oldest-logs&quot;&gt;2. Find the oldest logs&lt;/h3&gt;
&lt;p&gt;One &lt;strong&gt;AQL (Artifactory Query Language)&lt;/strong&gt; query does all the searching:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;text&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;items.find({&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;repo&quot;: {&quot;$eq&quot;: &quot;jfrog-logs&quot;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;type&quot;: {&quot;$eq&quot;: &quot;file&quot;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;created&quot;: {&quot;$before&quot;: &quot;365d&quot;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;})&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;.include(&quot;repo&quot;, &quot;path&quot;, &quot;name&quot;, &quot;created&quot;, &quot;size&quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;.sort({&quot;$asc&quot;: [&quot;created&quot;]})&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;.limit(10000)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It asks for files only, created more than 365 days ago, oldest first, with a cap of 10,000 per run. It also returns each file’s size, so the job can report how much space it freed.&lt;/p&gt;
&lt;p&gt;There’s no pagination, deliberately. Files deleted in one run don’t come back in the next run’s query, so each run naturally carries on from where the last one stopped. There’s no offset to track and no state to keep between runs.&lt;/p&gt;
&lt;h3 id=&quot;3-delete-in-parallel&quot;&gt;3. Delete in parallel&lt;/h3&gt;
&lt;p&gt;Each file is deleted with its own call to the Artifactory delete API. As with the scanner’s status checks, the deletes run in a &lt;strong&gt;thread pool of 10 workers&lt;/strong&gt; sharing one HTTP session, with &lt;strong&gt;retries and exponential backoff&lt;/strong&gt; on &lt;code&gt;429&lt;/code&gt; and &lt;code&gt;5xx&lt;/code&gt; responses.&lt;/p&gt;
&lt;p&gt;A &lt;code&gt;404&lt;/code&gt; counts as success. If a file is already gone, whether from an earlier retried run or someone deleting it by hand, that’s the outcome we wanted anyway. That makes every run safe to repeat.&lt;/p&gt;
&lt;h3 id=&quot;4-stay-inside-a-time-budget&quot;&gt;4. Stay inside a time budget&lt;/h3&gt;
&lt;p&gt;Cloud Run Jobs have a task timeout, and a job killed halfway through doesn’t get to report what it did. So the job has its own, shorter budget: after 25 minutes it stops starting new deletes, finishes the ones already in flight, and counts the rest as skipped. The skipped files are simply the oldest ones left for the next run. In reality when the function first ran it found just over 7000 files to delete, and executed deletions in about 30-seconds. 7000 files, 30-seconds. Definitely a case for automation right there!&lt;/p&gt;
&lt;h3 id=&quot;5-report&quot;&gt;5. Report&lt;/h3&gt;
&lt;p&gt;Every run ends with one structured &lt;strong&gt;&lt;code&gt;PURGE_SUMMARY&lt;/code&gt;&lt;/strong&gt; log entry:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;json&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;  &quot;found&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;10000&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;  &quot;deleted&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;9998&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;  &quot;failed&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;  &quot;skipped&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;  &quot;bytes_freed&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;5368709120&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;  &quot;backlog_remaining&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;  &quot;duration_seconds&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;412.3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;backlog_remaining&lt;/code&gt; is true when the run hit its cap or its time budget, which tells you more old logs are still waiting. If any delete failed, the job exits non-zero, so the problem shows up in Cloud Run and doesn’t stay hidden in the logs.&lt;/p&gt;
&lt;p&gt;The same summary goes to Slack: live or dry run, files found, files deleted, failures, space freed, and whether a backlog remains. Like the scanner, it publishes to a shared Pub/Sub topic in a monitoring project that a Slack-routing service already listens to, so there are no webhooks or Slack credentials in the job. The runtime project sits inside a VPC Service Controls perimeter, so the job’s service account also had to be added to the perimeter’s Pub/Sub egress rule, next to the scanner’s.&lt;/p&gt;
&lt;h2 id=&quot;design-decisions&quot;&gt;Design decisions&lt;/h2&gt;
&lt;h3 id=&quot;dry-run-by-default&quot;&gt;Dry run by default&lt;/h3&gt;
&lt;p&gt;Deleting data is a different level of risk from re-scanning it, so &lt;code&gt;DRY_RUN&lt;/code&gt; defaults to true, and the tool runs that way first. In dry-run mode it does the search and reports everything it &lt;em&gt;would&lt;/em&gt; delete, printing the first 10 paths and counting the rest, without deleting anything. Once the dry-run numbers had been reviewed, switching to live deletes was a one-line change, and it’s now running live.&lt;/p&gt;
&lt;h3 id=&quot;oldest-first-capped-and-stateless&quot;&gt;Oldest first, capped, and stateless&lt;/h3&gt;
&lt;p&gt;Capping each run and sorting oldest first makes the backlog work itself down without any bookkeeping. A big first run can’t run away, a failed run loses nothing, and the next run carries on. No state is kept anywhere.&lt;/p&gt;
&lt;h3 id=&quot;configuration-lives-with-the-code&quot;&gt;Configuration lives with the code&lt;/h3&gt;
&lt;p&gt;This is where it differs from the scanner. The scanner’s settings live in Terraform, because they change on their own: adding a repository to scan doesn’t need new code. The purge tool’s settings don’t change on their own like that, so they’re &lt;code&gt;ENV&lt;/code&gt; lines in the Dockerfile:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;dockerfile&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;ENV&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; JFROG_LOG_REPO=jfrog-logs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;ENV&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; DRY_RUN=false&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;ENV&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; RETENTION_DAYS=365&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;ENV&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; MAX_ITEMS_PER_RUN=10000&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#F97583&quot;&gt;ENV&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; RUN_BUDGET_SECONDS=1500&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I learned the hard way that splitting them was a problem. When code and config were in different repos, adding a setting meant one PR to Terraform, applied first, then a second PR to the code, in that order. Get the order wrong and the new code failed to start because its setting wasn’t there yet. With both in the Dockerfile, one PR changes both, and they always ship together.&lt;/p&gt;
&lt;p&gt;The only setting Terraform still puts on the job is a reference to the token’s secret.&lt;/p&gt;
&lt;h3 id=&quot;secrets-fetched-at-runtime&quot;&gt;Secrets fetched at runtime&lt;/h3&gt;
&lt;p&gt;The JFrog admin token lives in Secret Manager. Cloud Run injects it into the job as an environment variable when it starts. Terraform only names the secret, so the token’s value is never in the image, the Dockerfile or Terraform. It’s the same token the scanner uses, so there’s one token to rotate on its 90-day cycle, not two.&lt;/p&gt;
&lt;h2 id=&quot;getting-to-boring&quot;&gt;Getting to boring&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-log-purge-journey.svg&quot; alt=&quot;Three deployment designs for the log purge tool&quot;&gt;&lt;/p&gt;
&lt;p&gt;The purge logic was the easy part. Deciding how to deploy a script this small took three attempts.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1. A Cloud Function.&lt;/strong&gt; It’s one Python function run on a schedule, so a gen2 Cloud Function seemed natural. But the code and the infrastructure live in different repos, so Terraform couldn’t zip the source itself. That meant CI building a zip into a bucket, a third infrastructure repo for the build trigger and bucket, and Terraform redeploying from the latest zip. That was a lot of moving parts for one script.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2. A Cloud Run service built with buildpacks.&lt;/strong&gt; Next I tried for the fewest pieces: two repos, no Dockerfile. Google’s buildpacks can turn a folder with &lt;code&gt;requirements.txt&lt;/code&gt; and a &lt;code&gt;Procfile&lt;/code&gt; straight into an image, and &lt;code&gt;gcloud run deploy --source&lt;/code&gt; does the whole build and deploy. Terraform owned the service’s config and ignored its image, and &lt;code&gt;gcloud&lt;/code&gt; owned the image. It worked, but it had catches:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Terraform created the service with Google’s placeholder &lt;code&gt;hello&lt;/code&gt; image. My first scheduled “run” returned HTTP 200 and did nothing, because I hadn’t yet deployed any code. The logs said &lt;em&gt;Hello from Cloud Run!&lt;/em&gt;, which was a nice greeting but not what I was after.&lt;/li&gt;
&lt;li&gt;A service needs an HTTP entry point, so a batch job had to pretend to be a web server.&lt;/li&gt;
&lt;li&gt;Automating the deploy was where it really fell apart. A Cloud Build trigger in the CI project running &lt;code&gt;gcloud run deploy --source&lt;/code&gt; against the runtime project actually starts a &lt;em&gt;second&lt;/em&gt; build in the runtime project. That’s two builds in two projects, each running as a different service account, and the cross-project IAM to make it work took a diagram just to explain.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;3. A Cloud Run Job, built like the scanner.&lt;/strong&gt; In the end I stepped back. The scanner already solves this exact shape of problem: a Dockerfile, a Cloud Build trigger in the CI project, a registry the runtime project pulls from, and a Cloud Run Job started by Cloud Scheduler. Its PRs had been reviewed, its cross-project IAM was already in place, and the rest of the team already understood it. Following the same pattern meant most of the infrastructure was a copy with the names changed.&lt;/p&gt;
&lt;p&gt;Option 2 was the most technically interesting, and option 3 is the one I’d want to be on call for.&lt;/p&gt;
&lt;h2 id=&quot;what-i-learned&quot;&gt;What I learned&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Consistency beats cleverness for small tools.&lt;/strong&gt; Matching an existing, understood pattern was worth more than saving a Dockerfile or a repo. Reviewers, and future me, only need to learn one shape.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Count the IAM, not the repos.&lt;/strong&gt; “Fewer repos” sounded simpler, but where the build runs and which identity deploys the code mattered far more. Two builds in two projects isn’t simpler, even if it’s fewer files.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Keep config that changes with the code next to the code.&lt;/strong&gt; If a setting can only change alongside a code change, splitting the two across repos just creates an ordering problem.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Know what’s actually running.&lt;/strong&gt; A placeholder image that returns 200 looks just like a healthy service from the scheduler’s side. Check the image, not just the status code.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Design deletes to be repeated.&lt;/strong&gt; Oldest first, capped, stateless, &lt;code&gt;404&lt;/code&gt; counts as done: every run can safely be re-run, which is what you want from anything that deletes data.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;whats-next&quot;&gt;What’s next&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Bring the scanner in line.&lt;/strong&gt; The scanner still keeps its settings in Terraform. Moving them into its Dockerfile, as here, would mean both tools are configured the same way, and support only has one place to look.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Make sure new builds are picked up.&lt;/strong&gt; Cloud Run may pin a job to a specific image digest when the job is created or updated. I want to confirm a newly pushed &lt;code&gt;:latest&lt;/code&gt; actually reaches the job, and if it doesn’t, add a step to the build that updates the job.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now that it’s live, the &lt;code&gt;jfrog-logs&lt;/code&gt; repository stops growing beyond a year’s worth of logs, with no further effort from anyone, and a Slack message every Monday shows it’s still doing its job.&lt;/p&gt;</content:encoded><category>gcp</category><category>cloud-run</category><category>jfrog</category><category>python</category><category>automation</category><category>platform-engineering</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/projects/2026/project-heroimage-jfrog-log-purge-tool.jpg" length="0" type="image/jpeg"/></item><item><title>SUB/WAVE</title><link>https://elliotx.com/projects/2026/setting-up-subwave</link><guid isPermaLink="true">https://elliotx.com/projects/2026/setting-up-subwave</guid><description>Setting up SUB/WAVE, a self-hosted AI radio station, on top of my Navidrome library</description><pubDate>Fri, 09 Oct 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-heroimage-setting-up-subwave.jpg&quot; alt=&quot;SUB/WAVE&quot; /&gt;
&lt;p&gt;In my &lt;a href=&quot;https://elliotx.com/notes/2026/and-the-winner-is/&quot;&gt;Roon vs. the rest&lt;/a&gt; roundup I said I’d keep Navidrome running for one reason: &lt;a href=&quot;https://www.getsubwave.com/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;SUB/WAVE&lt;/a&gt;. I didn’t want to get side-tracked in that note, so this is the side-track.&lt;/p&gt;
&lt;p&gt;SUB/WAVE is a self-hosted internet radio station with an AI DJ. It sits on top of Navidrome, picks tracks from my own library, talks between them in a synthesised voice, and broadcasts one stream that everyone tunes in to. There’s no skip button and no queue to fiddle with. No need to spend time figuring out what you want to listen to. You just tune in.&lt;/p&gt;
&lt;p&gt;That last part is the bit that won me over. Roon’s radio has never really worked for me. I can’t point it at my whole 25,000+ track catalogue and say “play me something”. SUB/WAVE does exactly that and adds a presenter, which is something I didn’t know I wanted.&lt;/p&gt;
&lt;h2 id=&quot;how-it-works&quot;&gt;How it works&lt;/h2&gt;
&lt;p&gt;Under the hood there are a handful of moving parts, all running in Docker on a single machine:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Navidrome&lt;/strong&gt; is the music source. SUB/WAVE talks to it over the Subsonic API, so it reads the same tags and artwork that Psysonic does.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The controller&lt;/strong&gt; is a Node.js service, the brains of the station. It decides what plays next, asks the language model for track picks and DJ links, and manages the queue.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A language model&lt;/strong&gt; writes the DJ’s words and chooses the music. The default is a local model through Ollama, but it can also use a hosted provider.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Text-to-speech&lt;/strong&gt; turns the script into a voice.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Liquidsoap and Icecast&lt;/strong&gt; (bundled together in a &lt;code&gt;broadcast&lt;/code&gt; container) mix the music and voice with crossfades and ducking, then serve the stream.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A Next.js web UI&lt;/strong&gt; gives you the player, the admin console and a landing page, fronted by a bundled Caddy reverse proxy.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The components hand work to each other through shared files rather than a message queue.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-subwave-on-air-flow.svg&quot; alt=&quot;image&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;my-choices&quot;&gt;My choices&lt;/h2&gt;
&lt;h3 id=&quot;llm-claude-for-a-week&quot;&gt;LLM: Claude, for a week&lt;/h3&gt;
&lt;p&gt;The homelab default is Ollama with a tool-capable model. To see SUB/WAVE at its best before committing to anything, I started with a hosted model instead and pointed it at Claude Haiku 4.5 through Anthropic’s API.&lt;/p&gt;
&lt;p&gt;It worked really well, and hearing a DJ talk about my own music was genuinely fun. It isn’t free, though. I put $5 of credit on the account and it lasted about a week of testing. That’s cheap for an experiment, but it’s a running cost I didn’t want to fund for a radio station only I (and a few family members) listen to.&lt;/p&gt;
&lt;p&gt;So I let the credit run out. Without an LLM, SUB/WAVE doesn’t fall over. It drops back to an auto-playlist built from the library, so the music keeps playing, but the DJ goes quiet and stops making picks. The &lt;strong&gt;Stats&lt;/strong&gt; page makes that very clear: a column of failed LLM calls where the picks used to be.&lt;/p&gt;
&lt;p&gt;The next step for this project is to run a local LLM for SUB/WAVE on my own hardware, which brings the running cost back to zero. I’ll write that up as a follow-on.&lt;/p&gt;
&lt;h3 id=&quot;voice-piper&quot;&gt;Voice: Piper&lt;/h3&gt;
&lt;p&gt;For the voice I kept things local from the start with &lt;a href=&quot;https://github.com/rhasspy/piper&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Piper&lt;/a&gt;, the lightest of SUB/WAVE’s built-in engines. It runs comfortably on CPU inside the controller container and costs nothing per word. On the Stats page, a spoken segment takes about 1.5 seconds to render. Kokoro is the step up in quality while staying local, and ElevenLabs is there if you want a cloned voice, but Piper does the job.&lt;/p&gt;
&lt;p&gt;So the split was: Claude wrote the script and Piper read it out on my own hardware.&lt;/p&gt;
&lt;h2 id=&quot;installation&quot;&gt;Installation&lt;/h2&gt;
&lt;p&gt;SUB/WAVE runs on my homelab server, an HP EliteDesk Mini G3 running Proxmox. It’s the same Docker host as my Navidrome stack (the Tailscale + Navidrome + cloudflared compose I described in the &lt;a href=&quot;https://elliotx.com/projects/2026/psysonic-orbit/&quot;&gt;Psysonic Orbit&lt;/a&gt; project). The music itself lives on the Roon server and is mounted over SMB.&lt;/p&gt;
&lt;p&gt;The docs suggest about 2 GB of RAM for the core services, plus another 1 GB for the default track analyser. In practice it’s lighter than that. The admin Stats page shows all six containers using under 800 MB between them, with the broadcast container (the audio encoding) the busiest at around 14% CPU on a 4-core box.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/projects/2026/setting-up-subwave/system-resources-1423.webp&quot; alt=&quot;image&quot; srcset=&quot;/thumbs/images/projects/2026/setting-up-subwave/system-resources-480.webp 480w, /thumbs/images/projects/2026/setting-up-subwave/system-resources-960.webp 960w, /thumbs/images/projects/2026/setting-up-subwave/system-resources-1423.webp 1423w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1423&quot; height=&quot;403&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; data-full=&quot;/images/projects/2026/setting-up-subwave/system-resources.png&quot;&gt;&lt;/p&gt;
&lt;p&gt;The CLI makes setup painless:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;shell&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;curl&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -fsSL&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; https://cli.getsubwave.com&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt; |&lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt; sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;subwave&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; setup&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The installer drops the binary in place, then &lt;code&gt;subwave setup&lt;/code&gt; walks through:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Install directory&lt;/strong&gt;: the default &lt;code&gt;~/subwave&lt;/code&gt; is fine.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Deployment mode&lt;/strong&gt;: &lt;code&gt;prod&lt;/code&gt; uses the bundled Caddy; &lt;code&gt;prod-byo&lt;/code&gt; is for bringing your own reverse proxy.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Admin credentials&lt;/strong&gt;: these are for the admin console.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Navidrome&lt;/strong&gt;: the URL, username and password. I’m using my admin account for now, but a dedicated Navidrome user for the station would be tidier.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LLM provider&lt;/strong&gt;: Anthropic, plus the API key.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;TTS engine&lt;/strong&gt;: Piper.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I chose &lt;code&gt;prod&lt;/code&gt;, so the bundled Caddy is the station’s front door.&lt;/p&gt;
&lt;p&gt;Surprisingly little ends up in &lt;code&gt;~/subwave/.env&lt;/code&gt;. Only three values are required to boot the stack:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;shell&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;ADMIN_USER&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;ADMIN_PASS&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;SITE_URL&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;https://subdomain.yourdomain.com&lt;/span&gt;&lt;span style=&quot;color:#6A737D&quot;&gt;  # public address, for absolute URLs and playlist files&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Everything else (Navidrome, the LLM, the voice, the first DJ persona) is collected by the setup wizard, either in the terminal or in the browser at &lt;code&gt;/onboarding&lt;/code&gt;. It’s saved to &lt;code&gt;state/settings.json&lt;/code&gt;, with API keys kept separately in &lt;code&gt;state/secrets.env&lt;/code&gt;. The &lt;code&gt;.env&lt;/code&gt; file has commented-out overrides for nearly everything, for anyone who prefers config-as-code to clicking through a UI.&lt;/p&gt;
&lt;p&gt;The CLI also pins the image version in &lt;code&gt;.env&lt;/code&gt; (&lt;code&gt;SUBWAVE_VERSION=1.13.0&lt;/code&gt; for me), and &lt;code&gt;subwave update&lt;/code&gt; moves the pin forward, so the stack never silently drifts onto &lt;code&gt;:latest&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;After that, &lt;code&gt;subwave status&lt;/code&gt; gives a snapshot of the stack, and &lt;code&gt;subwave logs&lt;/code&gt;, &lt;code&gt;restart&lt;/code&gt; and &lt;code&gt;update&lt;/code&gt; cover day-to-day running.&lt;/p&gt;
&lt;h3 id=&quot;what-the-stack-looks-like&quot;&gt;What the stack looks like&lt;/h3&gt;
&lt;p&gt;The production compose file brings up six containers, with one more (heavy TTS) left off by default:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;caddy&lt;/code&gt;&lt;/strong&gt;: the public edge, and the only service bound to a host port (&lt;code&gt;7700:80&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;broadcast&lt;/code&gt;&lt;/strong&gt;: Icecast and Liquidsoap together. If either dies, the container restarts the pair.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;controller&lt;/code&gt;&lt;/strong&gt;: the AI DJ. It reads &lt;code&gt;.env&lt;/code&gt; plus the wizard’s settings from the shared &lt;code&gt;state/&lt;/code&gt; folder. Piper runs here too, so I didn’t need the optional &lt;code&gt;tts-heavy&lt;/code&gt; sidecar for Chatterbox and PocketTTS.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;web&lt;/code&gt;&lt;/strong&gt;: the Next.js player and admin console.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;analyzer&lt;/code&gt;&lt;/strong&gt;: works out BPM, key, intros and loudness for each track so the DJ can mix sensibly. It’s on by default with a 6 GB memory cap.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;docker-socket-proxy&lt;/code&gt;&lt;/strong&gt;: a read-only window onto the Docker API, so the admin &lt;strong&gt;Stats&lt;/strong&gt; page can show per-container usage without the controller touching the raw Docker socket.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Startup is health-gated. Caddy waits for the controller and broadcast containers to report healthy, so you don’t get 502s while the stack is still booting.&lt;/p&gt;
&lt;h3 id=&quot;reaching-navidrome&quot;&gt;Reaching Navidrome&lt;/h3&gt;
&lt;p&gt;SUB/WAVE and Navidrome are separate compose projects, so the station can’t reach Navidrome by name. The SUB/WAVE compose maps &lt;code&gt;host.docker.internal&lt;/code&gt; to the Docker host, and my Tailscale container publishes port 4533 on the host, so the server URL in the station’s Music Source settings is simply &lt;code&gt;http://host.docker.internal:4533&lt;/code&gt;. The settings page warns against &lt;code&gt;127.0.0.1&lt;/code&gt;, which inside a container points at the container itself.&lt;/p&gt;
&lt;h2 id=&quot;making-it-public-with-the-cloudflare-tunnel&quot;&gt;Making it public with the Cloudflare Tunnel&lt;/h2&gt;
&lt;p&gt;I already had a Cloudflare Tunnel running for Psysonic, so exposing the station meant adding one more hostname rather than building anything new.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-subwave-architecture.svg&quot; alt=&quot;image&quot;&gt;&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;shell&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; run&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -it&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; --rm&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -v&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; ~/.cloudflared:/home/nonroot/.cloudflared&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;  cloudflare/cloudflared:latest&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; tunnel&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; route&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; dns&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; navidrome&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; subdomain.yourdomain.com&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The interesting part is how &lt;code&gt;cloudflared&lt;/code&gt; reaches the station. In my Navidrome stack, Navidrome rides on the Tailscale container’s network stack (the sidecar pattern from the Psysonic post). &lt;code&gt;cloudflared&lt;/code&gt; doesn’t. It sits on the Navidrome project’s default network and also joins SUB/WAVE’s network as an external one:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;yaml&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;cloudflared&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;  image&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;cloudflare/cloudflared:latest&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;  container_name&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;cloudflared&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;  restart&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;unless-stopped&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;  command&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;tunnel run&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;  volumes&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;    - &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;~/.cloudflared:/home/nonroot/.cloudflared&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;  networks&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;    - &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;default&lt;/span&gt;&lt;span style=&quot;color:#6A737D&quot;&gt; # reaches Navidrome via the tailscale container&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;    - &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;subwave&lt;/span&gt;&lt;span style=&quot;color:#6A737D&quot;&gt; # reaches SUB/WAVE&apos;s Caddy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;  depends_on&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;    - &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;navidrome&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;networks&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;  subwave&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;    external&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;true&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;    name&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;subwave_default&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Because &lt;code&gt;cloudflared&lt;/code&gt; sits on both networks, it can resolve containers by name in both projects. The ingress rules in &lt;code&gt;~/.cloudflared/config.yml&lt;/code&gt; stay simple, with one hostname per app above the catch-all 404:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;yaml&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;ingress&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;  - &lt;/span&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;hostname&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;orbit.yourdomain.com&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;    service&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;http://tailscale:4533&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;  - &lt;/span&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;hostname&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;subdomain.yourdomain.com&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;    service&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;http://sub-wave-caddy:80&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;  - &lt;/span&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;service&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;http_status:404&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note that the station is reached on Caddy’s &lt;em&gt;container&lt;/em&gt; port (80), not the host port 7700. Traffic from the tunnel never touches the host’s published ports. Port 7700 is only there for listening on the LAN.&lt;/p&gt;
&lt;p&gt;After restarting &lt;code&gt;cloudflared&lt;/code&gt;, Cloudflare terminates TLS, no inbound ports are opened on the router, and the station is reachable from anywhere.&lt;/p&gt;
&lt;h2 id=&quot;gotchas&quot;&gt;Gotchas&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Start SUB/WAVE before the Navidrome stack.&lt;/strong&gt; &lt;code&gt;subwave_default&lt;/code&gt; is declared &lt;code&gt;external&lt;/code&gt;, so Docker Compose won’t create it. If the Navidrome stack comes up first (after a reboot, say) and SUB/WAVE’s network doesn’t exist yet, &lt;code&gt;cloudflared&lt;/code&gt; fails to start. Bring SUB/WAVE up first, or create the network yourself with &lt;code&gt;docker network create subwave_default&lt;/code&gt; so the order doesn’t matter.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Bad gateway means a networking problem.&lt;/strong&gt; As with Psysonic, a Cloudflare “Bad gateway” with everything else green means &lt;code&gt;cloudflared&lt;/code&gt; can’t reach the app. Test from inside the container with &lt;code&gt;docker exec -it cloudflared wget -qO- http://sub-wave-caddy:80&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Keep the state directory on local disk.&lt;/strong&gt; SUB/WAVE keeps its library index in SQLite (&lt;code&gt;state/library.db&lt;/code&gt;, in WAL mode), and WAL needs proper POSIX file locking. An NFS or SMB share will corrupt it under load. My music is mounted read-only over SMB from the Roon server (&lt;code&gt;/mnt/roon-music&lt;/code&gt;), and that’s fine for Navidrome reading tracks. SUB/WAVE’s &lt;code&gt;state&lt;/code&gt; folder, like Navidrome’s own database, stays on local disk.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A public URL means a public station.&lt;/strong&gt; Anyone with the link can listen. Mine is open for now while I experiment, and a few family members are tuning in. Since the music is really for my own listening, it’ll go behind a login once I’ve finished experimenting, using the station password under Settings → Station → Privacy. Unlike Psysonic, there’s no Subsonic client in the way, so Cloudflare Access would work too.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Don’t trust Cloudflare’s IP header unless the tunnel is the only way in.&lt;/strong&gt; &lt;code&gt;TRUST_CF_CONNECTING_IP=1&lt;/code&gt; makes the controller key its rate limits (request cooldowns, the admin lockout, the password throttle) on Cloudflare’s &lt;code&gt;CF-Connecting-IP&lt;/code&gt; header. Port 7700 is still open on my LAN, though, and anyone who reaches it directly could spoof that header. So I’ve left it unset, and the bundled Caddy’s &lt;code&gt;X-Forwarded-For&lt;/code&gt; handling does the job.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Navidrome version.&lt;/strong&gt; Version 0.62 or later is recommended, for security fixes and the &lt;code&gt;sonicSimilarity&lt;/code&gt; support that SUB/WAVE uses to find tracks that sound alike.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;the-admin-console&quot;&gt;The admin console&lt;/h2&gt;
&lt;p&gt;First, the listener’s side. The player is deliberately radio-like. There’s a big “tap to tune in”, the now-playing card, and panels for the day’s schedule, a timeline of what’s played, and a request slip where you write to the DJ in plain language (“play me something for late-night driving…”).&lt;/p&gt;
&lt;div class=&quot;image-carousel not-prose&quot; data-image-carousel=&quot;&quot;&gt;&lt;div class=&quot;image-carousel-viewport&quot;&gt;&lt;div class=&quot;image-carousel-track&quot; data-image-carousel-track=&quot;&quot;&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;false&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/projects/2026/setting-up-subwave/1/1-tap-to-tune-in-1600.webp&quot; alt=&quot;tap to tune in&quot; loading=&quot;eager&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/projects/2026/setting-up-subwave/1/1-tap-to-tune-in-480.webp 480w, /thumbs/images/projects/2026/setting-up-subwave/1/1-tap-to-tune-in-960.webp 960w, /thumbs/images/projects/2026/setting-up-subwave/1/1-tap-to-tune-in-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1913&quot; height=&quot;979&quot; data-full=&quot;/images/projects/2026/setting-up-subwave/1/1-tap-to-tune-in.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/projects/2026/setting-up-subwave/1/2-now-playing-1600.webp&quot; alt=&quot;now playing&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/projects/2026/setting-up-subwave/1/2-now-playing-480.webp 480w, /thumbs/images/projects/2026/setting-up-subwave/1/2-now-playing-960.webp 960w, /thumbs/images/projects/2026/setting-up-subwave/1/2-now-playing-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1912&quot; height=&quot;972&quot; data-full=&quot;/images/projects/2026/setting-up-subwave/1/2-now-playing.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/projects/2026/setting-up-subwave/1/3-schedule-panel-1600.webp&quot; alt=&quot;schedule panel&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/projects/2026/setting-up-subwave/1/3-schedule-panel-480.webp 480w, /thumbs/images/projects/2026/setting-up-subwave/1/3-schedule-panel-960.webp 960w, /thumbs/images/projects/2026/setting-up-subwave/1/3-schedule-panel-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1909&quot; height=&quot;980&quot; data-full=&quot;/images/projects/2026/setting-up-subwave/1/3-schedule-panel.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/projects/2026/setting-up-subwave/1/4-timeline-of-played-tracks-1600.webp&quot; alt=&quot;timeline of played tracks&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/projects/2026/setting-up-subwave/1/4-timeline-of-played-tracks-480.webp 480w, /thumbs/images/projects/2026/setting-up-subwave/1/4-timeline-of-played-tracks-960.webp 960w, /thumbs/images/projects/2026/setting-up-subwave/1/4-timeline-of-played-tracks-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1908&quot; height=&quot;980&quot; data-full=&quot;/images/projects/2026/setting-up-subwave/1/4-timeline-of-played-tracks.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/projects/2026/setting-up-subwave/1/5-request-a-song-1600.webp&quot; alt=&quot;request a song&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/projects/2026/setting-up-subwave/1/5-request-a-song-480.webp 480w, /thumbs/images/projects/2026/setting-up-subwave/1/5-request-a-song-960.webp 960w, /thumbs/images/projects/2026/setting-up-subwave/1/5-request-a-song-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1910&quot; height=&quot;981&quot; data-full=&quot;/images/projects/2026/setting-up-subwave/1/5-request-a-song.png&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-nav image-carousel-prev&quot; data-image-carousel-prev=&quot;&quot; aria-label=&quot;Previous image&quot;&gt;‹&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-nav image-carousel-next&quot; data-image-carousel-next=&quot;&quot; aria-label=&quot;Next image&quot;&gt;›&lt;/button&gt;&lt;span class=&quot;image-carousel-counter&quot; data-image-carousel-counter=&quot;&quot;&gt;1 / 5&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-dots&quot; data-image-carousel-dots=&quot;&quot;&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 1 of 5&quot; aria-current=&quot;true&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 2 of 5&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 3 of 5&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 4 of 5&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 5 of 5&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Behind it is the admin console, and this is where the fun is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Personas&lt;/strong&gt;: the DJs. I have three: Wren (“Small details, quiet rooms, one good image”), Hale (“Says less, means more. Leaves space.”) and Marlowe (“Late-night company and well-chosen records”). Each has a short personality sketch, called its soul, that goes into every prompt. Sliders set how often they talk and how long their scripts run, and tone dials cover humour, local colour and warmth.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Schedule&lt;/strong&gt;: a weekly grid of shows. Mine runs from Sunrise Service and Madonna Mornings, the Pop Queen through The Pop Show, The Golden Era Cypher and Metal Monday, to Night Romance and The Country Show overnight. Each show has a theme and a persona, and the DJ leans into it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Moods and festivals&lt;/strong&gt;: the vocabulary the library is tagged with, plus a calendar of dates (Valentine’s Day, the summer solstice and so on) that the station’s music and tone drift towards as they come round.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Idle pause&lt;/strong&gt;: after five minutes with no listeners, the programme pauses, with no Navidrome pulls and no LLM or TTS calls, and picks up again within seconds of someone tuning in. It’s a nice touch when every DJ link is a paid API call.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Observatory&lt;/strong&gt;: a data-art map of the library, laid out by how each track sounds. Mine is still showing the built-in 400-track demo. The map only plots tracks that have been &lt;em&gt;tagged&lt;/em&gt; with moods, and tagging is a job for the LLM. With the API credit gone, none of my 20,000+ tracks have been tagged yet. That’s another reason to get a local model running.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;image-carousel not-prose&quot; data-image-carousel=&quot;&quot;&gt;&lt;div class=&quot;image-carousel-viewport&quot;&gt;&lt;div class=&quot;image-carousel-track&quot; data-image-carousel-track=&quot;&quot;&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;false&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/projects/2026/setting-up-subwave/2/1-admin-dash-1600.webp&quot; alt=&quot;admin dash&quot; loading=&quot;eager&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/projects/2026/setting-up-subwave/2/1-admin-dash-480.webp 480w, /thumbs/images/projects/2026/setting-up-subwave/2/1-admin-dash-960.webp 960w, /thumbs/images/projects/2026/setting-up-subwave/2/1-admin-dash-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1900&quot; height=&quot;794&quot; data-full=&quot;/images/projects/2026/setting-up-subwave/2/1-admin-dash.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/projects/2026/setting-up-subwave/2/2-weekly-schedule-1423.webp&quot; alt=&quot;weekly schedule&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/projects/2026/setting-up-subwave/2/2-weekly-schedule-480.webp 480w, /thumbs/images/projects/2026/setting-up-subwave/2/2-weekly-schedule-960.webp 960w, /thumbs/images/projects/2026/setting-up-subwave/2/2-weekly-schedule-1423.webp 1423w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1423&quot; height=&quot;673&quot; data-full=&quot;/images/projects/2026/setting-up-subwave/2/2-weekly-schedule.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/projects/2026/setting-up-subwave/2/3-persona-roster-1600.webp&quot; alt=&quot;persona roster&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/projects/2026/setting-up-subwave/2/3-persona-roster-480.webp 480w, /thumbs/images/projects/2026/setting-up-subwave/2/3-persona-roster-960.webp 960w, /thumbs/images/projects/2026/setting-up-subwave/2/3-persona-roster-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1892&quot; height=&quot;977&quot; data-full=&quot;/images/projects/2026/setting-up-subwave/2/3-persona-roster.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/projects/2026/setting-up-subwave/2/4-editing-a-persona-1595.webp&quot; alt=&quot;editing a persona&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/projects/2026/setting-up-subwave/2/4-editing-a-persona-480.webp 480w, /thumbs/images/projects/2026/setting-up-subwave/2/4-editing-a-persona-960.webp 960w, /thumbs/images/projects/2026/setting-up-subwave/2/4-editing-a-persona-1595.webp 1595w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1595&quot; height=&quot;923&quot; data-full=&quot;/images/projects/2026/setting-up-subwave/2/4-editing-a-persona.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/projects/2026/setting-up-subwave/2/5-festival-calendar-953.webp&quot; alt=&quot;festival calendar&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/projects/2026/setting-up-subwave/2/5-festival-calendar-480.webp 480w, /thumbs/images/projects/2026/setting-up-subwave/2/5-festival-calendar-953.webp 953w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;953&quot; height=&quot;688&quot; data-full=&quot;/images/projects/2026/setting-up-subwave/2/5-festival-calendar.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/projects/2026/setting-up-subwave/2/6-editing-a-festival-1475.webp&quot; alt=&quot;editing a festival&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/projects/2026/setting-up-subwave/2/6-editing-a-festival-480.webp 480w, /thumbs/images/projects/2026/setting-up-subwave/2/6-editing-a-festival-960.webp 960w, /thumbs/images/projects/2026/setting-up-subwave/2/6-editing-a-festival-1475.webp 1475w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1475&quot; height=&quot;727&quot; data-full=&quot;/images/projects/2026/setting-up-subwave/2/6-editing-a-festival.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/projects/2026/setting-up-subwave/2/7-idle-pause-and-crossfade-1529.webp&quot; alt=&quot;idle pause and crossfade&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/projects/2026/setting-up-subwave/2/7-idle-pause-and-crossfade-480.webp 480w, /thumbs/images/projects/2026/setting-up-subwave/2/7-idle-pause-and-crossfade-960.webp 960w, /thumbs/images/projects/2026/setting-up-subwave/2/7-idle-pause-and-crossfade-1529.webp 1529w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1529&quot; height=&quot;934&quot; data-full=&quot;/images/projects/2026/setting-up-subwave/2/7-idle-pause-and-crossfade.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/projects/2026/setting-up-subwave/2/8-library-observatory-1600.webp&quot; alt=&quot;library observatory&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/projects/2026/setting-up-subwave/2/8-library-observatory-480.webp 480w, /thumbs/images/projects/2026/setting-up-subwave/2/8-library-observatory-960.webp 960w, /thumbs/images/projects/2026/setting-up-subwave/2/8-library-observatory-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1911&quot; height=&quot;960&quot; data-full=&quot;/images/projects/2026/setting-up-subwave/2/8-library-observatory.png&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-nav image-carousel-prev&quot; data-image-carousel-prev=&quot;&quot; aria-label=&quot;Previous image&quot;&gt;‹&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-nav image-carousel-next&quot; data-image-carousel-next=&quot;&quot; aria-label=&quot;Next image&quot;&gt;›&lt;/button&gt;&lt;span class=&quot;image-carousel-counter&quot; data-image-carousel-counter=&quot;&quot;&gt;1 / 8&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-dots&quot; data-image-carousel-dots=&quot;&quot;&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 1 of 8&quot; aria-current=&quot;true&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 2 of 8&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 3 of 8&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 4 of 8&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 5 of 8&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 6 of 8&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 7 of 8&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 8 of 8&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h2 id=&quot;result&quot;&gt;Result&lt;/h2&gt;
&lt;p&gt;For a week I had my own radio station playing my own music, with a presenter who actually talked about it. The software is free and MIT-licensed, with no subscription. The only running cost was the Claude API usage, roughly $5 a week. But your mileage may vary depending on how many music requests you make or how chatty you want the DJs. Worth a try though to see what the station can do, but not something I want to pay for indefinitely. Right now it’s a very good auto-playlist with the DJ off air. Getting the DJ back on air with a local LLM is my next task, though this will depend on what hardware I want to leave running. Is an RTX4060 Ti/16GB based machine overkill for a radio station? It’ll keep the room warm no doubt.&lt;/p&gt;
&lt;p&gt;Roon is still my daily driver though for deliberate listening whether I’m lounging in the living room or having a headphone session in the bedroom with my feet up. When I just want music on in the background, without making a single decision, SUB/WAVE is what I want to reach for. In the first week I had it running with Claude it made my own library feel new again and surfaced music in a way that Roon simply couldn’t do.&lt;/p&gt;
&lt;p&gt;SUB/WAVE is here to stay.&lt;/p&gt;</content:encoded><category>claude</category><category>cloudflare</category><category>music</category><category>navidrome</category><category>self-hosted</category><category>subwave</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/projects/2026/project-heroimage-setting-up-subwave.jpg" length="0" type="image/jpeg"/></item><item><title>JFrog Artifact Scanner</title><link>https://elliotx.com/projects/2026/jfrog-artifact-scanner</link><guid isPermaLink="true">https://elliotx.com/projects/2026/jfrog-artifact-scanner</guid><description>A scheduled Cloud Run Job that finds stale Xray scans in JFrog Artifactory and re-scans them before anyone notices.</description><pubDate>Tue, 06 Oct 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-heroimage-jfrog-artifact-scanner.jpg&quot; alt=&quot;Architecture diagram of a scheduled Cloud Run Job scanning JFrog Artifactory for stale artifacts&quot; /&gt;
&lt;p&gt;This is a work project so unfortunately I can’t share the source code, but what I can share is the problem, the design and what I learned building it. From this you could likely build it yourself.&lt;/p&gt;
&lt;h2 id=&quot;the-problem&quot;&gt;The problem&lt;/h2&gt;
&lt;p&gt;All the packages (artifacts) our users install (Python from PyPI, R from CRAN and so on) come through JFrog Artifactory remote repositories. Every artifact that lands in those caches gets scanned by &lt;strong&gt;JFrog Xray&lt;/strong&gt;, which checks it for vulnerabilities and licence issues before anyone is allowed to download it.&lt;/p&gt;
&lt;p&gt;The catch is that an Xray scan doesn’t last forever. Each scan has a &lt;strong&gt;90-day retention period&lt;/strong&gt;. Once that passes, the artifact’s scan status goes stale, and if a user tries to install that package on their workbench or laptop, it’s blocked.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-artifact-scanner-lifecycle.svg&quot; alt=&quot;Lifecycle of a cached artifact before and after the scanner&quot;&gt;&lt;/p&gt;
&lt;p&gt;From the user’s side, an install that worked last month suddenly fails, and the error doesn’t make it obvious why. They raise a support ticket, it gets routed to the platform services team, and someone manually triggers a re-scan.&lt;/p&gt;
&lt;p&gt;Even then it often isn’t fixed. Package installs pull in dependencies, and any of those can be stale as well. So you re-scan one artifact, the user tries again, it fails on the next dependency, and you go round again. When several scan problems stack up, the error messages are even harder to read.&lt;/p&gt;
&lt;p&gt;JFrog doesn’t have a built-in way to re-scan stale artifacts automatically. It does however have APIs, so I built one.&lt;/p&gt;
&lt;h2 id=&quot;the-idea&quot;&gt;The idea&lt;/h2&gt;
&lt;p&gt;Rather than waiting for a user to hit a stale artifact, go and find them first:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;List every artifact in the repositories we care about&lt;/li&gt;
&lt;li&gt;Ask Xray for the scan status of each one&lt;/li&gt;
&lt;li&gt;Trigger a re-scan for anything stale&lt;/li&gt;
&lt;li&gt;Tell the team what happened&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Run that every night and the 90-day cliff stops being a problem anyone sees.&lt;/p&gt;
&lt;h2 id=&quot;architecture&quot;&gt;Architecture&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-artifact-scanner-architecture.svg&quot; alt=&quot;Artifact scanner cloud architecture&quot;&gt;&lt;/p&gt;
&lt;p&gt;The scanner is a containerised Python app that runs as a &lt;strong&gt;Cloud Run Job&lt;/strong&gt;, not a service or function. That fits the work well. It’s a batch job with a clear start and end, it can take a while on large repositories, and it doesn’t need to listen for requests. Cloud Run Jobs give you serverless execution, retries and a full execution history without having to keep anything running.&lt;/p&gt;
&lt;p&gt;It spans two GCP projects:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ci-project&lt;/strong&gt; holds the build side. Cloud Build builds the image when changes merge to main, and Artifact Registry stores it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;scanner-project&lt;/strong&gt; holds the runtime side: Cloud Scheduler, the Cloud Run Job and Secret Manager.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The job pulls its image from the CI project’s registry across the project boundary, so the runtime service account needs an explicit IAM binding on that registry. The runtime project also sits inside a &lt;strong&gt;VPC Service Controls perimeter&lt;/strong&gt;, so the perimeter config, which lives in a separate org-level Terraform repo, needed updating too.&lt;/p&gt;
&lt;p&gt;All the GCP resources (scheduler, job, secrets, IAM, registry, build trigger) are defined in Terraform across a couple of infrastructure repos. The app repo only holds the application code, the Dockerfile and the Cloud Build config.&lt;/p&gt;
&lt;h2 id=&quot;how-a-run-works&quot;&gt;How a run works&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-artifact-scanner-run-flow.svg&quot; alt=&quot;Artifact scanner run flow&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;1-fail-fast&quot;&gt;1. Fail fast&lt;/h3&gt;
&lt;p&gt;Before doing any real work, the job checks that its configuration is all present: the JFrog URL, the API token and a valid list of repositories. It then pings Artifactory and runs a tiny test query to confirm the token actually has search permissions.&lt;/p&gt;
&lt;p&gt;If anything is wrong, the job exits non-zero and Cloud Run marks the execution as failed. A misconfigured job that fails loudly in seconds is much better than one that runs through every repository and quietly reports “0 stale artifacts”.&lt;/p&gt;
&lt;h3 id=&quot;2-enumerate-the-repository&quot;&gt;2. Enumerate the repository&lt;/h3&gt;
&lt;p&gt;For each configured repository, the job lists every file using &lt;strong&gt;AQL (Artifactory Query Language)&lt;/strong&gt;, JFrog’s query language for searching artifacts. One query returns the repo, path and name of each file, which is all the next step needs.&lt;/p&gt;
&lt;h3 id=&quot;3-check-every-artifacts-scan-status&quot;&gt;3. Check every artifact’s scan status&lt;/h3&gt;
&lt;p&gt;This is the heavy part. Each artifact gets its own call to Xray’s artifact status endpoint, which returns an overall scan status. An artifact counts as stale if that status is any of:&lt;/p&gt;

























&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Status&lt;/th&gt;&lt;th&gt;Meaning&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;NOT_SCANNED&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Xray has never scanned it&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;UNKNOWN&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Xray returned no usable status&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;STALE&lt;/code&gt;&lt;/td&gt;&lt;td&gt;The scan exists but has aged out&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXPIRED&lt;/code&gt;&lt;/td&gt;&lt;td&gt;The scan is past its retention period&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;With thousands of artifacts per repository, doing this one call at a time would be painfully slow. So the checks run in a &lt;strong&gt;thread pool of 10 workers&lt;/strong&gt;, sharing one HTTP session with a pooled connection adapter. That session also has a &lt;strong&gt;retry policy with exponential backoff&lt;/strong&gt; for &lt;code&gt;429&lt;/code&gt; and &lt;code&gt;5xx&lt;/code&gt; responses, so a short rate limit or blip on the JFrog side doesn’t fail the whole run.&lt;/p&gt;
&lt;p&gt;Every 100 artifacts, the job logs progress: how many it has checked, how fast it’s going and an ETA. That makes long runs easy to follow in Cloud Logging.&lt;/p&gt;
&lt;h3 id=&quot;4-re-scan-whats-stale&quot;&gt;4. Re-scan what’s stale&lt;/h3&gt;
&lt;p&gt;Once every repository has been checked, each stale artifact gets a re-index request through the Xray index API, also run in parallel.&lt;/p&gt;
&lt;h3 id=&quot;5-report&quot;&gt;5. Report&lt;/h3&gt;
&lt;p&gt;At the end of every run, the job:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;writes a &lt;strong&gt;structured JSON audit summary&lt;/strong&gt; to Cloud Logging, with per-repo counts plus breakdowns by status and HTTP response code&lt;/li&gt;
&lt;li&gt;publishes a &lt;strong&gt;Slack summary&lt;/strong&gt; by sending a message to a shared Pub/Sub topic that an existing Slack-routing service already listens to&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The Slack message is deliberately short: whether it was a live run or a dry run, how many artifacts were checked, how many were stale, how many re-scans were requested, and a line for each repository. If nothing was stale, it says so with a ✅ and the team can carry on.&lt;/p&gt;
&lt;p&gt;Reusing the shared Pub/Sub → Slack route meant no webhook URLs to manage and no Slack credentials in the job. It’s just one more publisher on a topic that already exists.&lt;/p&gt;
&lt;h2 id=&quot;design-decisions&quot;&gt;Design decisions&lt;/h2&gt;
&lt;h3 id=&quot;dry-run-by-default&quot;&gt;Dry run by default&lt;/h3&gt;
&lt;p&gt;The job reads a &lt;code&gt;DRY_RUN&lt;/code&gt; flag, and if it isn’t set, it &lt;strong&gt;defaults to dry run&lt;/strong&gt;. In dry-run mode it does the full analysis but only logs what it &lt;em&gt;would&lt;/em&gt; re-scan. It prints the first 10 and counts the rest, so the logs don’t fill up with thousands of near-identical lines.&lt;/p&gt;
&lt;p&gt;That made it safe to deploy and run against real repositories, check the numbers looked sensible, and only then switch it to live by changing a single Terraform variable.&lt;/p&gt;
&lt;h3 id=&quot;repositories-are-configuration-not-code&quot;&gt;Repositories are configuration, not code&lt;/h3&gt;
&lt;p&gt;The list of repositories to scan is passed into the job as a JSON environment variable, managed in Terraform:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;hcl&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;default&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;  { name &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; &quot;CRAN&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;, repo &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; &quot;cran-prod-cache&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;, pattern &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; &quot;cran&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; },&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;  { name &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; &quot;PYPI&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;, repo &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; &quot;pypi-prod-cache&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;, pattern &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; &quot;pypi&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; },&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;  { name &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; &quot;CRAN-REMOTE&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;, repo &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; &quot;cran-remote-cache&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;, pattern &lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; &quot;cran-remote&quot;&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt; },&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Adding a new repository is a one-line Terraform change. No code change, no new image build.&lt;/p&gt;
&lt;h3 id=&quot;secrets-fetched-at-runtime&quot;&gt;Secrets fetched at runtime&lt;/h3&gt;
&lt;p&gt;The JFrog admin token lives in Secret Manager and is mounted into the job when it runs. It’s never baked into the image or committed to Terraform. The token has a 90-day lifetime, a nice echo of the problem the job exists to solve, so it has to be rotated on that cycle.&lt;/p&gt;
&lt;h3 id=&quot;a-small-boring-container&quot;&gt;A small, boring container&lt;/h3&gt;
&lt;p&gt;The image is based on &lt;code&gt;python:3.11-slim&lt;/code&gt;, runs as a non-root user, and only depends on &lt;code&gt;requests&lt;/code&gt; and the Pub/Sub client library. Cloud Build tags every image with both the commit SHA and &lt;code&gt;latest&lt;/code&gt;. An Artifact Registry cleanup policy keeps only the five most recent images, so the registry doesn’t grow forever.&lt;/p&gt;
&lt;p&gt;The functions repo holds several apps, so the Cloud Build trigger is path-filtered. Changes to other apps don’t rebuild the scanner.&lt;/p&gt;
&lt;h3 id=&quot;scheduling&quot;&gt;Scheduling&lt;/h3&gt;
&lt;p&gt;Cloud Scheduler triggers the job at &lt;strong&gt;midnight on weekdays&lt;/strong&gt; (&lt;code&gt;0 0 * * 1-5&lt;/code&gt;). Running overnight means the re-scans have finished long before anyone starts installing packages in the morning.&lt;/p&gt;
&lt;h2 id=&quot;what-i-learned&quot;&gt;What I learned&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pick the right Cloud Run primitive.&lt;/strong&gt; A batch job that runs to completion and then exits is exactly what Cloud Run Jobs are for.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The platform plumbing matters as much as the code.&lt;/strong&gt; The scanning logic is fairly small. Getting the cross-project image pull, secret access and VPC Service Controls perimeter right, across several Terraform repos, is a big part of the work.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Fail fast, then fail soft.&lt;/strong&gt; Hard failures for config and auth problems, but retries and per-artifact error handling once the scan is underway. One bad response shouldn’t throw away a whole run.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Make the safe path the default.&lt;/strong&gt; Defaulting to dry run cost nothing and made the first deployments low-risk.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tell people what happened.&lt;/strong&gt; A short Slack summary every morning means the team can see the job is working without digging through logs.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;whats-next&quot;&gt;What’s next&lt;/h2&gt;
&lt;p&gt;A few things I’d like to improve:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pagination for very large repositories.&lt;/strong&gt; The AQL query currently has an upper limit, so a big enough cache would need paged queries to make sure nothing gets missed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Automating the token rotation&lt;/strong&gt;, so the 90-day cycle isn’t something a person has to remember.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Metrics, not just logs.&lt;/strong&gt; Pushing the stale count to Cloud Monitoring would let us chart it over time and alert if it suddenly jumps.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So far I’ve not seen any tickets raised concerning issues installing packages. The daily Slack report has shown the scans and stale artifacts found then re-scans requested. Result!&lt;/p&gt;</content:encoded><category>gcp</category><category>cloud-run</category><category>jfrog</category><category>python</category><category>automation</category><category>platform-engineering</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/projects/2026/project-heroimage-jfrog-artifact-scanner.jpg" length="0" type="image/jpeg"/></item><item><title>Building a workbench pipeline</title><link>https://elliotx.com/notes/2026/workbench-pipeline-project</link><guid isPermaLink="true">https://elliotx.com/notes/2026/workbench-pipeline-project</guid><description>This is driven by a need to wrest back some control from Google</description><pubDate>Thu, 17 Sep 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/notes/2026/note-heroimage-workbench-pipeline-project.jpg&quot; alt=&quot;Building a workbench pipeline&quot; /&gt;
&lt;p&gt;I think I’ve found my next project. I’m going to build a new workbench ingest pipeline.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://cloud.google.com/products/gemini-enterprise-agent-platform/notebooks&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Google workbenches&lt;/a&gt; (formerly Vertex AI) can be provisioned for users via a standard Google workflow and can be pinned to a specific image.&lt;/p&gt;
&lt;p&gt;However Google’s upgrade/rollback workflow doesn’t allow for pinned images and always fetches the latest build directly from Google’s release channel.&lt;/p&gt;
&lt;p&gt;Why is this a problem? Surely the point of upgrade is to “upgrade” an existing workbench to use the latest image.&lt;/p&gt;
&lt;p&gt;The problem typically applies to an organisation which uses change control processes. The org upgrade cycle typically follows a different cadence and can fall quickly out of sync if/when Google decides to release new images in quick succession. Not to mention all the paperwork typically involved from the org side of things.&lt;/p&gt;
&lt;p&gt;Organisations will more than likely need to test new images before deploying and getting resources in place to test then rollout to production can take a little time. In that time Google could well release another image, invalidating all the testing an org might have done to prepare for its upgrades.&lt;/p&gt;
&lt;p&gt;And so the cycle starts over.&lt;/p&gt;
&lt;p&gt;Testing is important, you don’t want to roll out something with breaking changes unless it’s been tested and measures put in place to fix anything unexpected. The platform and tooling needs to work 100% as intended.&lt;/p&gt;
&lt;p&gt;Google, like many vendors, is ramping up new image builds, patching them, and generally moving faster than organisations can keep up. Considering that fast-moving tech has always been a moving target, how do your take back control?&lt;/p&gt;
&lt;p&gt;You can build your own release channel which mirrors Google’s.&lt;/p&gt;
&lt;p&gt;Workflows can be configured to use your new channel and so long as you maintain regular upgrades staying close to Google’s latest release you’ll also maintain product support. Aim for n-0 and remain evergreen.&lt;/p&gt;
&lt;p&gt;You take back control and deploy workbench upgrades in a controlled way that satisfies your requirements. This in turn means you can go back to monthly releases rather than reacting to Google releasing a new workbench image into the channel.&lt;/p&gt;
&lt;p&gt;Once new images are pulled into your repo (release channel), make sure to tag the images so you can effectively “move” the image through environments, from test and uat to prod. This gated approval process using tags is beneficial for this kind of process.&lt;/p&gt;
&lt;p&gt;This is a first pass at the cloud architecture:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/notes/2026/note-heroimage-workbench-pipeline-project-architecture-1408.webp&quot; alt=&quot;image&quot; srcset=&quot;/thumbs/images/notes/2026/note-heroimage-workbench-pipeline-project-architecture-480.webp 480w, /thumbs/images/notes/2026/note-heroimage-workbench-pipeline-project-architecture-960.webp 960w, /thumbs/images/notes/2026/note-heroimage-workbench-pipeline-project-architecture-1408.webp 1408w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1408&quot; height=&quot;768&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; data-full=&quot;/images/notes/2026/note-heroimage-workbench-pipeline-project-architecture.jpg&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;extending-the-project&quot;&gt;Extending the project&lt;/h2&gt;
&lt;p&gt;As a bonus it might be good to automate testing on images that get pulled in, again, tag them when they pass.&lt;/p&gt;</content:encoded><category>workbench</category><category>gcp</category><category>workflows</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/notes/2026/note-heroimage-workbench-pipeline-project.jpg" length="0" type="image/jpeg"/></item><item><title>Psysonic Orbit</title><link>https://elliotx.com/projects/2026/psysonic-orbit</link><guid isPermaLink="true">https://elliotx.com/projects/2026/psysonic-orbit</guid><description>Setting Up Psysonic Orbit With a Self-Hosted Navidrome Library</description><pubDate>Fri, 11 Sep 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-heroimage-psysonic-orbit-setting-up.jpg&quot; alt=&quot;Psysonic Orbit&quot; /&gt;
&lt;p&gt;While I was evaluating Navidrome and apps that run with it, I came across &lt;a href=&quot;https://www.psysonic.de/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Psysonic&lt;/a&gt;, a cross-platform app built for sitting on top of Navidrome. I like the app, it looks fresh and is quick. I’ve got just over 25,000 tracks of lossless audio in my Roon library, so speed matters.&lt;/p&gt;
&lt;p&gt;There is however a feature of Psysonic called Orbit, which took my eye. It allows you and friends to listen to the same self-hosted music library together in a synced session. Sounds great, right? At the very least it sounds intriguing.&lt;/p&gt;
&lt;p&gt;According to the website:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Orbit is Psysonic’s shared listening mode. One person hosts the music, others join through an invite link and listen in sync. Guests can suggest tracks; the host decides what gets added to the queue unless auto-approval is enabled.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Does Orbit need an external server or extra account? No. Orbit uses your existing Navidrome server and regular playlists as transport — no relay, no hosted sync service, no extra account.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;What does Orbit require? Everyone needs access to the same Navidrome server with their own Navidrome user. For friends outside your network, the server must be reachable publicly.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I can picture it now. Friends, all sitting around the living room on sofas and comfy chairs, eating pizza, laughing and teasing my music collection, shoving, playfully pinching and loud shrieks visiting old songs. Everyone taking turns to add music to the queue, pumping up the volume, cringe dancing…&lt;/p&gt;
&lt;p&gt;Unless you have friends and family over to your place and you can listen to music together, you’ll need to resolve one issue. For guests not in the same space you need to set up remote access, some kind of relay because Orbit has no relay server.&lt;/p&gt;
&lt;p&gt;Psysonic’s Orbit feature works by writing the session state into a Navidrome playlist and having each guest poll it. That means every participant’s Psysonic app needs to be able to talk to your Navidrome server directly, which means I need to grant them secure access to my local server.&lt;/p&gt;
&lt;h2 id=&quot;methods-to-access-navidrome-externally&quot;&gt;Methods to access Navidrome externally&lt;/h2&gt;
&lt;p&gt;Here are a few of the common methods to make your server reachable from the outside world.&lt;/p&gt;
&lt;h3 id=&quot;vpn-most-secure&quot;&gt;VPN (most secure)&lt;/h3&gt;
&lt;p&gt;Connect your phone or laptop to a private network like Tailscale or WireGuard and your device acts as if it is on your home Wi-Fi. You don’t need to open any router ports. This setup is best reserved for trusted family and friends rather than the general public, but it can be cumbersome as every user needs to download the Tailscale app, create an account, and accept your invitation. This is clunky.&lt;/p&gt;
&lt;h3 id=&quot;reverse-proxy-with-ssl&quot;&gt;Reverse proxy with SSL&lt;/h3&gt;
&lt;p&gt;Use a tool like &lt;a href=&quot;https://nginxproxymanager.com/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Nginx Proxy Manager&lt;/a&gt;, &lt;a href=&quot;https://caddyserver.com/docs/quick-starts/reverse-proxy&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Caddy&lt;/a&gt;, or a &lt;a href=&quot;https://developers.cloudflare.com/tunnel/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Cloudflare Tunnel&lt;/a&gt;. This gives you a secure https:// web address that you can then map a custom domain to or use a free DDNS (Dynamic DNS) service.&lt;/p&gt;
&lt;h3 id=&quot;port-forwarding-least-secure&quot;&gt;Port forwarding (least secure)&lt;/h3&gt;
&lt;p&gt;Forward port 4533 (the default Navidrome port) directly on your router. This exposes your server to the internet. Warning: you should only do this if you use HTTPS, as plain HTTP sends your password in the clear.&lt;/p&gt;
&lt;p&gt;I opted to setup a reverse proxy, so I’ll walk through the steps I used and decisions I made.&lt;/p&gt;
&lt;h2 id=&quot;architecture&quot;&gt;Architecture&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-psysonic-orbit-architecture.svg&quot; alt=&quot;image&quot;&gt;&lt;/p&gt;
&lt;p&gt;No inbound ports are opened on the router, &lt;code&gt;cloudflared&lt;/code&gt; only makes &lt;em&gt;outbound&lt;/em&gt; connections to Cloudflare’s edge, and Cloudflare proxies public HTTPS traffic back through that tunnel to the container on the LAN.&lt;/p&gt;
&lt;p&gt;Just a sidenote before it causes any confusion. I’m using a shared network stack in Docker, so I thought I would write a little as to why it is designed this way.&lt;/p&gt;
&lt;h3 id=&quot;the-sidecar-pattern&quot;&gt;The “sidecar” pattern:&lt;/h3&gt;
&lt;p&gt;My Navidrome composer file builds three containers, Tailscale, Navidrome and Cloudflared. Cloudflared and Navidrome are hitching a ride on the Tailscale container’s network stack. This means all three containers share the exact same localhost interface. Tailscale here was the original setup I had before using Cloudflared as I setup a reverse proxy for my personal use, accessing Navidrome from outside the house. I’ll show a compose snippet later on.&lt;/p&gt;
&lt;h3 id=&quot;zero-exposed-ports&quot;&gt;Zero exposed ports:&lt;/h3&gt;
&lt;p&gt;Because Cloudflared is in the same network namespace as Navidrome, it can route traffic directly to localhost:4533. You don’t have to expose port 4533 to your local home router at all.&lt;/p&gt;
&lt;h3 id=&quot;dual-routing-the-hybrid-benefit&quot;&gt;Dual routing (the hybrid benefit):&lt;/h3&gt;
&lt;p&gt;My server gets the best of both worlds: public HTTP access via the Cloudflare Tunnel for friends, alongside secure, encrypted management access via my private Tailscale network for my use. Tailscale basically owns the network so this is shared with Cloudflared and Navidrome, hence why you see it on the diagram.&lt;/p&gt;
&lt;h2 id=&quot;domain&quot;&gt;Domain&lt;/h2&gt;
&lt;h3 id=&quot;update-your-nameservers&quot;&gt;Update your nameservers&lt;/h3&gt;
&lt;p&gt;If you already have a domain you can use, then it’s straightforward. Move your domain’s DNS to Cloudflare. For this example I’ll use &lt;code&gt;orbit.yourdomain.com&lt;/code&gt;. Update the nameservers on your domain. Follow the &lt;a href=&quot;https://developers.cloudflare.com/fundamentals/manage-domains/add-site/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Cloudflare guide&lt;/a&gt;. Wait for propagation, this can take a few minutes to a few hours. Once this is active Cloudflare becomes authoritative for the whole domain.&lt;/p&gt;
&lt;h3 id=&quot;install-cloudflared-on-the-navidrome-machine&quot;&gt;Install cloudflared on the Navidrome machine&lt;/h3&gt;
&lt;p&gt;Install the cloudflared daemon on whatever host runs Navidrome (a Pi, NAS, server, etc.). On Debian/Ubuntu: add Cloudflare’s package repo and &lt;code&gt;apt install cloudflared&lt;/code&gt;, or grab the binary release directly for your architecture from Cloudflare’s GitHub releases.&lt;/p&gt;
&lt;p&gt;This maps &lt;code&gt;~/.cloudflared&lt;/code&gt; on the host’s home folder, so you’ll need to create this first, run these commands on the host machine:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;shell&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;mkdir&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -p&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; ~/.cloudflared&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;chown&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -R&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; 65532:65532&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; ~/.cloudflared&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; run&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -it&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; --rm&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -v&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; ~/.cloudflared:/home/nonroot/.cloudflared&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; cloudflare/cloudflared:latest&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; tunnel&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; login&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; run&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -it&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; --rm&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -v&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; ~/.cloudflared:/home/nonroot/.cloudflared&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; cloudflare/cloudflared:latest&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; tunnel&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; create&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; navidrome&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6A737D&quot;&gt;# output&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;Created&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; tunnel&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; navidrome&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; with&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; id&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt; &amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;cloudflared_i&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;d&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; run&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -it&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; --rm&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -v&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; ~/.cloudflared:/home/nonroot/.cloudflared&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; cloudflare/cloudflared:latest&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; tunnel&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; route&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; dns&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; navidrome&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; orbit.yourdomain.com&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6A737D&quot;&gt;# output&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;INF&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; Added&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; CNAME&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; orbit.yourdomain.com&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; which&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; will&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; route&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; to&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; this&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; tunnel&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; tunnelID=&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;cloudflared_i&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;d&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create &lt;code&gt;~/.cloudflared/config.yml&lt;/code&gt; to store credentials, tunnel, and add domains and services to an ingress rule. It will look something like this sans tailscale unless you’ve deployed it.&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;yaml&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;tunnel&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;&amp;#x3C;cloudflared_id&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;credentials-file&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;/home/nonroot/.cloudflared/&amp;#x3C;cloudflared_id&gt;.json&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;ingress&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;  - &lt;/span&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;hostname&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;orbit.yourdomain.com&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;    service&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;http://tailscale:4533&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;  - &lt;/span&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;service&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;http_status:404&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;add-the-cloudflared-service-to-your-existing-docker-composeyml&quot;&gt;Add the cloudflared service to your existing &lt;code&gt;docker-compose.yml&lt;/code&gt;:&lt;/h3&gt;
&lt;p&gt;Secrets and tokens are stored in a .env file outside the composer file.&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;yaml&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#6A737D&quot;&gt;# 1. The cloudflare tunnel client&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;cloudflared&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;  image&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;cloudflare/cloudflared:latest&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;  container_name&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;cloudflared&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;  restart&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;unless-stopped&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;  command&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;tunnel run&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;  volumes&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;    - &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;~/.cloudflared:/home/nonroot/.cloudflared&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#85E89D&quot;&gt;  depends_on&lt;/span&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#E1E4E8&quot;&gt;    - &lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt;navidrome&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;the-moving-parts&quot;&gt;The moving parts&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Domain on Cloudflare’s nameservers.&lt;/strong&gt; The zone (e.g. &lt;code&gt;yourdomain.com&lt;/code&gt;) has to be fully delegated to Cloudflare, not just a subdomain. Cloudflare’s free/pro tiers can’t act as authoritative DNS for a single subdomain on its own (that’s an Enterprise-only “subdomain setup” feature), so the &lt;em&gt;whole&lt;/em&gt; domain’s nameservers need switching at the registrar, not just adding NS records inside an existing DNS zone.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A named Cloudflare Tunnel&lt;/strong&gt;, created with &lt;code&gt;cloudflared tunnel create&lt;/code&gt;, routed to a hostname (&lt;code&gt;orbit.yourdomain.com&lt;/code&gt;) with &lt;code&gt;cloudflared tunnel route dns&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;cloudflared&lt;/code&gt; running as a container&lt;/strong&gt; alongside Navidrome in the same &lt;code&gt;docker-compose.yml&lt;/code&gt;, so it can reach Navidrome by Docker service name instead of &lt;code&gt;localhost&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;An ingress rule&lt;/strong&gt; in &lt;code&gt;cloudflared&lt;/code&gt;’s &lt;code&gt;config.yml&lt;/code&gt; mapping the public hostname to Navidrome’s internal address.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;gotchas-worth-knowing-before-you-start&quot;&gt;Gotchas worth knowing before you start&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;cloudflared&lt;/code&gt;’s Docker image runs as a non-root user&lt;/strong&gt; (&lt;code&gt;nonroot&lt;/code&gt;, UID &lt;code&gt;65532&lt;/code&gt;), not root. If you bind-mount a host directory for the credentials/cert, it needs to be owned by that UID (&lt;code&gt;chown -R 65532:65532&lt;/code&gt;) or the login step will fail with a silent-looking “permission denied” on &lt;code&gt;cert.pem&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Check what actually owns your Docker network.&lt;/strong&gt; If Navidrome runs with &lt;code&gt;network_mode: &quot;service:&amp;#x3C;other-container&gt;&quot;&lt;/code&gt; (for example, routed through a Tailscale sidecar container), it has &lt;em&gt;no independent network identity&lt;/em&gt; — &lt;code&gt;cloudflared&lt;/code&gt; can’t resolve it by its own service name. Point the ingress rule at whichever container actually owns the port binding instead.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A “Bad gateway / Host Error” from Cloudflare, with everything else green,&lt;/strong&gt; almost always means &lt;code&gt;cloudflared&lt;/code&gt; itself can’t reach your app container, it’s a Docker networking/naming issue, not a Cloudflare or DNS problem. &lt;code&gt;docker exec -it cloudflared wget -qO- http://&amp;#x3C;service&gt;:&amp;#x3C;port&gt;&lt;/code&gt; from inside the &lt;code&gt;cloudflared&lt;/code&gt; container is the fastest way to confirm.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Don’t put Cloudflare Access in front of the tunnel hostname.&lt;/strong&gt; It injects a browser-based login challenge that breaks Subsonic-API clients like Psysonic, which can’t authenticate through it. Navidrome’s own per-user accounts are the auth layer here.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;using-it-with-orbit&quot;&gt;Using it with Orbit&lt;/h2&gt;
&lt;p&gt;Once &lt;code&gt;https://orbit.yourdomain.com&lt;/code&gt; resolves and serves the Navidrome login page from outside your network:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create a dedicated Navidrome account for your guest (not a shared login, Orbit expects each participant to have their own).&lt;/li&gt;
&lt;li&gt;Point their Psysonic client at your public URL and have them log in.&lt;/li&gt;
&lt;li&gt;On your end: &lt;strong&gt;Psysonic Orbit → Create a session&lt;/strong&gt;, then send them the invite link. They paste it into Psysonic and it logs them in and syncs the session automatically.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Psysonic matches the server configuration byte-for-byte to make sure all users are authenticated against the exact same instance. If you have yourself setup on your local instance with a local profile (&lt;a href=&quot;http://192.xxx.xx.xx:4533&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;http://192.xxx.xx.xx:4533&lt;/a&gt;), and your guests are coming in on remote profiles on the remote instance (&lt;a href=&quot;https://orbit.yourdomain.com&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;https://orbit.yourdomain.com&lt;/a&gt;) the Orbit link will fail.&lt;/p&gt;
&lt;p&gt;When Psysonic generates the Orbit session cryptographic payload it encodes against your local endpoint, whereas your guest is coming in remotely, so there’s a mismatch.&lt;/p&gt;
&lt;p&gt;The fix: ensure both you and your guest are using the exact same root endpoint structure in your Psysonic server setup profiles. If your proxy doesn’t preserve the exact base path Navidrome expects, real-time shared playback states will drop. [1] (&lt;a href=&quot;https://github.com/navidrome/navidrome/discussions/5395&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;https://github.com/navidrome/navidrome/discussions/5395&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;You may also need to remove any connection settings that use your local Navidrome instance, this is because from my experience Psysonic can get confused about which active token to pull when generating the Orbit session payload. By completely purging the local profile I forced the app to use my public endpoint, aligning the internal tokens. It did take some time figuring out why my guest couldn’t join a session I had started, but we got there in the end.&lt;/p&gt;
&lt;h2 id=&quot;result&quot;&gt;Result&lt;/h2&gt;
&lt;p&gt;A fully self-hosted, zero-inbound-ports setup: your music library never leaves your own storage, Cloudflare only ever sees encrypted proxy traffic, and friends anywhere in the world can join a synced listening session against your own library.&lt;/p&gt;
&lt;p&gt;I think the value comes from being able to freely socialise with your friends physically round the house, eating, drinking, and having a laugh at my music library.&lt;/p&gt;
&lt;p&gt;But if that’s not possible maybe try having a video chat channel open while you listen to the music.&lt;/p&gt;</content:encoded><category>cloudflare</category><category>navidrome</category><category>psysonic</category><category>self-hosted</category><category>technology</category><category>website</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/projects/2026/project-heroimage-psysonic-orbit-setting-up.jpg" length="0" type="image/jpeg"/></item><item><title>And the winner is...</title><link>https://elliotx.com/notes/2026/and-the-winner-is</link><guid isPermaLink="true">https://elliotx.com/notes/2026/and-the-winner-is</guid><description>I spent considerable time over the last few days reviewing self-hosted music streaming platforms</description><pubDate>Wed, 09 Sep 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/notes/2026/note-heroimage-and-the-winner-is.jpg&quot; alt=&quot;And the winner is...&quot; /&gt;
&lt;p&gt;As I mentioned in a &lt;a href=&quot;../migrating-roon-to-something-else/&quot;&gt;previous note&lt;/a&gt;, it’s the time of year for annual renewal of my Roon subscription. I use these annual cycles as an opportunity to review what’s out there in the open source world that could replace a paid for service.&lt;/p&gt;
&lt;p&gt;My current setup is a Roon server with all my music (25,000+ tracks), running ROCK. It’s a solid reliable system on an old HP Elitedesk mini.&lt;/p&gt;
&lt;p&gt;I spent a fair bit of time over the past week reviewing alternatives, my primary objective was that any serious alternative had to be either free or low cost. If it could beat Roon on pricing (annual renewal is around $150) then it got prime spot in my testing.&lt;/p&gt;
&lt;h2 id=&quot;navidrome&quot;&gt;Navidrome&lt;/h2&gt;
&lt;p&gt;I’ve always had a soft spot for &lt;a href=&quot;https://www.navidrome.org/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Navidrome&lt;/a&gt; over the years, watching it grow and get better, and I wondered if it would be ready to replace Roon.&lt;/p&gt;
&lt;p&gt;I installed it in a Docker container on one of my servers and mounted the Roon server’s SMB share on it. It picked up the music and did a scan, which was promising. Then as the albums and artists populated the library I clicked around to familiarise myself. The UI, while it leaves a lot to be desired, it’s functional if a little plain.&lt;/p&gt;
&lt;div class=&quot;image-carousel not-prose&quot; data-image-carousel=&quot;&quot;&gt;&lt;div class=&quot;image-carousel-viewport&quot;&gt;&lt;div class=&quot;image-carousel-track&quot; data-image-carousel-track=&quot;&quot;&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;false&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/notes/2026/and-the-winner-is/1/1-navidrome-screenshot-1600.webp&quot; alt=&quot;navidrome screenshot&quot; loading=&quot;eager&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/notes/2026/and-the-winner-is/1/1-navidrome-screenshot-480.webp 480w, /thumbs/images/notes/2026/and-the-winner-is/1/1-navidrome-screenshot-960.webp 960w, /thumbs/images/notes/2026/and-the-winner-is/1/1-navidrome-screenshot-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1906&quot; height=&quot;980&quot; data-full=&quot;/images/notes/2026/and-the-winner-is/1/1-navidrome-screenshot.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/notes/2026/and-the-winner-is/1/2-navidrome-screenshot-1600.webp&quot; alt=&quot;navidrome screenshot&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/notes/2026/and-the-winner-is/1/2-navidrome-screenshot-480.webp 480w, /thumbs/images/notes/2026/and-the-winner-is/1/2-navidrome-screenshot-960.webp 960w, /thumbs/images/notes/2026/and-the-winner-is/1/2-navidrome-screenshot-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1896&quot; height=&quot;979&quot; data-full=&quot;/images/notes/2026/and-the-winner-is/1/2-navidrome-screenshot.png&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-nav image-carousel-prev&quot; data-image-carousel-prev=&quot;&quot; aria-label=&quot;Previous image&quot;&gt;‹&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-nav image-carousel-next&quot; data-image-carousel-next=&quot;&quot; aria-label=&quot;Next image&quot;&gt;›&lt;/button&gt;&lt;span class=&quot;image-carousel-counter&quot; data-image-carousel-counter=&quot;&quot;&gt;1 / 2&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-dots&quot; data-image-carousel-dots=&quot;&quot;&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 1 of 2&quot; aria-current=&quot;true&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 2 of 2&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Using Navidrome via a web browser I was quietly impressed. It was fast, the sound was good and I liked some of the options in the left sidebar. It played lossless FLAC without any issues and overall I liked the change despite it looking a little sparse. That said, the lack of functionality exposed by the UI means you’ll be searching for something more fully featured.&lt;/p&gt;
&lt;p&gt;Sadly one of the lacking features is integration with audio products, amps etc. I could add a control point using perhaps DLNA or UPnP, but this wasn’t that straight forward and when I did get DLNA working I couldn’t pass a stream to the amp, only the current track. No handing over of a complete album or playlist.&lt;/p&gt;
&lt;p&gt;This is actually a plus point of Navidrome because there are lots of desktop and mobile apps that run on top of a Navidrome setup. Think of Navidrome then as the middle-layer. One of the apps I found, free of charge, was Psysonic.&lt;/p&gt;
&lt;h2 id=&quot;psysonic&quot;&gt;Psysonic&lt;/h2&gt;
&lt;p&gt;I came across &lt;a href=&quot;https://www.psysonic.de/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Psysonic&lt;/a&gt; while looking for Navidrome and &lt;a href=&quot;https://www.subsonic.org/pages/apps.jsp&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Subsonic apps&lt;/a&gt;. Psysonic is a multi-platform desktop client so if you’re a multi-platform household it’s nice to have consistency. Setting the app up and connecting it to a running Navidrome instance was a breeze. Navidrome IP address, username, password, done.&lt;/p&gt;
&lt;div class=&quot;image-carousel not-prose&quot; data-image-carousel=&quot;&quot;&gt;&lt;div class=&quot;image-carousel-viewport&quot;&gt;&lt;div class=&quot;image-carousel-track&quot; data-image-carousel-track=&quot;&quot;&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;false&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/notes/2026/and-the-winner-is/2/1-psysonic-screenshot-1600.webp&quot; alt=&quot;psysonic screenshot&quot; loading=&quot;eager&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/notes/2026/and-the-winner-is/2/1-psysonic-screenshot-480.webp 480w, /thumbs/images/notes/2026/and-the-winner-is/2/1-psysonic-screenshot-960.webp 960w, /thumbs/images/notes/2026/and-the-winner-is/2/1-psysonic-screenshot-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1900&quot; height=&quot;1097&quot; data-full=&quot;/images/notes/2026/and-the-winner-is/2/1-psysonic-screenshot.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/notes/2026/and-the-winner-is/2/2-psysonic-screenshot-1600.webp&quot; alt=&quot;psysonic screenshot&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/notes/2026/and-the-winner-is/2/2-psysonic-screenshot-480.webp 480w, /thumbs/images/notes/2026/and-the-winner-is/2/2-psysonic-screenshot-960.webp 960w, /thumbs/images/notes/2026/and-the-winner-is/2/2-psysonic-screenshot-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1907&quot; height=&quot;1095&quot; data-full=&quot;/images/notes/2026/and-the-winner-is/2/2-psysonic-screenshot.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/notes/2026/and-the-winner-is/2/3-psysonic-screenshot-1600.webp&quot; alt=&quot;psysonic screenshot&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/notes/2026/and-the-winner-is/2/3-psysonic-screenshot-480.webp 480w, /thumbs/images/notes/2026/and-the-winner-is/2/3-psysonic-screenshot-960.webp 960w, /thumbs/images/notes/2026/and-the-winner-is/2/3-psysonic-screenshot-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1911&quot; height=&quot;1097&quot; data-full=&quot;/images/notes/2026/and-the-winner-is/2/3-psysonic-screenshot.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/notes/2026/and-the-winner-is/2/4-psysonic-screenshot-1600.webp&quot; alt=&quot;psysonic screenshot&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/notes/2026/and-the-winner-is/2/4-psysonic-screenshot-480.webp 480w, /thumbs/images/notes/2026/and-the-winner-is/2/4-psysonic-screenshot-960.webp 960w, /thumbs/images/notes/2026/and-the-winner-is/2/4-psysonic-screenshot-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1904&quot; height=&quot;1096&quot; data-full=&quot;/images/notes/2026/and-the-winner-is/2/4-psysonic-screenshot.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/notes/2026/and-the-winner-is/2/5-psysonic-screenshot-1600.webp&quot; alt=&quot;psysonic screenshot&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/notes/2026/and-the-winner-is/2/5-psysonic-screenshot-480.webp 480w, /thumbs/images/notes/2026/and-the-winner-is/2/5-psysonic-screenshot-960.webp 960w, /thumbs/images/notes/2026/and-the-winner-is/2/5-psysonic-screenshot-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1907&quot; height=&quot;1102&quot; data-full=&quot;/images/notes/2026/and-the-winner-is/2/5-psysonic-screenshot.png&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-nav image-carousel-prev&quot; data-image-carousel-prev=&quot;&quot; aria-label=&quot;Previous image&quot;&gt;‹&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-nav image-carousel-next&quot; data-image-carousel-next=&quot;&quot; aria-label=&quot;Next image&quot;&gt;›&lt;/button&gt;&lt;span class=&quot;image-carousel-counter&quot; data-image-carousel-counter=&quot;&quot;&gt;1 / 5&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-dots&quot; data-image-carousel-dots=&quot;&quot;&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 1 of 5&quot; aria-current=&quot;true&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 2 of 5&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 3 of 5&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 4 of 5&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 5 of 5&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;It’s a very appealing app, and the more I used it the more I grew to like it. The application itself is really fast, and great at surfacing random music I hadn’t listened to for a long time. Which meant I spent considerable time re-discovering old music while I familiarised myself with the interface.&lt;/p&gt;
&lt;p&gt;Unfortunately there’s no integration with other audio products like amps, speakers or other control points. So while I think it’s a great app for playing Roon music locally on your desktop/laptop, the inability to cast the music is a drawback.&lt;/p&gt;
&lt;h2 id=&quot;roon&quot;&gt;Roon&lt;/h2&gt;
&lt;p&gt;Now we come to the incumbent. I like to think I know &lt;a href=&quot;https://roon.app/en/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Roon&lt;/a&gt; quite well having used it everyday for the past few years.&lt;/p&gt;
&lt;div class=&quot;image-carousel not-prose&quot; data-image-carousel=&quot;&quot;&gt;&lt;div class=&quot;image-carousel-viewport&quot;&gt;&lt;div class=&quot;image-carousel-track&quot; data-image-carousel-track=&quot;&quot;&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;false&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/notes/2026/and-the-winner-is/3/1-roon-1600.webp&quot; alt=&quot;roon&quot; loading=&quot;eager&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/notes/2026/and-the-winner-is/3/1-roon-480.webp 480w, /thumbs/images/notes/2026/and-the-winner-is/3/1-roon-960.webp 960w, /thumbs/images/notes/2026/and-the-winner-is/3/1-roon-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1906&quot; height=&quot;1103&quot; data-full=&quot;/images/notes/2026/and-the-winner-is/3/1-roon.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/notes/2026/and-the-winner-is/3/2-roon-1600.webp&quot; alt=&quot;roon&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/notes/2026/and-the-winner-is/3/2-roon-480.webp 480w, /thumbs/images/notes/2026/and-the-winner-is/3/2-roon-960.webp 960w, /thumbs/images/notes/2026/and-the-winner-is/3/2-roon-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1906&quot; height=&quot;1100&quot; data-full=&quot;/images/notes/2026/and-the-winner-is/3/2-roon.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/notes/2026/and-the-winner-is/3/3-roon-1600.webp&quot; alt=&quot;roon&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/notes/2026/and-the-winner-is/3/3-roon-480.webp 480w, /thumbs/images/notes/2026/and-the-winner-is/3/3-roon-960.webp 960w, /thumbs/images/notes/2026/and-the-winner-is/3/3-roon-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1905&quot; height=&quot;1094&quot; data-full=&quot;/images/notes/2026/and-the-winner-is/3/3-roon.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/notes/2026/and-the-winner-is/3/4-roon-1600.webp&quot; alt=&quot;roon&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/notes/2026/and-the-winner-is/3/4-roon-480.webp 480w, /thumbs/images/notes/2026/and-the-winner-is/3/4-roon-960.webp 960w, /thumbs/images/notes/2026/and-the-winner-is/3/4-roon-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1913&quot; height=&quot;1090&quot; data-full=&quot;/images/notes/2026/and-the-winner-is/3/4-roon.png&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-nav image-carousel-prev&quot; data-image-carousel-prev=&quot;&quot; aria-label=&quot;Previous image&quot;&gt;‹&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-nav image-carousel-next&quot; data-image-carousel-next=&quot;&quot; aria-label=&quot;Next image&quot;&gt;›&lt;/button&gt;&lt;span class=&quot;image-carousel-counter&quot; data-image-carousel-counter=&quot;&quot;&gt;1 / 4&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-dots&quot; data-image-carousel-dots=&quot;&quot;&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 1 of 4&quot; aria-current=&quot;true&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 2 of 4&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 3 of 4&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 4 of 4&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;It’s an all round good app connecting to the Roon server essentially working as a remote control for the music. You can use a desktop, laptop, tablet or phone.&lt;/p&gt;
&lt;p&gt;The music can be directed to any Roon endpoint within the network. This can be speakers, DACs, an amp, a Raspberry Pi, you get the idea. Plus multi-room audio is baked into the Roon system. You can have different streams playing to different devices. Or group units to play the same music throughout the house. All of this is dependent too on your hardware’s ability to process and push audio where it’s needed without dropping it.&lt;/p&gt;
&lt;p&gt;These features are, in my view, the killer features of Roon. Integration is standard and easy to setup and use. It really does just work. And that it works with so many products from most of the biggest names in hifi to the smaller boutiques is something not matched by the free open source stuff.&lt;/p&gt;
&lt;p&gt;There’s simply no coherence for achieving lossless audio playback throughout the audio chain in the free/low cost open source world that I’ve seen. This isn’t to say I’ve done an exhaustive search for all the products available, just stuff that is around me and which surfaces in typical web searches.&lt;/p&gt;
&lt;div class=&quot;image-carousel not-prose&quot; data-image-carousel=&quot;&quot;&gt;&lt;div class=&quot;image-carousel-viewport&quot;&gt;&lt;div class=&quot;image-carousel-track&quot; data-image-carousel-track=&quot;&quot;&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;false&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/notes/2026/and-the-winner-is/4/1-roon-metadata-1600.webp&quot; alt=&quot;roon metadata&quot; loading=&quot;eager&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/notes/2026/and-the-winner-is/4/1-roon-metadata-480.webp 480w, /thumbs/images/notes/2026/and-the-winner-is/4/1-roon-metadata-960.webp 960w, /thumbs/images/notes/2026/and-the-winner-is/4/1-roon-metadata-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1898&quot; height=&quot;1098&quot; data-full=&quot;/images/notes/2026/and-the-winner-is/4/1-roon-metadata.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/notes/2026/and-the-winner-is/4/2-roon-metadata-1600.webp&quot; alt=&quot;roon metadata&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/notes/2026/and-the-winner-is/4/2-roon-metadata-480.webp 480w, /thumbs/images/notes/2026/and-the-winner-is/4/2-roon-metadata-960.webp 960w, /thumbs/images/notes/2026/and-the-winner-is/4/2-roon-metadata-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1906&quot; height=&quot;1094&quot; data-full=&quot;/images/notes/2026/and-the-winner-is/4/2-roon-metadata.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/notes/2026/and-the-winner-is/4/3-roon-metadata-1600.webp&quot; alt=&quot;roon metadata&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/notes/2026/and-the-winner-is/4/3-roon-metadata-480.webp 480w, /thumbs/images/notes/2026/and-the-winner-is/4/3-roon-metadata-960.webp 960w, /thumbs/images/notes/2026/and-the-winner-is/4/3-roon-metadata-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1904&quot; height=&quot;1099&quot; data-full=&quot;/images/notes/2026/and-the-winner-is/4/3-roon-metadata.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/notes/2026/and-the-winner-is/4/4-roon-metadata-1600.webp&quot; alt=&quot;roon metadata&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/notes/2026/and-the-winner-is/4/4-roon-metadata-480.webp 480w, /thumbs/images/notes/2026/and-the-winner-is/4/4-roon-metadata-960.webp 960w, /thumbs/images/notes/2026/and-the-winner-is/4/4-roon-metadata-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1903&quot; height=&quot;1100&quot; data-full=&quot;/images/notes/2026/and-the-winner-is/4/4-roon-metadata.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/notes/2026/and-the-winner-is/4/5-roon-metadata-1600.webp&quot; alt=&quot;roon metadata&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/notes/2026/and-the-winner-is/4/5-roon-metadata-480.webp 480w, /thumbs/images/notes/2026/and-the-winner-is/4/5-roon-metadata-960.webp 960w, /thumbs/images/notes/2026/and-the-winner-is/4/5-roon-metadata-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1903&quot; height=&quot;1098&quot; data-full=&quot;/images/notes/2026/and-the-winner-is/4/5-roon-metadata.png&quot;&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-slide&quot; data-image-carousel-slide=&quot;&quot; aria-hidden=&quot;true&quot;&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/notes/2026/and-the-winner-is/4/6-roon-metadata-1600.webp&quot; alt=&quot;roon metadata&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; srcset=&quot;/thumbs/images/notes/2026/and-the-winner-is/4/6-roon-metadata-480.webp 480w, /thumbs/images/notes/2026/and-the-winner-is/4/6-roon-metadata-960.webp 960w, /thumbs/images/notes/2026/and-the-winner-is/4/6-roon-metadata-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1905&quot; height=&quot;1097&quot; data-full=&quot;/images/notes/2026/and-the-winner-is/4/6-roon-metadata.png&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-nav image-carousel-prev&quot; data-image-carousel-prev=&quot;&quot; aria-label=&quot;Previous image&quot;&gt;‹&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-nav image-carousel-next&quot; data-image-carousel-next=&quot;&quot; aria-label=&quot;Next image&quot;&gt;›&lt;/button&gt;&lt;span class=&quot;image-carousel-counter&quot; data-image-carousel-counter=&quot;&quot;&gt;1 / 6&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;image-carousel-dots&quot; data-image-carousel-dots=&quot;&quot;&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 1 of 6&quot; aria-current=&quot;true&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 2 of 6&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 3 of 6&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 4 of 6&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 5 of 6&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;button type=&quot;button&quot; class=&quot;image-carousel-dot&quot; data-image-carousel-dot=&quot;&quot; aria-label=&quot;Go to image 6 of 6&quot; aria-current=&quot;false&quot;&gt;&lt;/button&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Another good point of Roon is the metadata that it overlays on your music. It has a vast database of data to match against your music, which means it links a lot of your music together in surprising ways. It’s a really good feature.&lt;/p&gt;
&lt;p&gt;I think where Roon falters is music discovery when compared to other apps. Psysonic is quite aggressive at refreshing and pushing things to me on the front page, which I really like, Roon is quite passive in comparison.&lt;/p&gt;
&lt;p&gt;Roon has filters and a ‘focus’ toggle to filter different metadata, but this doesn’t appear to be well designed as I find it fiddly and lacking. Lacking in the most basic kind of filtering, which should be easy, not as hard as it is. I just want to play music, not spend time adjusting filters to find music.&lt;/p&gt;
&lt;p&gt;Another poor feature is the radio. I can’t stream a ‘radio service’ from my entire catalogue. Even within a genre it’s awkward and frustrating. I come at this having used Sub/Wave for a few days and really enjoying the simplicity of it once it’s up and running. But hey, no software is perfect.&lt;/p&gt;
&lt;p&gt;Lastly it should be noted that Roon is not free. There’s an annual subscription, or you can opt for lifetime licence.&lt;/p&gt;
&lt;h2 id=&quot;summing-up&quot;&gt;Summing up&lt;/h2&gt;
&lt;p&gt;I’m quite pleased with Navidrome and Psysonic. If integrations were straight forward out of the box then these could mount a real challenge to Roon. Sadly that day is not today.&lt;/p&gt;
&lt;p&gt;I will keep Navidrome running because I have discovered &lt;a href=&quot;https://www.getsubwave.com/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;SUB/WAVE&lt;/a&gt; which runs on top of Navidrome. I don’t want to get distracted with mentioning another app except to say one thing, it’s an absolute joyful radio streaming experience.&lt;/p&gt;
&lt;p&gt;I’ve decided to stay with Roon, at least for another year. The integrations and metadata are the killer features, and so far none of the free options can compete at this time. There are other paid for multi-room systems that I’m sure work well (&lt;em&gt;cough&lt;/em&gt; &lt;a href=&quot;https://audirvana.com/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Audirvana&lt;/a&gt;, &lt;em&gt;cough&lt;/em&gt;), but since I have Roon this is where I’ll remain for the time being.&lt;/p&gt;</content:encoded><category>music</category><category>navidrome</category><category>psysonic</category><category>roon</category><category>self-hosted</category><category>streaming</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/notes/2026/note-heroimage-and-the-winner-is.jpg" length="0" type="image/jpeg"/></item><item><title>Migrating from Roon to...</title><link>https://elliotx.com/notes/2026/migrating-roon-to-something-else</link><guid isPermaLink="true">https://elliotx.com/notes/2026/migrating-roon-to-something-else</guid><description>It&apos;s subscription renewal time, which means one thing: looking at alternatives</description><pubDate>Thu, 03 Sep 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/notes/2026/note-heroimage-migrating-roon-to-something-else.jpg&quot; alt=&quot;Migrating from Roon to...&quot; /&gt;
&lt;p&gt;I’ve been a &lt;a href=&quot;https://roon.app/en/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Roon&lt;/a&gt; fan for the last couple of years. This was back when I started to seriously want to self-host my own data and music, to move away from using purely big tech or Spotify. I was very curious about it all, and had an itch to build stuff.&lt;/p&gt;
&lt;p&gt;Back to Roon. It’s quite nice software, desktop and portable, and current pricing is $150 a year. It can work with locally stored digital music, or connect to a remote Roon Server, which is the centralised music storage. This server can be a DIY job or one of its &lt;a href=&quot;https://www.roonlabs.co.uk/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;own hardware products&lt;/a&gt;. I built my own on a second-hand &lt;a href=&quot;https://support.hp.com/hk-en/product/setup-user-guides/hp-elitedesk-800-35w-g3-desktop-mini-pc/15234602&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;HP Elite Desk 800 G3 mini desktop&lt;/a&gt;. £75 from eBay.&lt;/p&gt;
&lt;p&gt;Easy enough to set up as Roon has it’s own custom Roon OS running on Linux, called ROCK (Roon Optimized Core Kit). Using this with its Roon software works seamlessly. My HP has been rock solid. Absolutely zero issues. The hardware is more than adequate for the 25,000+ tracks of lossless audio hosted on it. It has a small boot drive, and a 4TB NVME drive for the music.&lt;/p&gt;
&lt;p&gt;I use Roon pretty much every day, and along with the companion iOS app means I have access (via Tailscale) to all my music wherever I have an internet connection.&lt;/p&gt;
&lt;p&gt;One of the big selling points of Roon is integration with a whole eco system of audio products. &lt;a href=&quot;https://roon.app/en/partners&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Roon Ready&lt;/a&gt; is on amps, streamers, speakers…many products which is part of the appeal, easy integration for multi-room audio. Not to mention integrating popular services such as &lt;a href=&quot;https://tidal.com/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Tidal&lt;/a&gt; or &lt;a href=&quot;https://www.qobuz.com/gb-en/discover&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Qobuz&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But then I go through a process when my subscription is due to renew.&lt;/p&gt;
&lt;p&gt;Is there an alternative?&lt;/p&gt;
&lt;p&gt;Yes, there are. But the real question for me has to be is any of this stuff any good and what’s the user experience like?&lt;/p&gt;
&lt;p&gt;I need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;desktop client (Mac and Linux)&lt;/li&gt;
&lt;li&gt;mobile client (iPhone and iPad)&lt;/li&gt;
&lt;li&gt;integration with existing hi-fi (NAD amp)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I’m keen to try something before my renewal is due so I can make a determination whether I stay or go. I’ve got a month, so I’d better get started with a plan.&lt;/p&gt;</content:encoded><category>music</category><category>roon</category><category>self-host</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/notes/2026/note-heroimage-migrating-roon-to-something-else.jpg" length="0" type="image/jpeg"/></item><item><title>Daily Last.fm Scrobble Snapshot Script</title><link>https://elliotx.com/projects/2026/daily-lastfm-scrobble-snapshot-script</link><guid isPermaLink="true">https://elliotx.com/projects/2026/daily-lastfm-scrobble-snapshot-script</guid><description>An overview of the design behind the daily scrobble‑snapshot pipeline.</description><pubDate>Mon, 31 Aug 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-heroimage-daily-last.fm-scrobble-snapshot-script.jpg&quot; alt=&quot;A colourful image showing a Last.fm data pipeline script written in Python&quot; /&gt;
&lt;h2 id=&quot;1-purpose&quot;&gt;1. Purpose&lt;/h2&gt;
&lt;p&gt;As part of my interest in building a bigger more ambitious dashboard I thought I’d start with a small wee project, something really simple which can provide the foundations for something with larger scope.&lt;/p&gt;
&lt;p&gt;This script retrieves &lt;strong&gt;all scrobbles from “yesterday”&lt;/strong&gt; for the specified Last.fm user (me currently), filters out invalid entries, and stores the results in a &lt;strong&gt;CSV snapshot&lt;/strong&gt;. Each run produces a clean, analysis‑ready dataset that can be used for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Time‑series analysis&lt;/li&gt;
&lt;li&gt;Daily deltas&lt;/li&gt;
&lt;li&gt;Listening‑pattern visualisation&lt;/li&gt;
&lt;li&gt;MusicBrainz enrichment&lt;/li&gt;
&lt;li&gt;Aggregated charts&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The script is intentionally simple, stable, and predictable, designed for long‑term use and can be refactored to suit different APIs or a Cloud Run function.&lt;/p&gt;
&lt;p&gt;The eventual idea is to run it as a Cloud Run function to automate the data ingest into BigQuery adding data from other data sources. Go big or go home, do they still say that?&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;2-key-features&quot;&gt;2. Key Features&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;UTC‑based time‑range filtering&lt;/strong&gt; using UNIX timestamps&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Automatic exclusion&lt;/strong&gt; of Last.fm’s “now playing” track&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Filtering out scrobbles outside the desired window&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Clean CSV output&lt;/strong&gt; with stable schema&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Snapshot timestamp&lt;/strong&gt; for later delta analysis&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Environment‑based configuration&lt;/strong&gt; via &lt;code&gt;.env&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id=&quot;3-why-unix-timestamps-and-utc&quot;&gt;3. Why UNIX timestamps and UTC?&lt;/h2&gt;
&lt;p&gt;Last.fm’s API requires &lt;code&gt;from&lt;/code&gt; and &lt;code&gt;to&lt;/code&gt; parameters in &lt;strong&gt;UNIX timestamp format&lt;/strong&gt;, and explicitly states:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;“This must be in the UTC time zone.”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To ensure correctness, the script computes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;y_start&lt;/code&gt; → yesterday at &lt;strong&gt;00:00:00 UTC&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;y_end&lt;/code&gt; → yesterday at &lt;strong&gt;23:59:59 UTC&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This guarantees that the API returns only scrobbles from the intended day, regardless of the user’s local timezone.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;4-the-now-playing-bug&quot;&gt;4. The “Now Playing” Bug&lt;/h2&gt;
&lt;p&gt;One of the biggest challenges was discovering that Last.fm &lt;strong&gt;always returns the most recent track&lt;/strong&gt;, even if it falls &lt;em&gt;outside&lt;/em&gt; the requested time range. This track may include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;@attr: { nowplaying: &quot;true&quot; }&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;No &lt;code&gt;date&lt;/code&gt; field&lt;/li&gt;
&lt;li&gt;A timestamp greater than &lt;code&gt;y_end&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What I discovered was that if you are scrobbling music at the time the script is running then it will pick up this data artefact. It’s not documented.&lt;/p&gt;
&lt;p&gt;This caused the script to incorrectly include a track from &lt;em&gt;today&lt;/em&gt; alongside yesterday’s scrobbles, and consequently I went around in circles trying to figure it out.&lt;/p&gt;
&lt;h3 id=&quot;️-solution&quot;&gt;✔️ Solution&lt;/h3&gt;
&lt;p&gt;I added explicit filtering:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Skip entries with &lt;code&gt;nowplaying=&quot;true&quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Skip entries missing a &lt;code&gt;date&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Skip entries whose &lt;code&gt;uts&lt;/code&gt; timestamp is outside &lt;code&gt;[y_start, y_end]&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This ensures the dataset contains &lt;strong&gt;only&lt;/strong&gt; valid scrobbles from yesterday.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;5-csv-schema-decisions&quot;&gt;5. CSV Schema Decisions&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/projects/2026/project-daily-last.fm-scrobble-snapshot-script-1600.webp&quot; alt=&quot;image&quot; srcset=&quot;/thumbs/images/projects/2026/project-daily-last.fm-scrobble-snapshot-script-480.webp 480w, /thumbs/images/projects/2026/project-daily-last.fm-scrobble-snapshot-script-960.webp 960w, /thumbs/images/projects/2026/project-daily-last.fm-scrobble-snapshot-script-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1807&quot; height=&quot;547&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; data-full=&quot;/images/projects/2026/project-daily-last.fm-scrobble-snapshot-script.png&quot;&gt;&lt;/p&gt;
&lt;p&gt;The CSV schema is intentionally simple but structured enough for future analysis:&lt;/p&gt;

















































&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Column&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;timestamp&lt;/code&gt;&lt;/td&gt;&lt;td&gt;When the snapshot was taken&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;scrobble_uts&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Scrobble UNIX timestamp&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;scrobble_datetime&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Scrobble date/time of converted UTS&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;rank&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Position within the filtered list&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;name&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Track name&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;album_name&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Album name&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;artist_mbid&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Artist mbid&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;track_mbid&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Track mbid&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;album_mbid&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Album mbid&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;url&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Track URL&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;This meets the immediate requirement: &lt;strong&gt;store yesterday’s scrobbles cleanly&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Later, you can expand the schema using CSV schema improvements if you want:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;MBIDs&lt;/li&gt;
&lt;li&gt;Artist/album fields&lt;/li&gt;
&lt;li&gt;Scrobble timestamps&lt;/li&gt;
&lt;li&gt;Human‑readable datetime&lt;/li&gt;
&lt;li&gt;Enrichment metadata&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But for now, the minimal schema keeps the file lightweight and easy to parse.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;6-script-flow&quot;&gt;6. Script Flow&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Load environment variables&lt;/li&gt;
&lt;li&gt;Compute yesterday’s UTC time range&lt;/li&gt;
&lt;li&gt;Call &lt;code&gt;user.getRecentTracks&lt;/code&gt; with &lt;code&gt;from&lt;/code&gt; and &lt;code&gt;to&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Filter out invalid entries&lt;/li&gt;
&lt;li&gt;Build structured rows&lt;/li&gt;
&lt;li&gt;Append to CSV (create if missing)&lt;/li&gt;
&lt;li&gt;Print confirmation&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This flow is stable and predictable, which is ideal for daily automation.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;7-challenges&quot;&gt;7. Challenges&lt;/h2&gt;
&lt;h3 id=&quot;1-incorrect-time-filtering&quot;&gt;1. Incorrect time filtering&lt;/h3&gt;
&lt;p&gt;The API returned extra tracks because Last.fm ignores &lt;code&gt;from&lt;/code&gt;/&lt;code&gt;to&lt;/code&gt; for the most recent scrobble.&lt;br&gt;
&lt;strong&gt;Fixed via manual filtering.&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id=&quot;2-missing-timestamps&quot;&gt;2. Missing timestamps&lt;/h3&gt;
&lt;p&gt;Some scrobbles lack a &lt;code&gt;date&lt;/code&gt; field.&lt;br&gt;
&lt;strong&gt;Filtered out to avoid crashes.&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id=&quot;3-csv-schema-limitations&quot;&gt;3. CSV schema limitations&lt;/h3&gt;
&lt;p&gt;The original schema was too minimal for future analysis.&lt;br&gt;
&lt;strong&gt;Improved schema documented for future expansion.&lt;/strong&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;8-future-extensions&quot;&gt;8. Future Extensions&lt;/h2&gt;
&lt;p&gt;If you want to expand this pipeline later, here are natural next steps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add MBIDs&lt;/li&gt;
&lt;li&gt;Daily delta analysis&lt;/li&gt;
&lt;li&gt;MusicBrainz enrichment&lt;/li&gt;
&lt;li&gt;Daily chart generation&lt;/li&gt;
&lt;li&gt;Unified artist/track analytics&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Each of these builds on the clean foundation already established here. I created this as an exercise with a view to automating data collection as part of a larger data ingest pipeline.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;9-summary&quot;&gt;9. Summary&lt;/h2&gt;
&lt;p&gt;This script provides a reliable, timestamp‑accurate snapshot of yesterday’s scrobbles. The main challenges, Last.fm’s “now playing” quirk, timestamp filtering, and CSV schema design, have been solved in a way that keeps the pipeline simple while leaving room for future projects.&lt;/p&gt;
&lt;p&gt;It’s a great way to experiment further with other endpoints and aggregating data, linking it via the MBIDs to MusicBrainz and building something interesting.&lt;/p&gt;
&lt;p&gt;Take a &lt;a href=&quot;https://github.com/elliotrichards/elliotx-website-code-examples/blob/main/last.fm/get-user-tracks-yesterday/user.getRecentTracks-v3.py&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;look at the script&lt;/a&gt;.&lt;/p&gt;</content:encoded><category>api</category><category>data</category><category>last-fm</category><category>music</category><category>python</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/projects/2026/project-heroimage-daily-last.fm-scrobble-snapshot-script.jpg" length="0" type="image/jpeg"/></item><item><title>Building a bigger project</title><link>https://elliotx.com/notes/2026/building-a-bigger-project</link><guid isPermaLink="true">https://elliotx.com/notes/2026/building-a-bigger-project</guid><description>Time to think big</description><pubDate>Sat, 29 Aug 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/notes/2026/note-building-a-bigger-project.jpg&quot; alt=&quot;Building a bigger project&quot; /&gt;
&lt;p&gt;I have this itch to build something really ambitious. I mean, what’s the point in not tackling something beyond my current capability? So I will, and I’ll build it the way I would build it at work, that is, by hand, with frustration and delight.&lt;/p&gt;
&lt;p&gt;The only things I’ll likely use AI assisted dev for will be the JavaScript stuff, which is an area I have zero know how of. I’m comfortable building with Terraform, Python and shell scripting on top of GCP.&lt;/p&gt;
&lt;p&gt;Some of the technology I’ll build will be stuff I’ve never built before so it will be interesting. Such as an ingest pipeline. I’ll build these at a smaller scale as a learning exercise, documenting as I go, before taking on the next challenge such as ETL and so on and so on.&lt;/p&gt;
&lt;p&gt;Breaking it into small standalone experiments should work particularly well here.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;API ingestion → GCS&lt;/li&gt;
&lt;li&gt;GCS → BigQuery&lt;/li&gt;
&lt;li&gt;incremental ETL&lt;/li&gt;
&lt;li&gt;static JSON publishing&lt;/li&gt;
&lt;li&gt;Astro visualisation&lt;/li&gt;
&lt;li&gt;client-side filtering&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These can each become a self-contained mini-project. Then the eventual dashboard becomes an integration exercise rather than learning all these things simultaneously, which can be overwhelming.&lt;/p&gt;
&lt;p&gt;I won’t rush to build everything, I’ll take my time as I want the knowledge to embed.&lt;/p&gt;</content:encoded><category>api</category><category>data</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/notes/2026/note-building-a-bigger-project.jpg" length="0" type="image/jpeg"/></item><item><title>Homepage Now Playing Widget</title><link>https://elliotx.com/projects/2026/homepage-now-playing</link><guid isPermaLink="true">https://elliotx.com/projects/2026/homepage-now-playing</guid><description>A bigger, two-column now-playing feature for the homepage, real album art, an accent colour pulled from the artwork, and a marquee for titles too long to fit.</description><pubDate>Fri, 28 Aug 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-heroimage-homepage-nowplaying.jpg&quot; alt=&quot;An illustration of a turntable streaming coloured data waves into a bar chart&quot; /&gt;
&lt;p&gt;UPDATE: As of October 2026 this widget has been retired and is no longer on the site. This write-up is kept as a record of how it was built.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://elliotx.com/about&quot;&gt;/about&lt;/a&gt; page has had a small “now playing” widget for a while displaying album art, track, artist, but nothing more. This is the bigger sibling to that: a two-column feature on the homepage itself, pulling from the same &lt;a href=&quot;https://elliotx.com/projects/2026/building-the-now-playing-widget&quot;&gt;last.fm-backed Cloud Run service&lt;/a&gt;, just asking more of it.&lt;/p&gt;
&lt;h2 id=&quot;layout&quot;&gt;Layout&lt;/h2&gt;
&lt;p&gt;Left side is the current (or last-played) track: bigger album art, a pulsing live indicator when something’s actually playing, and a decorative equaliser that animates only while live and freezes into static bars otherwise it’s not reacting to real audio, so it doesn’t pretend to. Right side is the four most recent tracks, thumbnails and all, each with a small muted relative timestamp (&lt;code&gt;6m&lt;/code&gt;, &lt;code&gt;23m&lt;/code&gt;) rather than a rank number, since the list order already makes recency obvious.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/projects/2026/project-homepage-nowplaying-widget-1337.webp&quot; alt=&quot;image&quot; srcset=&quot;/thumbs/images/projects/2026/project-homepage-nowplaying-widget-480.webp 480w, /thumbs/images/projects/2026/project-homepage-nowplaying-widget-960.webp 960w, /thumbs/images/projects/2026/project-homepage-nowplaying-widget-1337.webp 1337w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1337&quot; height=&quot;384&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; data-full=&quot;/images/projects/2026/project-homepage-nowplaying-widget.png&quot;&gt;&lt;/p&gt;
&lt;p&gt;One thing that’s deliberately missing: a scrub bar. Last.fm’s &lt;code&gt;user.getrecenttracks&lt;/code&gt; endpoint tells you &lt;em&gt;what’s&lt;/em&gt; playing, never &lt;em&gt;how far into it&lt;/em&gt;, no position, no duration. A progress bar would have to fake a number, so it isn’t there.&lt;/p&gt;
&lt;h2 id=&quot;extending-the-api-without-breaking-the-existing-widget&quot;&gt;Extending the API without breaking the existing widget&lt;/h2&gt;
&lt;p&gt;The backend originally fetched a single track (&lt;code&gt;limit=1&lt;/code&gt;) and returned one flat object. Bumping that to &lt;code&gt;limit=4&lt;/code&gt; and adding a &lt;code&gt;recentTracks&lt;/code&gt; array to the response was enough to power the whole homepage feature, while the existing &lt;code&gt;/about&lt;/code&gt; widget — which only reads the top-level fields — never had to change at all.&lt;/p&gt;
&lt;h2 id=&quot;polling-without-hammering-the-dom&quot;&gt;Polling, without hammering the DOM&lt;/h2&gt;
&lt;p&gt;The widget polls every 60 minutes so a track change shows up without a refresh, pausing entirely while the tab is backgrounded and refreshing immediately the moment it’s focused again. I played with different timings on this, from once very 60 seconds, to every 5 seconds, but polling that often was quietly restarting the &lt;em&gt;entire&lt;/em&gt; card, including an in-progress title animation, on every single tick, even when the track hadn’t changed. The fix was to key the render on &lt;code&gt;track::artist::isPlaying&lt;/code&gt; and skip the rebuild entirely when nothing meaningful changed, only patching the “X min ago” text in place.&lt;/p&gt;
&lt;p&gt;In the end I settled on polling every 60 minutes as this is just an example of what this function looks like. It’s not critical to have constant polling for this use case, and don’t forget the Cloud Run function is running with each request so there’s a £ cost. By all means shorten the polling time and play with your heart’s content, but also keep an eye on your billing account! 🤣&lt;/p&gt;
&lt;h2 id=&quot;an-accent-colour-pulled-from-the-artwork&quot;&gt;An accent colour pulled from the artwork&lt;/h2&gt;
&lt;p&gt;The dot and the equaliser bars borrow a colour sampled straight from the currently-playing album art, drawn to a tiny offscreen canvas, averaged, then desaturated and clamped to a legible lightness range so it reads as a subtle tint rather than a raw, sometimes-neon pixel average. It falls back to the site’s normal accent colour if the sample ever fails.&lt;/p&gt;
&lt;h2 id=&quot;a-marquee-for-long-titles&quot;&gt;A marquee for long titles&lt;/h2&gt;
&lt;p&gt;Long titles truncate with an ellipsis by default. If the title is genuinely too long to fit, it scrolls: a 10-second pause, a slow scroll to reveal the end, a short pause, scroll back, repeat. It’s built on the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Web Animations API&lt;/a&gt; rather than a CSS &lt;code&gt;@keyframes&lt;/code&gt; rule, since the scroll distance, and how long that leg should take at a steady, readable pace, depends on exactly how much a given title overflows, which isn’t knowable until it’s actually laid out.&lt;/p&gt;
&lt;p&gt;The one real bug here: easing belongs on each keyframe, not in the animation’s options. Setting a single top-level &lt;code&gt;ease-in-out&lt;/code&gt; applies that curve across the &lt;em&gt;entire&lt;/em&gt; multi-segment timeline — pause, scroll, pause, scroll — which badly warps a long pause into lasting far longer than intended, since ease-in-out starts slow. Moving the easing onto the individual keyframes (each one governing just its own segment) fixed it. Caught by literally sitting a headless browser in front of it for a minute and watching the transform values, not by reading the code.&lt;/p&gt;
&lt;h2 id=&quot;small-things-that-add-up&quot;&gt;Small things that add up&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;album art gets a graceful &lt;code&gt;onerror&lt;/code&gt; fallback to a placeholder, Last.fm doesn’t always have art at every size for every track&lt;/li&gt;
&lt;li&gt;a 1px translucent border plus a soft shadow gives pale covers enough separation from a pale background without turning the card into a floating tile&lt;/li&gt;
&lt;li&gt;&lt;code&gt;min-width: 0&lt;/code&gt; on the grid/flex containers around the title, because the default &lt;code&gt;min-width: auto&lt;/code&gt; was letting a long nowrap title blow straight through its column instead of respecting the ellipsis meant to catch it&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Along the way, testing this also turned up an unrelated site-wide bug: the service worker was treating any cross-origin request whose path happened to be &lt;code&gt;/&lt;/code&gt;, including this API, as a same-origin page request, caching live third-party data it had no business caching. Worth fixing regardless of this widget, but it’s what surfaced it.&lt;/p&gt;</content:encoded><category>api</category><category>astro</category><category>last-fm</category><category>music</category><category>technology</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/projects/2026/project-heroimage-homepage-nowplaying.jpg" length="0" type="image/jpeg"/></item><item><title>Weekly Top Artists</title><link>https://elliotx.com/projects/2026/weekly-top-artists</link><guid isPermaLink="true">https://elliotx.com/projects/2026/weekly-top-artists</guid><description>A dependency-free Last.fm chart built to show listening history.</description><pubDate>Tue, 25 Aug 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-last-fm-data-viz.jpg&quot; alt=&quot;Weekly Top Artists&quot; /&gt;
</content:encoded><category>api</category><category>astro</category><category>data-visualisation</category><category>last-fm</category><category>music</category><category>python</category><category>svg</category><category>technology</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/projects/2026/project-last-fm-data-viz.jpg" length="0" type="image/jpeg"/></item><item><title>Has AI Gone Rogue?</title><link>https://elliotx.com/notes/2026/has-ai-gone-rogue</link><guid isPermaLink="true">https://elliotx.com/notes/2026/has-ai-gone-rogue</guid><description>What&apos;s the reality behind the headlines?</description><pubDate>Mon, 24 Aug 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/notes/2026/note-has-ai-gone-rogue.jpg&quot; alt=&quot;Has AI Gone Rogue?&quot; /&gt;
&lt;p&gt;With the uptick in AI getting out of control lately, it begs the question why? What’s really going on? There’s an interesting piece from Cal Newport on his website: &lt;a href=&quot;https://calnewport.com/has-ai-gone-rogue/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Has AI Gone Rogue?&lt;/a&gt;&lt;/p&gt;</content:encoded><category>ai</category><category>llm</category><category>technology</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/notes/2026/note-has-ai-gone-rogue.jpg" length="0" type="image/jpeg"/></item><item><title>Last.fm Dashboard</title><link>https://elliotx.com/notes/2026/simple-last-fm-dashboard</link><guid isPermaLink="true">https://elliotx.com/notes/2026/simple-last-fm-dashboard</guid><description>Creating a simple dashboard</description><pubDate>Wed, 19 Aug 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/notes/2026/note-heroimage-simple-last-fm-dashboard.jpg&quot; alt=&quot;Last.fm Dashboard&quot; /&gt;
&lt;p&gt;I have to admit that I’m a bit obsessed now with building something more than the Now Playing widget. I have a whole API to play with so ideas have been churning away. However with something more ambitious comes more complexity.&lt;/p&gt;
&lt;p&gt;Here’s a quick architecture of what I think is a simple dashboard.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/notes/2026/note-simple-last-fm-dashboard-1310.webp&quot; alt=&quot;cloud architecture&quot; srcset=&quot;/thumbs/images/notes/2026/note-simple-last-fm-dashboard-480.webp 480w, /thumbs/images/notes/2026/note-simple-last-fm-dashboard-960.webp 960w, /thumbs/images/notes/2026/note-simple-last-fm-dashboard-1310.webp 1310w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1310&quot; height=&quot;816&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; data-full=&quot;/images/notes/2026/note-simple-last-fm-dashboard.jpg&quot;&gt;&lt;/p&gt;
&lt;p&gt;It’s not final as I’m still pondering things and playing with the API along the way. But I think I’m getting carried away with this as it involves doing some ETL and building a pipeline to support it.&lt;/p&gt;
&lt;p&gt;Back to basics.&lt;/p&gt;
&lt;p&gt;Looking at the Last.fm documentation it looks like there are methods with aggregated data which might help with the simplicity I’m after. I’ll play with this a bit and figure something out. The more I think about it the more this feels like a weekend project.&lt;/p&gt;</content:encoded><category>api</category><category>dashboard</category><category>lastfm</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/notes/2026/note-heroimage-simple-last-fm-dashboard.jpg" length="0" type="image/jpeg"/></item><item><title>Grafana Network Rail</title><link>https://elliotx.com/notes/2026/grafana-network-rail</link><guid isPermaLink="true">https://elliotx.com/notes/2026/grafana-network-rail</guid><description>This is the kind of thing that makes me fall in love with data</description><pubDate>Sun, 16 Aug 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/notes/2026/note-grafana-rail-dashboard-2.jpg&quot; alt=&quot;Grafana Network Rail&quot; /&gt;
&lt;p&gt;Trawling through data one evening I came across this &lt;a href=&quot;https://grafana.traini.ac/public-dashboards/fb3b963903244df8bae5f5f757d34266?from=now%2Fd&amp;#x26;to=now&amp;#x26;timezone=Europe%2FLondon&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;fascinating dashboard&lt;/a&gt; someone created using Grafana. It looks at various Network Rail data, all on one page. There are lots of amazing details here, and it’s the kind of data and tech I love digging into.&lt;/p&gt;
&lt;p&gt;I’ve never used Grafana before to create any data viz, so I find it intriguing. While digging around I came across &lt;a href=&quot;https://play.grafana.org/d/to6j8mh/grafana-play-home?from=now-6h&amp;#x26;to=now&amp;#x26;timezone=utc&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Grafana play&lt;/a&gt;, a public and completely free sandbox to play in. Amazing. I know where I’m spending my free time.&lt;/p&gt;</content:encoded><category>dashboard</category><category>data</category><category>data-viz</category><category>grafana</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/notes/2026/note-grafana-rail-dashboard-2.jpg" length="0" type="image/jpeg"/></item><item><title>Rowing</title><link>https://elliotx.com/notes/2026/rowing</link><guid isPermaLink="true">https://elliotx.com/notes/2026/rowing</guid><description>Creating a rowing logbook</description><pubDate>Thu, 13 Aug 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/notes/2026/note-rowing.jpg&quot; alt=&quot;Rowing&quot; /&gt;
&lt;p&gt;A thought came to me in the middle of the night while I tried to get back to sleep, (the warm weather has been making this a little challenging).&lt;/p&gt;
&lt;p&gt;I’ve been using a Concept2 RowERG on and off for a while, and having sustained a shoulder injury for a while the rower started to gather some dust. I’m not 100%, but I can begin to row again. The problem is I can’t seem to kickstart the habit and sustain regular exercise.&lt;/p&gt;
&lt;p&gt;So I began thinking about APIs. I usually try and think about something more mundane if I need to sleep, like gardening or interior design…&lt;/p&gt;
&lt;p&gt;I’m wondering if making myself accountable with a public logbook would help me get back into rowing on a regular basis. Possibly, or maybe I’m just interested in the novelty of creating something that may be a passing fancy.&lt;/p&gt;
&lt;p&gt;I don’t want to just create a static page of logbook entries like a web spreadsheet. Who would be interested in that? The idea of that actually makes me nod off.&lt;/p&gt;
&lt;p&gt;Enter the &lt;a href=&quot;https://log.concept2.com/developers/documentation/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Concept2 Logbook API&lt;/a&gt;!&lt;/p&gt;</content:encoded><category>api</category><category>logbook</category><category>sport</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/notes/2026/note-rowing.jpg" length="0" type="image/jpeg"/></item><item><title>Building the Now Playing widget</title><link>https://elliotx.com/projects/2026/building-the-now-playing-widget</link><guid isPermaLink="true">https://elliotx.com/projects/2026/building-the-now-playing-widget</guid><description>How the &quot;Now playing&quot; widget was built.</description><pubDate>Thu, 13 Aug 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/projects/2026/project-heroimage-last-fm-now-playing-app-2.jpg&quot; alt=&quot;Building the Now Playing widget&quot; /&gt;
&lt;p&gt;UPDATE: As of October 2026 this widget has been retired and is no longer on the site. This write-up is kept as a record of how it was built.&lt;/p&gt;
&lt;p&gt;If you’ve visited my &lt;a href=&quot;https://elliotx.com/about&quot;&gt;/about&lt;/a&gt; page, you’ve probably noticed a small widget showing whatever I’m currently listening to (or the last thing I played). The widget pulls my playing activity from Last.fm. The music source can be anything which scrobbles data to my Last.fm account. In this case it’s either a Roon server or Spotify.&lt;/p&gt;
&lt;p&gt;It’s a lightweight piece of infrastructure enabling a tiny Cloud Run service/container which uses a simple CI/CD pipeline.&lt;/p&gt;
&lt;h2 id=&quot;why-does-this-exist-in-the-first-place&quot;&gt;Why does this exist in the first place?&lt;/h2&gt;
&lt;p&gt;I listen to a lot of music and sometimes I’ll visit my Last.fm profile to look at the basic statistics around my playing habits. For a free account there are some basic reports too and if you subscribe, for s small monthly fee, you can access more advanced reporting. So this got me thinking, “what can I build using my data?”&lt;/p&gt;
&lt;h3 id=&quot;how-does-it-work&quot;&gt;How does it work?&lt;/h3&gt;
&lt;p&gt;Everything is driven by APIs, which is the entrypoint to the data. If your app logs your data, all it’s doing is using an API to send data (events) as a data source to the Last.fm endpoint. The data is saved to a database which is then queried by the front facing Last.fm website you use to browse your listening.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.last.fm/api&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Last.fm has an API&lt;/a&gt; that anyone can use. There are numerous sites and apps which enable all kinds of reports and visualisations based on your music listening. All these do is use the published endpoints to query the data and present it to you in different ways. That’s pretty much it.&lt;/p&gt;
&lt;p&gt;I was curious so I got myself an API key and started querying endpoints using &lt;a href=&quot;https://www.postman.com/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Postman&lt;/a&gt;. The thing I like about Postman is that even with a free account you can get up and running really quickly when playing with endpoints.&lt;/p&gt;
&lt;p&gt;Read more about the &lt;a href=&quot;https://www.last.fm/api/intro&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Last.fm API and methods&lt;/a&gt; offered.&lt;/p&gt;
&lt;p&gt;As an exercise I thought about what I would build to dip my toe in, hence the “Now Playing” app. The eventual idea is to use the API to get all my historical data and do something interesting with it. Still figuring out that bit.&lt;/p&gt;
&lt;h2 id=&quot;cloud-architecture&quot;&gt;Cloud Architecture&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/projects/2026/project-last-fm-now-playing-app-architecture-1408.webp&quot; alt=&quot;cloud architecture&quot; srcset=&quot;/thumbs/images/projects/2026/project-last-fm-now-playing-app-architecture-480.webp 480w, /thumbs/images/projects/2026/project-last-fm-now-playing-app-architecture-960.webp 960w, /thumbs/images/projects/2026/project-last-fm-now-playing-app-architecture-1408.webp 1408w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1408&quot; height=&quot;768&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; data-full=&quot;/images/projects/2026/project-last-fm-now-playing-app-architecture.jpg&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;the-now-playing-app&quot;&gt;The Now Playing app&lt;/h2&gt;
&lt;p&gt;The Now Playing app calls a small JSON API that wraps &lt;a href=&quot;https://last.fm&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;last.fm&lt;/a&gt;’s &lt;code&gt;user.getrecenttracks&lt;/code&gt; endpoint:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;GET https://lastfm-now-playing-ei7ug2a2za-uw.a.run.app/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;isPlaying&quot;: true,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;track&quot;: &quot;Ms. Tundra&quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;artist&quot;: &quot;Ne-Yo&quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;album&quot;: &quot;Ms. Tundra&quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;albumArt&quot;: &quot;https://lastfm-img.freetls.fastly.net/i/u/174s/....jpg&quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;url&quot;: &quot;https://www.last.fm/music/Ne-Yo/_/Ms.+Tundra&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The frontend just polls that and renders it. All the actual interesting decisions live in the service behind it.&lt;/p&gt;
&lt;h3 id=&quot;what-are-cloud-run-functions-and-cloud-run&quot;&gt;What are Cloud Run functions and Cloud Run?&lt;/h3&gt;
&lt;p&gt;First, let’s define what these services are and the differences between them.&lt;/p&gt;
&lt;p&gt;Google &lt;a href=&quot;https://cloud.google.com/functions&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Cloud Run functions&lt;/a&gt; and &lt;a href=&quot;https://cloud.google.com/run&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Cloud Run&lt;/a&gt; are built on the exact same underlying infrastructure, Cloud Run, meaning Cloud Run functions is essentially a wrapper around Cloud Run to simplify developer workflows. While Cloud Run functions is built on top of Cloud Run, they serve slightly different operational processes.&lt;/p&gt;
&lt;p&gt;Cloud Run functions uses &lt;a href=&quot;https://cloud.google.com/build&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Cloud Build&lt;/a&gt; to package your source code into a container image and automatically deploys it as a Cloud Run service.&lt;/p&gt;
&lt;p&gt;You’ll choose this when you want to write simple, single-purpose snippet functions or background event processors (for example handling Cloud Storage file uploads or Pub/Sub events) without managing web servers.&lt;/p&gt;
&lt;p&gt;Plus if you prefer direct source-code deployment via Google Cloud Console, gcloud, or Firebase CLI then you would consider Cloud Run functions.&lt;/p&gt;
&lt;h3 id=&quot;when-to-choose-cloud-run&quot;&gt;When to choose Cloud Run&lt;/h3&gt;
&lt;p&gt;If you have a full web application, custom web framework (like Express, Django, or FastAPI), or existing Docker containers then consider Cloud Run. And if you need control over system-level dependencies, native libraries, custom runtime environments, or listening on custom ports, then Cloud Run should be a consideration, especially if you require support for web protocols beyond standard HTTP/CloudEvents (such as gRPC or WebSockets).&lt;/p&gt;
&lt;h3 id=&quot;cloud-run-functions&quot;&gt;Cloud Run functions&lt;/h3&gt;
&lt;p&gt;A plain Cloud Run &lt;strong&gt;service&lt;/strong&gt; does exactly what I wanted: build an image anywhere, push it to a registry, tell Cloud Run “run this.” So GitHub Actions builds the image, pushes it to Artifact Registry, and Cloud Run runs whatever’s there.&lt;/p&gt;
&lt;h2 id=&quot;no-long-lived-credentials-anywhere&quot;&gt;No long-lived credentials anywhere&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;GitHub → GCP&lt;/strong&gt;: rather than a downloadable service account key sitting in a GitHub secret forever, the pipeline uses &lt;a href=&quot;https://docs.cloud.google.com/iam/docs/workload-identity-federation&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Workload Identity Federation&lt;/a&gt;. GitHub Actions presents its own short-lived OIDC token for the workflow run; GCP is configured to trust that token, scoped to this exact repo, and exchanges it for temporary access as a narrowly-scoped deploy service account. No key ever leaves GCP, and there’s nothing long-lived to leak.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;API key → app&lt;/strong&gt;: the last.fm API key never touches application code. Cloud Run’s native Secret Manager integration mounts the secret as an environment variable at the platform level, so the app just reads &lt;code&gt;process.env.LASTFM_API_KEY&lt;/code&gt; like any other environment variable — no Secret Manager SDK calls, no key baked into the image, no key in git or in CI logs.&lt;/p&gt;
&lt;h2 id=&quot;the-app-itself&quot;&gt;The app itself&lt;/h2&gt;
&lt;p&gt;Deliberately boring: plain Node/TypeScript with zero runtime dependencies. Node’s built-in &lt;code&gt;http&lt;/code&gt; module and global &lt;code&gt;fetch&lt;/code&gt; are enough for one route, so that’s all it uses.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;an HTTP server that sets permissive CORS headers (it’s public, read-only data, so allowing any origin is fine) and routes &lt;code&gt;GET /&lt;/code&gt; to a handler&lt;/li&gt;
&lt;li&gt;a last.fm client that calls &lt;code&gt;user.getrecenttracks&lt;/code&gt;, maps the response into the JSON shape above, and keeps a 20-second in-memory cache, short enough that the data stays fresh, long enough to absorb both last.fm’s own rate limits and any burst of visitor traffic without hammering its API&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;a-container-with-almost-nothing-in-it&quot;&gt;A container with (almost) nothing in it&lt;/h2&gt;
&lt;p&gt;The Dockerfile is a two-stage build. The first stage installs dependencies and compiles TypeScript on &lt;code&gt;node:24-slim&lt;/code&gt;. The second stage copies only the compiled &lt;code&gt;dist/&lt;/code&gt; output into a &lt;a href=&quot;https://github.com/GoogleContainerTools/distroless&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;distroless&lt;/a&gt; Node 24 runtime image, running as a non-root user.&lt;/p&gt;
&lt;p&gt;The reasoning here goes beyond “smaller is nicer”: &lt;code&gt;node:24-slim&lt;/code&gt; still bundles npm, and everything npm itself depends on whether or not the final container ever runs it. A vulnerability scanner will happily keep flagging CVEs in tooling that never actually executes at runtime. Shipping only the compiled output on a distroless base means there’s no npm, no shell, and no package manager in the thing that’s actually running in production, which in turn presents a smaller attack surface and a much quieter security scan.&lt;/p&gt;
&lt;h2 id=&quot;cicd&quot;&gt;CI/CD&lt;/h2&gt;
&lt;p&gt;Two GitHub Actions workflows do the work, written to be reusable across future apps in the same repo rather than one-off:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a &lt;strong&gt;lint workflow&lt;/strong&gt; — format check, ESLint, &lt;code&gt;tsc --noEmit&lt;/code&gt;, and &lt;code&gt;npm audit&lt;/code&gt; (failing on high/critical), runs on every PR&lt;/li&gt;
&lt;li&gt;a &lt;strong&gt;deploy workflow&lt;/strong&gt; — authenticate via WIF, build the image, scan it with &lt;a href=&quot;https://github.com/aquasecurity/trivy&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Trivy&lt;/a&gt;, push to Artifact Registry, then &lt;code&gt;gcloud run deploy&lt;/code&gt;, runs on push to &lt;code&gt;main&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The Trivy scan reports rather than blocks. Most findings in a container image land in the base image’s OS layer, which I don’t control and can’t patch faster than its maintainer does. So the base image is pinned by digest, and Dependabot proposes updates to that pin on its own schedule instead of trying to fix findings by hand.&lt;/p&gt;
&lt;p&gt;Beyond that: &lt;a href=&quot;https://codeql.github.com/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;CodeQL&lt;/a&gt; runs static analysis on push/PR plus a weekly scheduled scan (so newly-disclosed CVEs in unchanged code still get caught), dependency review flags newly-introduced vulnerable dependencies in every PR diff, and Dependabot opens weekly PRs for outdated npm packages, the base Docker image, and GitHub Action versions.&lt;/p&gt;
&lt;h2 id=&quot;infrastructure-kept-separate&quot;&gt;Infrastructure, kept separate&lt;/h2&gt;
&lt;p&gt;The GCP side, the Cloud Run service, the Workload Identity Federation pool, the deploy service account, the Secret Manager container, is provisioned by Terraform in a separate infrastructure repo, not alongside the app code. A few choices worth calling out:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the Cloud Run service is bootstrapped with Google’s public placeholder image, so the very first &lt;code&gt;terraform apply&lt;/code&gt; succeeds before any real image has ever been pushed, with &lt;code&gt;lifecycle.ignore_changes&lt;/code&gt; on the image field so CI’s real deploys don’t get reverted the next time Terraform plans&lt;/li&gt;
&lt;li&gt;the Workload Identity Pool is shared across the whole apps repo rather than created per-app, since WIF trust is repo-scoped rather than path-scoped, each app just gets its own narrowly-scoped deploy service account bound to that shared pool&lt;/li&gt;
&lt;li&gt;the runtime service account has &lt;code&gt;secretAccessor&lt;/code&gt; on exactly one secret, nothing project-wide&lt;/li&gt;
&lt;li&gt;Terraform manages the Secret Manager &lt;em&gt;container&lt;/em&gt; for the API key, never the value itself, the key is set out-of-band via &lt;code&gt;gcloud secrets versions add&lt;/code&gt;, so it never ends up in Terraform state or in git history&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;what-id-reuse-next-time&quot;&gt;What I’d reuse next time&lt;/h2&gt;
&lt;p&gt;The repo this lives in (&lt;code&gt;elliotx-website-apps&lt;/code&gt;) is deliberately structured to hold more than one small backend service over time, one self-contained folder per app, sharing the deploy/lint workflow pattern rather than each reinventing it. Adding a second app should mostly be: copy a folder, copy a thin per-app workflow file, and point a new Terraform module at the existing shared WIF pool. That was the actual goal of building this for something as small as a now-playing badge, not because the widget needed it, but because the pattern was worth having.&lt;/p&gt;
&lt;p&gt;Now that this is running I think this is something that can be built on in the future. I would like to get historical data and produce some kind of &lt;a href=&quot;https://www.domo.com/glossary/what-is-data-visualization&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;data viz&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Source: &lt;a href=&quot;https://github.com/elliotrichards/elliotx-website-apps&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;github.com/elliotrichards/elliotx-website-apps&lt;/a&gt;&lt;/p&gt;</content:encoded><category>api</category><category>ci-cd</category><category>cloud-run</category><category>cors</category><category>gcp</category><category>infrastructure</category><category>last-fm</category><category>music</category><category>technology</category><category>typescript</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/projects/2026/project-heroimage-last-fm-now-playing-app-2.jpg" length="0" type="image/jpeg"/></item><item><title>Now Playing</title><link>https://elliotx.com/notes/2026/now-playing</link><guid isPermaLink="true">https://elliotx.com/notes/2026/now-playing</guid><description>Creating a Now Playing widget</description><pubDate>Tue, 11 Aug 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/notes/2026/note-now-playing.jpg&quot; alt=&quot;Now Playing&quot; /&gt;
&lt;p&gt;I love to listen to music, so it got me thinking. What kind of things can be built with APIs to track and display what I’m listening to at any given moment?&lt;/p&gt;
&lt;p&gt;So, I think the first application I’m going to build is a “Now Playing” widget for this site. Keep in mind this site is purely static HTML hosted from a Google Cloud Storage bucket, so I can’t run Astro server-side endpoints (src/pages/api/…) at build time to reflect real-time playback.&lt;/p&gt;
&lt;p&gt;I think I’ll task Claude with this project and see what happens.&lt;/p&gt;
&lt;p&gt;UPDATE: This widget has been created and is currently on the &lt;a href=&quot;https://elliotx.com/about&quot;&gt;/about&lt;/a&gt; page. This is the initial build so styling and placement will likely will be tweaked. If you’re curious, read &lt;a href=&quot;../../../projects/2026/building-the-now-playing-widget/&quot;&gt;Building the Now Playing widget&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;UPDATE: As of October 2026 the widget has been retired and is no longer on the site.&lt;/p&gt;</content:encoded><category>music</category><category>widget</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/notes/2026/note-now-playing.jpg" length="0" type="image/jpeg"/></item><item><title>Fooled by AI slop</title><link>https://elliotx.com/notes/2026/fooled-by-ai-slop</link><guid isPermaLink="true">https://elliotx.com/notes/2026/fooled-by-ai-slop</guid><description>I had no idea I was being hoodwinked</description><pubDate>Sun, 09 Aug 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/notes/2026/note-fooled-by-ai-slop.jpg&quot; alt=&quot;Fooled by AI slop&quot; /&gt;
&lt;p&gt;I like a wide range of music; pop, rock, country, hip-hop and more besides. So when a country rap song was suggested to me by Spotify’s algorithm, I didn’t think twice. I liked the music, but then something bothered me. Track after track started to sound a bit “samey”.&lt;/p&gt;
&lt;p&gt;I wanted to know more about the artist so I looked at their music catalogue to play something else. Then something didn’t feel quite right. This “artist” had released over 10 albums this year alone. Over 10.&lt;/p&gt;
&lt;p&gt;I did some light digging and saw that the “artist” in question didn’t have much of a digital footprint beyond TikTok, and as I searched around, ‘AI’ kept getting referenced. Was this created using gen AI?&lt;/p&gt;
&lt;p&gt;The “artist” in question has been cleverly manufactured. Even now, I’m listening to it, trying to pick out noticeable AI artefacts, but I’m struggling to. And I feel guilty for listening to it. There’s clearly a lot of electronic jiggery in the music anyway, which sounds familiar to “real” recordings, so I failed to distinguish anything out of the ordinary till now. Then I noticed a truck load of other made up artists and music. I think this is what they call &lt;a href=&quot;https://en.wikipedia.org/wiki/AI_slop&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;AI Slop&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To distinguish the real from the not so real, Spotify not long ago introduced a new badge, &lt;a href=&quot;https://support.spotify.com/uk/article/verified-by-spotify/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;“Verified by Spotify”&lt;/a&gt;, in an effort to root out the not so real from legitimate artists.&lt;/p&gt;
&lt;p&gt;Then they had a press release: &lt;a href=&quot;https://newsroom.spotify.com/2025-09-25/spotify-strengthens-ai-protections/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Spotify Strengthens AI Protections for Artists, Songwriters, and Producers&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I can only think the slop deluge is financially motivated, flooding the market with songs/albums to get as many streams as possible. But at what cost to real artists that struggle to get recognised or make a living? I wonder how many others are being deceived by it and enjoy it or don’t know.&lt;/p&gt;</content:encoded><category>ai</category><category>ai-slop</category><category>content</category><category>gen-ai</category><category>music</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/notes/2026/note-fooled-by-ai-slop.jpg" length="0" type="image/jpeg"/></item><item><title>Building a new website</title><link>https://elliotx.com/projects/2026/building-a-new-website</link><guid isPermaLink="true">https://elliotx.com/projects/2026/building-a-new-website</guid><description>My first post is about how this personal website came to be.</description><pubDate>Sat, 01 Aug 2026 00:00:00 GMT</pubDate><content:encoded>&lt;img src=&quot;https://elliotx.com/images/projects/2026/building-this-website-hero-image-3.jpg&quot; alt=&quot;Building a new website&quot; /&gt;
&lt;h2 id=&quot;part-1-start-at-the-beginning-where-else&quot;&gt;Part 1: Start at the beginning, where else?&lt;/h2&gt;
&lt;p&gt;I’ve tinkered with site building on and off over the years mainly for fun and out of curiosity, but have never really needed a website. I still remember somewhat fondly building pages with raw HTML back in the 90s. Then I remember using Macromedia’s Dreamweaver to build dynamic and static sites. Then came the likes of WordPress (WP) and Drupal, but that was pretty much it.&lt;/p&gt;
&lt;p&gt;Except now I wanted a site to play with.&lt;/p&gt;
&lt;p&gt;So I used Google to find the quickest way to deploy the simplest kind of website, and that rabbit hole led me to static site generators (SSG). Among the most popular were &lt;a href=&quot;https://gohugo.io/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Hugo&lt;/a&gt;, &lt;a href=&quot;https://www.11ty.dev/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;11ty&lt;/a&gt;, &lt;a href=&quot;https://www.gatsbyjs.com/docs/glossary/static-site-generator/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Gatsby&lt;/a&gt;, &lt;a href=&quot;https://jekyllrb.com/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Jekyll&lt;/a&gt;, and &lt;a href=&quot;https://astro.build/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Astro&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I had never tried an SSG site before so this was new to me. If you don’t know what SSG is, read &lt;a href=&quot;https://www.cloudflare.com/learning/performance/static-site-generator/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;What is a static site generator?&lt;/a&gt; to learn more. I’ll wait.&lt;/p&gt;
&lt;p&gt;I wanted to learn something new, something different, which is why hosting static files intrigued me, but I still hasn’t grasped how it all worked. Just bits here and bits there.&lt;/p&gt;
&lt;p&gt;I worked out that my site needed to:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;use markdown&lt;/li&gt;
&lt;li&gt;be fast&lt;/li&gt;
&lt;li&gt;be scalable&lt;/li&gt;
&lt;li&gt;use version control&lt;/li&gt;
&lt;li&gt;use a suitable host&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;putting-the-jam-in-jamstack&quot;&gt;Putting the JAM in JAMstack&lt;/h3&gt;
&lt;p&gt;New word alert “&lt;a href=&quot;https://jamstack.org/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;JAMstack&lt;/a&gt;”!&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Jamstack is an architectural approach that decouples the web experience layer from data and business logic, improving flexibility, scalability, performance, and maintainability. Jamstack removes the need for business logic to dictate the web experience. It enables a composable architecture for the web where custom logic and 3rd party services are consumed through APIs.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The first time I read that I didn’t quite get it. From what I understood, a lot of SSGs used the JAMstack framework. This was all new, and like anything new it was bewildering, shiny, different, and had its own learning curve and language.&lt;/p&gt;
&lt;p&gt;So putting these pieces together, what does a website look like? There’s no hard and fast rule which determines how this can be put together because as a technology it can be assembled in many ways targeting different platforms.&lt;/p&gt;
&lt;h2 id=&quot;part-2-my-architecture&quot;&gt;Part 2: My Architecture&lt;/h2&gt;
&lt;p&gt;As I worked my way through documentation, YouTube videos, and local installs on my local server it started to become clearer.&lt;/p&gt;
&lt;p&gt;In my mind building this site can be thought of as two distinct parts:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;infrastructure (infra)&lt;/li&gt;
&lt;li&gt;website application&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;infrastructure&quot;&gt;Infrastructure&lt;/h3&gt;
&lt;p&gt;Since I was opting to use static files with no client-side or server rendering, the files would be built then need to be hosted and delivered when a user requests it. They don’t want to wait more than a few seconds at the most, they want it now with minimal latency, wherever they happened to be in the world.&lt;/p&gt;
&lt;p&gt;There are many deployment options on offer which will take care of the underlying infra for you, thus removing this element. For example you can host static pages on &lt;a href=&quot;https://pages.cloudflare.com/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Cloudflare&lt;/a&gt;, &lt;a href=&quot;https://docs.gitlab.com/user/project/pages/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;GitLab Pages&lt;/a&gt;, &lt;a href=&quot;https://docs.github.com/en/pages&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;GitHub Pages&lt;/a&gt;, &lt;a href=&quot;https://static.app/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Static.app&lt;/a&gt;, &lt;a href=&quot;https://www.netlify.com/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Netlify&lt;/a&gt;, or &lt;a href=&quot;https://vercel.com/home&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Vercel&lt;/a&gt;. They work with Git so you can version control your files, and on merge configured runners will typically take care of the rest, pushing content to your preferred host. These platforms all vary on price too.&lt;/p&gt;
&lt;p&gt;Alternatively you can use a cloud provider such as AWS or GCP to host static files in a bucket, but you would need to build out this infra yourself. And since this was a static site learning exercise, this is the route I took.&lt;/p&gt;
&lt;p&gt;In terms of how the content flows from creating markdown using Visual Studio Code, to the published page, this is what I came up with:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://elliotx.com/thumbs/images/projects/2026/building-this-website-architecture-1600.webp&quot; alt=&quot;Colour image of the cloud architecture diagram illustrating how I built this website&quot; srcset=&quot;/thumbs/images/projects/2026/building-this-website-architecture-480.webp 480w, /thumbs/images/projects/2026/building-this-website-architecture-960.webp 960w, /thumbs/images/projects/2026/building-this-website-architecture-1600.webp 1600w&quot; sizes=&quot;(max-width: 768px) 100vw, 800px&quot; width=&quot;1693&quot; height=&quot;929&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; data-full=&quot;/images/projects/2026/building-this-website-architecture.jpg&quot;&gt;&lt;/p&gt;
&lt;p&gt;The underlying infra making all of this happen is built using &lt;a href=&quot;https://www.hashicorp.com/en/products/terraform&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Terraform&lt;/a&gt; &lt;a href=&quot;https://www.redhat.com/en/topics/automation/what-is-infrastructure-as-code-iac&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;(IaC)&lt;/a&gt; and kept in its own repo.&lt;/p&gt;
&lt;p&gt;If you’d like a little more detail on the infra buildout, this is what it looks like:
&lt;img src=&quot;https://elliotx.com/images/projects/2026/building-this-website-cloud-architecture.svg&quot; alt=&quot;Architecture diagram&quot;&gt;&lt;/p&gt;
&lt;p&gt;A static site on GCS, fronted by a global HTTPS load balancer with Cloud CDN, deployed by Cloud Build on every push to the site’s source repo (private). This repo owns the GCP networking, storage, and IAM — and now deploys itself too: infra changes plan on every pull request and apply on merge to &lt;code&gt;main&lt;/code&gt; via GitHub Actions, authenticated to GCP with no long-lived key.&lt;/p&gt;
&lt;p&gt;Diagram reads left→right within each row: the bucket is the origin, content is delivered to the browser through Cloud CDN and the load balancer, and a separate http-redirect-map / http-redirect-proxy / http-forwarding-rule chain answers port 80 on the same static IP and 301s to HTTPS.&lt;/p&gt;
&lt;p&gt;GitHub Actions (my website repo) exchanges a short-lived &lt;a href=&quot;https://openid.net/developers/how-connect-works/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;OIDC token&lt;/a&gt; with the &lt;a href=&quot;https://docs.cloud.google.com/iam/docs/manage-workload-identity-pools-providers&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Workload Identity Pool&lt;/a&gt; — no stored key — to impersonate terraform-ci, which runs &lt;code&gt;terraform apply&lt;/code&gt; against every resource in the dashed boundary, including its own WIF pool/provider and the cloud-build-sa block. &lt;code&gt;apply&lt;/code&gt; only runs after a human approves the production environment gate; IAM-role detail is listed on each service account rather than drawn as individual arrows to keep the chain legible.&lt;/p&gt;
&lt;h3 id=&quot;whats-outside-this-repo&quot;&gt;What’s outside this repo?&lt;/h3&gt;
&lt;p&gt;The Cloud Build trigger itself — there’s no &lt;code&gt;google_cloudbuild_trigger&lt;/code&gt; resource here. The GitHub connection and “build on push to main” wiring for the site is configured directly in Cloud Build, not Terraform.&lt;/p&gt;
&lt;p&gt;The production environment’s required-reviewer rule — a GitHub repo setting (Settings → Environments), not a google_* resource, so it’s the one piece of the infra pipeline’s safety gate Terraform can’t express even though it guards every apply.&lt;/p&gt;
&lt;p&gt;DNS — the A record pointing elliotx.com at lb-static-ip lives with the domain registrar, not GCP.&lt;/p&gt;
&lt;p&gt;The site itself — source, Astro config, and cloudbuild.yaml live in a separate, private GitHub repo.&lt;/p&gt;
&lt;h4 id=&quot;repo--resources&quot;&gt;Repo → resources&lt;/h4&gt;













































&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;File&lt;/th&gt;&lt;th&gt;Resources&lt;/th&gt;&lt;th&gt;Purpose&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;provider.tf&lt;/code&gt;&lt;/td&gt;&lt;td&gt;backend “gcs”, google / google-beta providers&lt;/td&gt;&lt;td&gt;state in a dedicated GCS bucket; project ‹gcp-project›, region us-west1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;storage.tf&lt;/code&gt;&lt;/td&gt;&lt;td&gt;google_storage_bucket, iam_member&lt;/td&gt;&lt;td&gt;public static-site bucket&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;main.tf&lt;/code&gt;&lt;/td&gt;&lt;td&gt;address, ssl cert, backend bucket, 2× url_map, 2× proxy, 2× forwarding_rule&lt;/td&gt;&lt;td&gt;Cloud CDN + LB, HTTP→HTTPS redirect&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;iam.tf&lt;/code&gt;&lt;/td&gt;&lt;td&gt;service_account, 2× iam_member&lt;/td&gt;&lt;td&gt;permissions for the Cloud Build deploy step&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;ci.tf&lt;/code&gt;&lt;/td&gt;&lt;td&gt;WIF pool + provider, terraform-ci SA, 6× project_iam_member, project_service&lt;/td&gt;&lt;td&gt;lets GitHub Actions authenticate keylessly and manage this repo’s own resources&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;.github/workflows/terraform.yml&lt;/code&gt;&lt;/td&gt;&lt;td&gt;plan (pull_request) + apply (push → main) jobs&lt;/td&gt;&lt;td&gt;runs terraform via WIF; apply gated by the production environment&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;output.tf&lt;/code&gt;&lt;/td&gt;&lt;td&gt;load_balancer_ip, terraform_ci_service_account_email, terraform_ci_workload_identity_provider&lt;/td&gt;&lt;td&gt;exposes values needed to wire up the workflow&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Keeping infra and website static files separate was a personal choice, there are no best practice rules that state you can’t keep it all together in a monorepo if you choose, it’s just down to what works best for you/team, or application. Sometimes one repo makes it easier to see everything in one place and make changes as needed, and sometimes you may just want to decouple them using polyrepos to clarify the way things are built, especially when using modules.&lt;/p&gt;
&lt;p&gt;My choice for two repos works because I did do a lot of experimentation with a few SSGs. The result of this meant I kept b0rking the directories and files, so it made sense to keep these separated, which made it easier to manage. Plus I intend to expand the infra in this particular project beyond this application so in my mind keeping it separate makes it simpler to work with.&lt;/p&gt;
&lt;h3 id=&quot;website-application&quot;&gt;Website application&lt;/h3&gt;
&lt;p&gt;I did initially start playing with Hugo and 11ty as I felt my way around the SSGs, but settled on Astro. The documentation and examples I learned from seemed more up to date and my progress was quicker with Astro, so I stuck with it. I did mess up my various SSGs installs so started from scratch many times, which was great as I could better learn how things were connected.&lt;/p&gt;
&lt;p&gt;The Astro look and feel was courtesy of many other themes I explored, so I did pick and choose bits from one, bits from another, and managed to cobble things together with a fair bit of trial and error.&lt;/p&gt;
&lt;p&gt;All posts are written in &lt;a href=&quot;https://www.markdownguide.org/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;markdown&lt;/a&gt; using Visual Studio Code, any editor will do however, I’m used to VS Code as this is what I use at work. Once I’ve previewed the markdown and I’m happy with the post, I’ll create a PR and merge to main. All content is stored in a GitHub repo.&lt;/p&gt;
&lt;p&gt;Because I’m using the &lt;a href=&quot;https://cloud.google.com/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Google Cloud Platform&lt;/a&gt; (GCP) I setup Cloud Build with GitHub to build the markdown files. Once merged Cloud Build will build the files and push to a Google Cloud Storage (GCS) bucket. Use Terraform infra repo to provision the Cloud Build service account (SA).&lt;/p&gt;
&lt;p&gt;Creating and merging PRs and watching Cloud Build work is quite satisfying the first dozen times or so. Don’t forget to point your domain if you’re using one to the load balancer (LB) IP address. Once fully propagated you should see the files being served up on your domain.&lt;/p&gt;
&lt;p&gt;With every thing in place the website has fared well. It has low latency and publishing new content is quick. But then I only have one post so far! Whether or not I’ll continue remains to be seen. I could decide to tear it all down with lessons learned.&lt;/p&gt;
&lt;h2 id=&quot;what-did-i-learn-from-this&quot;&gt;What did I learn from this?&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;I learned about JAMstack and the sheer variety of static site generators in the world.&lt;/li&gt;
&lt;li&gt;There are many static file hosts that can host files cheaper than using a cloud provider and will provide underlying infra and support for you.&lt;/li&gt;
&lt;li&gt;Make the choice for mono or polyrepo at the earliest stage and understand why you make the choice you do.&lt;/li&gt;
&lt;li&gt;Static site generators are not all built the same way and some mask complexity from the outset, so take time to read documentation and make your own notes along the way, it will save you from a lot of head scratching.&lt;/li&gt;
&lt;li&gt;I’m clearly influenced by the technology I use everyday at work such as GCP, Terraform, buckets, Cloud Build, and GitHub to name but a few things, but I shouldn’t feel married to the tech stack. There’s a wealth of alternatives to getting a static site up and running.&lt;/li&gt;
&lt;li&gt;Keep on top of your costs and billing. It’s easy to let this run away from you. I think (&lt;a href=&quot;https://www.finops.org/&quot; rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot;&gt;FinOps&lt;/a&gt;) should play a part in the running of your site.&lt;/li&gt;
&lt;li&gt;Keep yourself portable by ensuring your content is free to move at a moments notice if you want to change platforms.&lt;/li&gt;
&lt;/ol&gt;</content:encoded><category>astro</category><category>automation</category><category>cicd</category><category>cloud</category><category>engineering</category><category>gcp</category><category>github</category><category>pipeline</category><category>technology</category><category>terraform</category><category>website</category><author>Elliot Richards</author><enclosure url="https://elliotx.com/images/projects/2026/building-this-website-hero-image-3.jpg" length="0" type="image/jpeg"/></item></channel></rss>