cfsite

New site

This repository is the template: a new site starts as a copy of it and keeps everything described here.

Start a new site

  1. Create the repository from radimklaska/cfsite (Use this template on GitHub, or copy the files).
  2. Replace the names. grep -rn cfsite --exclude-dir=node_modules . finds them all:
    • wrangler.jsonc: the Worker name (lowercase, hyphens) and the hostname in routes;
    • package.json: name;
    • .github/workflows/deploy.yml: PROD_URL, the build step if the site is generated, SITE_DIR and the paths in Check the site;
    • tests/visual.spec.mjs: the production URL and the page list;
    • .github/workflows/link-checker.yml: the folder and the exclusions;
    • README.md, CLAUDE.md and of course site/.
  3. npm install, and commit the updated package-lock.json.
  4. Check locally: npx wrangler dev serves the folder with the 404 page and the redirects, as production will.
  5. Create the deploy token: scripts/create-deploy-token.sh <repo> (see Hosting).
  6. Make sure the hostname has no DNS record. Do not create one: the first deploy does (why).
  7. Push the first commit to main. The deploy attaches the hostname, and Cloudflare creates the DNS record and the certificate.
  8. Verify: curl -sI https://<host>/ answers 200 from server: cloudflare, http:// redirects to https, a missing path returns the 404 page, and the analytics script is there: curl -s -H 'Accept: text/html' https://<host>/ | grep -c cloudflareinsights.
  9. From now on, changes go through pull requests. Set up the Claude review secret (Checks), and, if the branch should only take pull requests, a ruleset on main.

Docs in the repository

Every site's README.md and CLAUDE.md say where it is hosted, how deploys and previews work, which secrets it needs, and the DNS caveat. CLAUDE.md is what an AI assistant reads first, so the rules that matter (changes only through pull requests, versions stay pinned, never create the DNS record by hand) go there.

Variants, not used here