· 3 min read

How this site is built

Astro, Caddy, a single small droplet, and a deploy pipeline that can only write one folder.

I wanted a personal site with three properties: it should be fast, it should cost almost nothing to run, and publishing a post should be as easy as pushing a Markdown file. Here’s the setup I ended up with.

The site: Astro, fully static

The site is built with Astro. Every page is rendered to plain HTML at build time, so there’s no server-side code running when you load a page and no database to keep alive.

Posts are Markdown files in a content collection. Each one has a small, type-checked frontmatter block:

---
title: 'How this site is built'
description: 'Astro, Caddy, a single small droplet...'
pubDate: '2026-11-03'
draft: false
---

If a field is missing or malformed the build fails, which is exactly what I want. Setting draft: true keeps a post out of the build until it’s ready. The RSS feed and sitemap are generated from the same collection, so they never drift out of sync with the posts.

The server: Caddy on one droplet

The built site is a folder of HTML, CSS and fonts, served by Caddy from a small droplet. Caddy is a nice fit for this:

  • HTTPS is automatic. Caddy fetches and renews certificates on its own. There’s no certbot cron job to forget about.
  • The config is short. Serving the site, compressing responses, redirecting www and setting security headers fit in about twenty lines.
  • Caching is easy to get right. Astro fingerprints the filenames of built assets, so anything under /_astro/ can be cached forever:
@assets path /_astro/*
header @assets Cache-Control "public, max-age=31536000, immutable"

HTML stays uncached, so a new deploy shows up straight away while the heavy assets come from the browser cache.

The deploy: push to publish

Publishing is a git push. A GitHub Actions workflow runs on every push to main:

  1. Install dependencies with npm ci.
  2. Run astro build.
  3. rsync the dist/ folder to the server.

The interesting part is step three. The workflow holds an SSH key, and I didn’t want a leaked CI secret to mean a compromised server. So the key logs in as a dedicated deploy user, and its entry in authorized_keys is pinned to a single command:

command="/usr/bin/rrsync -wo /srv/blog",no-pty,no-port-forwarding,...

rrsync is a restricted rsync wrapper. With -wo the key can only write into /srv/blog. It can’t open a shell, read anything back, forward ports, or touch any other directory. The worst a stolen key could do is replace the website, and the git history can rebuild it in a minute.

What it costs

One small droplet, which also runs a few other things. Static files are cheap to serve, so the site itself adds roughly nothing.

What’s next

Mostly writing. The scaffolding is done, so the rest is filling it in.

← All writing