apps / sports

sports.dancroak.com is a scoreboard and a news reader. I built it with Instinct (invite code), a personal AI assistant, using text messages.

What it shows

The front page lists games across football, baseball, hockey, soccer, and golf. Each row shows teams, score or start time, and a win probability from Kalshi market prices. A green dot marks a live game. A gray dot and "Final" mark a finished game.

A game page displays a probability chart, a timeline, and a written summary. The summary updates when key events occur, such as goals or penalties. Final games include US highlight videos and recap text. Team and venue pages include summaries and standings.

The board on a phone: a row for each game, with the league, the score, the clock, and a two-color probability bar A game page on a phone: North Carolina at Clemson, a win probability chart, and a written summary of the game so far

A second page displays sports news from RSS feeds.

Text messages as the interface

I directed the build over iMessage. I sent screenshots when a layout needed changes. The assistant edited templates and deployed updates.

I made product decisions, such as removing clutter and setting tap targets. The assistant made implementation choices. I inspect screenshots and the live site rather than code diffs.

Content updates

External content automation sends articles and summaries through a restricted SSH interface. The interface accepts named commands and JSON, not shell commands. The Go binary checks each input and writes to Postgres.

The app lists summaries that need an update. Each stored summary has a source key. A change to the source can queue another update.

I control access through the SSH key and the allowed commands. The application keeps its source in Sockeye and its data in Postgres.

The stack

A guest on the app host serves the site and runs the jobs. Caddy on that host receives traffic from the CDN and sends it to the active guest. Postgres runs on a separate database host. An operations host runs maintenance jobs, the content interface, and the deploy hook.

The graphic shows the application and its external interfaces. The two guest slots share Postgres. Only one slot receives public traffic.

Application architecture: visitors reach the CDN, then Caddy and the active sports guest on the app host. A second guest slot waits for the next deploy. Both slots use Postgres. External data feeds the app, a restricted content interface saves summaries, and the operations host sends backups to R2.

The application is one Go binary with hml templates. It runs as a uni guest: a unikernel with no operating system and no disk. In-memory caches keep upstream API calls off the request path.

The server streams score updates to browsers over Server-Sent Events (SSE):

func (h *handler) serveWake(w http.ResponseWriter, r *http.Request) {
	fl, ok := w.(http.Flusher)
	if !ok {
		http.Error(w, "streaming unsupported", 500)
		return
	}
	w.Header().Set("Content-Type", "text/event-stream")
	w.Header().Set("Cache-Control", "no-cache, no-store, no-transform")
	ch := wakeSubscribe()
	defer wakeUnsubscribe(ch)
	_, _ = io.WriteString(w, ": connected\n\n")
	fl.Flush()
	for {
		select {
		case <-r.Context().Done():
			return
		case <-h.stop:
			return
		case <-ch:
			_, _ = io.WriteString(w, "data: wake\n\n")
			fl.Flush()
		}
	}
}

Caddy on the app host terminates TLS and selects the active guest. The deploy hook changes the upstream after the new guest passes its health checks.

The data lives in Postgres on the database host, so the guest holds no state. A guest that finds a state it cannot trust exits, and a watchdog on the app host boots it again.

The VMs

The VMs run on Ubicloud. Why a VM and not a PaaS: web / hosting.

The firewall permits ingress on ports 22, 80, and 443. sshd accepts public keys only. It rejects passwords and root logins.

Sockeye, my code host, holds the source of truth and runs the checks. A merge starts the deploy hook on the operations host. The hook builds the guest on the app host and boots it in the idle slot.

The deploy checks /healthz, the home page, and the first data refresh. If a check fails, the old slot keeps the traffic. If the checks pass, Caddy switches to the new slot. The old slot drains its requests, then stops. Both slots share the database, so migrations must work with the previous build.

The hook updates the checkout and CLI binary on the operations host to the same commit. Sockeye records the deploy. The slot switch keeps the site available during a normal deploy. Both slots use one host, so they do not protect against a host failure.

Postgres has hourly backups on the database host. A second copy goes off the box. An hourly cron job on the operations host takes a pg_dump and bundles the git repositories. It pushes the changed files to Cloudflare R2. Tiered prefixes and bucket lifecycle rules expire the old copies, so off-box storage holds steady at a few GB. A small Go CLI signs the S3 requests, so the VM needs no AWS SDK.

If a VM fails, I provision a new instance and fetch the most recent bundle and dump. Then I clone the bundle and restore the database.

Operations

The board footer reports feed freshness and backup health, so a failed ingest reads as a failure rather than as a quiet news day.

← All articles