Why this site is one Go binary

Templates, styles, and posts are embedded at build time, so the server has nothing to read at runtime.

This site is a single Go binary. There is no database, no asset folder on the server, and no separate process for the blog. Everything the browser asks for is already inside the executable.

A dark placeholder card reading One binary

What gets embedded

Three things go into the binary at build time:

  • the HTML templates,
  • the stylesheet,
  • every Markdown post and its images.

Go's embed package does the work. The directive sits next to the files it matches, which is why the content package exists as its own folder.

//go:embed *.md all:media
var Files embed.FS

A dark placeholder panel listing what ends up in the binary

Why it matters

A deploy is one file. Start it, and the site is complete. There is no path where the page loads but the stylesheet 404s because a copy step was skipped.

The trade off is that adding a post means rebuilding the image. For a personal site that is fine, and it removes a whole class of runtime errors.

A deploy with one artefact has one thing to check, and one thing to roll back.

What stays outside

Only two things are not embedded: the environment and the tunnel token. The process reads the listen address from ADDR and never touches disk for content.

Back to all posts