Running a personal blog on managed WordPress feels effortless right up until you treat it like production infrastructure. One morning you realize six years of your writing—nearly a third of a million bytes of HTML, RSS feeds, permalinks, and comment history—sits behind an opaque admin panel, PHP plugin surface, and DNS defaults you don't actually version-control.
This month I migrated musingsofmy.today off WordPress.com onto a Git-backed Config-as-Code architecture built with Astro 7, Pagefind, and Cloudflare Workers Static Assets. The goal wasn't chasing static-site purity; it was enforcing the exact same engineering invariants on a personal publication that I expect from any production service: immutable URLs, build-time parity verification, zero plaintext secrets on disk, strict email authentication, and zero-dependency edge APIs.
The Config-as-Code & Cloudflare Edge Blueprint
Explore the interactive system architecture below—from git commit through ephemeral CI validation gates (astro check, Pagefind indexing, link/RSS validators) down to Cloudflare's global edge routing and preview isolation.
Tip: Click any node in the blueprint to inspect responsibilities and data flow, toggle light/dark themes, or open the full standalone Archify diagram.
1. Repository Source-of-Truth & Permalink Parity Gates
Migrating an established domain means breaking links is unacceptable. Every /YYYY/MM/DD/slug/ post path, legacy /category/.../ archive, and WordPress /feed/ RSS endpoint had to behave identically on day one.
Instead of hand-maintaining Nginx rules or fragile dashboard redirects, src/site.ts acts as the single source of truth for the five content lanes and two podcasts, while astro.config.mjs synthesizes edge configuration directly into dist/ during every build:
dist/_redirects: Maps/feed/and/*/feed/(301) to/rss.xml, collapses dozens of legacy WordPress categories into the five sections, and forwards legacy upload URLs cleanly.dist/_headers: Sets one-year HSTS (Strict-Transport-Security: max-age=31536000),X-Content-Type-Options: nosniff, immutable caching on/_astro/*, andX-Robots-Tag: noindexacross*.workers.devpreview URLs so staging builds never compete in search results.wrangler.jsonc: Configureshtml_handling: "auto-trailing-slash"(preserving WordPress trailing slashes),not_found_handling: "404-page", andrun_worker_first: ["/api/*"]so static pages bypass Worker CPU limits entirely.
No deploy runs until .github/workflows/ci.yml clears three blocking gates:
npx astro checkverifies strict TypeScript and Zod content schemas (including timezone-offset timestamps soAmerica/Chicagopermalinks never drift across midnight UTC).npm run buildcompiles Astro pages, runssatori+sharpto render cyber-glass1200×630Open Graph PNG cards for every post without a custom cover, and builds a client-side Pagefind search index.node scripts/validate.mjsverifies WordPress URL parity, body word-count integrity, W3C RSS 2.0 GUID preservation, and every internal anchor acrossdist/beforelycheedouble-checks internal links.
2. Zero-Dependency Edge APIs (src/worker/*)
Static-first shouldn't mean static-only. Readers still need comments, email subscriptions, and live community discussion—without hydrating a database server or bundling heavy npm packages into the Worker runtime.
Every route under /api/* shares zero third-party runtime dependencies and runs directly on standard Web Crypto and fetch:
Double Opt-In Newsletter & RFC 8058 One-Click Unsubscribe (/subscribe/)
- Stateless HMAC-SHA256 tokens (
src/worker/crypto.ts): Confirm links (24h expiry) and unsubscribe links (30–90 day expiry) are signed payloads verified in constant time. There is no subscriber token database to leak or prune. - GET-safe link scanners: Corporate mail filters pre-fetch links in emails. Because of that,
GET /api/subscribe/confirmandGET /api/subscribe/unsubscribenever mutate state—they verify the token signature and render a dark cyber-glass HTML confirmation form that submits viaPOST, alongside full RFC 8058List-Unsubscribe-Post: List-Unsubscribe=One-Clicksupport for mail clients. - Defense in depth: Strict
Origin+Sec-Fetch-Site: same-originvalidation, a hidden honeypot field, Cloudflare Turnstile bot verification, and keyed SHA-256 IP rate limiting (never writing raw PII into logs orIdempotency-Keyheaders).
Air-Gapped Newsletter Dispatch (POST /api/subscribe/dispatch)
- Sending a newsletter from a developer laptop over SMTP exposes a residential IP in mail
Received:headers. Instead, triggering a post dispatch from a privateworkflow_dispatchAction hits Cloudflare's Worker edge over HTTPS, which signs per-recipient unsubscribe tokens and submits batch payloads (POST https://api.resend.com/emails/batch) from Cloudflare's network to Resend—with zero home IP ever touching the envelope.
Allowlisted Discord Thread Mirroring (GET /api/discord/thread/:postId)
- Announcements in OrganizedChaos automatically spawn lane-routed discussion threads (
#podcast-discussions,#wow-addons,#agentic-harness-engineering,#tech). - At build time,
astro.config.mjsextracts validdiscord_threadIDs from published frontmatter into/_discord-threads.json. The Worker refuses anypostIdoutside that build-time allowlist, queries Discord REST v10, strips every user snowflake and@rolemention before JSON serialization, and edge-caches the sanitized replies for 5 minutes.
3. Locking Down DNS & Email Auth Across Five Domains
Moving mail and publishing to Resend was also the catalyst to audit SPF, DKIM, DMARC, and forwarding across all five domains in the account (musingsofmy.today, henseler.app, skyalerts.space, henseler.email, and kenhen.win).
Every zone now enforces:
- Isolated bounce subdomain (
send.musingsofmy.today) with Resend DKIM + SPF records so bulk/transactional reputation stays decoupled from apex mail. - Cloudflare Email Routing replacing registrar forwarding (
newsletter@musingsofmy.todayand role aliases onkenhen.winforwarding cleanly withdropcatch-alls). - Hard-fail
-allSPF instead of permissive softfail~allwhere third-party ESPs are explicit. v=DMARC1; p=reject; sp=reject;paired with Cloudflare DMARC Management telemetry (rua=) so spoofed subdomain or apex senders are rejected at receiving MTAs rather than silently quarantined.
What It Unlocked
The entire site—including the dual-harness Archify timelines like the one in Inside the Dual-Harness Launch, podcast transcripts, custom fonts, OG card rendering, search index, and edge APIs—builds cleanly from one repository in under a minute, previews automatically on isolated *.workers.dev URLs per pull request, and publishes through signed secrets managed in 1Password, GitHub Actions, and Cloudflare Workers.
That's the whole point of Content-as-Code: the writing lives in Markdown, the routing and headers live beside it in TypeScript, and the deploy gate proves nothing broke before a single reader sees it.
// organizedchaos · discord
Loading thread preview…
// comments
GitHub Discussions comments are connecting — join the discussion on GitHub Discussions or in OrganizedChaos on Discord →