---
name: secure-blog
description: Set up a blog that costs nothing to run and gives attackers little to work with - GitHub, Zensical and a Cloudflare Worker, with pinned builds, a deploy that installs nothing, strict security headers and a hardened domain. Use when the user wants to start a blog or static site, move one off a paid host, or secure an existing one.
---

# Secure blog

Builds the setup from [A Free and Secure Blog with GitHub, Zensical and Cloudflare Workers](https://thoughtson.ai/posts/a-free-and-secure-blog-with-github-zensical-and-cloudflare-workers/): a GitHub repository, a Zensical blog, and a Cloudflare Worker that serves only plain files. The person owns every piece and pays only for the domain.

Work in **stages**. Each stage has steps you do, **human steps** only the person can do (logins, dashboards, payments, secrets), and a **Done when** you check before moving on. Read a stage's file when you reach it, not before.

## Ground rules

- **Secrets never pass through you.** Tokens go from the dashboard that makes them straight into GitHub's secret store, typed by the person. Logins (`gh`, `wrangler`) live on the person's machine; you use them, and never read or print what they store. Ask for names and IDs, never for tokens or passwords.
- **Human steps are a checklist.** Give the exact clicks, one per line, then wait for the person to say it's done. Check the result yourself where you can.
- **Ask before anything that's hard to undo or visible to others**: creating or pushing to a repository, changing DNS or nameservers, making a repository public, deleting anything.
- **Each provider's work goes to its skill**: `github` for the repository, `cloudflare` for DNS and the Worker, and the registrar's skill (such as `namecheap`) for the domain. They know how to connect, what to ask, and how to check. For a provider with no skill, look up its current docs (or use what you know, and say so) and give the steps as human steps.
- **Pins stay pinned.** Use the versions and hashes in `starter/` and the stage files as they are. Upgrade only for a reason the person agrees to.

## Before you start

1. Use the `setup-tools` skill for git, python3 and make, and the `github` skill to connect `gh`. They come with this skill set; if one is missing, ask the person to add it. Once the answers below say which providers you'll use, connect their MCP servers before stage 1 (`setup-tools`), since some agents need a new session to see one.
2. Find out, and confirm back in one short list:
   1. The domain, and whether they own it yet. If they own it, look up the registrar in the public record: `curl -sL -H 'accept: application/rdap+json' https://rdap.org/domain/DOMAIN`, the entity with the role `registrar` (some endings have no public record; then ask). If they don't, they buy it at a registrar of their choice: its skill, such as `namecheap`, can help.
   2. The address readers use: the bare domain (`example.com`) or `www.example.com`. Recommend the bare domain; the other name redirects to it either way. For a site being moved, say which one it uses today.
   3. Their GitHub account, and the repository name (default: the domain with dots as dashes).
   4. Private or public. Recommend **private**: drafts and notes stay out of sight, and only the built pages are public. Then say it's their choice: a public repository gets branch rules and environment secrets on GitHub's free plan, but everything in its history is public.
   5. Whether they have a Cloudflare account, and how you'll work with it: the `cloudflare` skill's MCP server, Wrangler, or dashboard steps.
   6. Whether this is a new blog or an existing site. For an existing site, read [EXISTING.md](EXISTING.md) first. For a repository that already exists, use it, and skip creating one in stage 1.
   7. Whether the domain sends or receives email. It changes the SPF and DMARC records.
   8. What builds the site. Recommend **the starter** in `starter/`: Zensical, tested end to end, and the check passes from the first build. If they'd rather keep their own static site generator (Hugo, Astro, Jekyll and the like), stage 2 follows [OWN-GENERATOR.md](OWN-GENERATOR.md) instead; say it hasn't been tried in a real run yet. A site that needs a server (WordPress, anything with a database or logins) doesn't fit this setup: say so and stop.

Done when: every tool passes and the person has confirmed all eight answers.

## Stages

| Stage | File | Ends with |
|---|---|---|
| 1. Repository | [stages/1-repository.md](stages/1-repository.md) | the repository, only they can push to it, and only GitHub's own actions, pinned to commits, can run in it |
| 2. Blog | [stages/2-blog.md](stages/2-blog.md), or [OWN-GENERATOR.md](OWN-GENERATOR.md) | the blog building on their machine, and in GitHub Actions on a pull request |
| 3. Cloudflare | [stages/3-cloudflare.md](stages/3-cloudflare.md) | the domain on Cloudflare, the blog served from it by a Worker, and the other name redirecting to it |
| 4. Deploy | [stages/4-deploy.md](stages/4-deploy.md) | a deploy token in GitHub's secret store, and GitHub Actions deploying every merge to `main` |
| 5. Domain | [stages/5-domain.md](stages/5-domain.md) | SPF, DMARC, CAA, DNSSEC and HSTS in place, and the domain locked at the registrar |
| 6. Check | [stages/6-check.md](stages/6-check.md) | every check passing, or each failure explained to the person |

Run the stages in order. Each stage's Done when must hold before the next starts.

## At the end

Give the person:

- the check report from stage 6;
- how to write and publish a post: write it in `docs/posts/`, `make preview`, then a pull request, then merge;
- the dates to remember: when the Cloudflare token expires, and when the domain renews (the check shows it);
- that analytics, videos and other things from other sites each need their agreement and a change to the headers: [OUTSIDE-CONTENT.md](OUTSIDE-CONTENT.md) is how;
- that the look is the theme's own, on purpose. They can ask their coding agent to restyle it; `make build` and the check in stage 6 tell them if a change broke the security headers.
