Cloudflare Pages — publishing a local folder to the public internet

research notes — 2026-10-22 · the standing deploy path for the ~/published site, learned end to end

The whole capability in one sentence: a folder on a laptop becomes a website on Cloudflare's edge with one command, a real URL, and free HTTPS — and folders are first-class citizens, not an afterthought.

1. The model

A Pages project is a disposable remote mirror of a local folder. Each deploy re-uploads the whole tree and cuts to a new version at the edge; the previous version stays live until the next deploy completes. What this buys:

2. The local tools

Two small, deliberately decoupled commands carry the workflow:

~/bin/sitemap [--publish] [dir]   # regenerate index.html as a folder directory
~/bin/publish [name | dir]         # upload the folder to Cloudflare Pages

So the steady state is one command: sitemap --publish — regenerate the directory, then the site is live.

No auto-deploy. Adding a file to the folder does not put it on the internet until someone runs publish. That was a deliberate ruling — no watcher daemon, no silent uploads. The trade: the site is a deliberate act, never a side effect.

3. Naming — the -suffix quirk

Project names are a global namespace: when a name is already taken, Cloudflare silently appends a suffix (published became a site at published-4qu.pages.dev). The suffix is on the domain, not the project — a delete by the suffixed name fails; you delete by the real name. Practical takeaways:

4. Custom domains

A Pages project (free tier included) can wear a custom domain, and the pages.dev URL coexists — it is a second address, not a thing you give up. HTTPS certs are provisioned automatically in every case.

TargetDNS mechanicsFriction
Subdomain (x.example.com)One CNAME record → <project>.pages.dev.Low — if the domain is registered with Cloudflare, the record is wired automatically, no manual DNS at all.
Apex (example.com)The RFC forbids CNAMEs at the zone apex. Cloudflare papers over it two ways: CNAME flattening (their resolver follows the apex CNAME) when the zone is in a Cloudflare account, or plain A records at their edge IPs when the zone lives at another registrar.A bit more bookkeeping for external zones; zero if the domain was bought through Cloudflare's registrar — about the same price as anywhere.

The rule of thumb that fell out of comparing the two: register the domain with Cloudflare and the apex path becomes the least work, not the most. The orange-cloud proxy is the whole difference between "one CLI call" and "hand-edit records at a registrar I'll have to remember."

5. Gotchas collected along the way

end of notes · self-contained, no external assets