Static sites on Cloudflare
How the klaska.net sites are hosted, previewed and checked. This site is built exactly that way, so everything described here is running underneath this page.
It is also the starting point for a new site: copy the repository, change a few names (New site) and the whole setup comes with it.
Principles
- Static files only. An assets-only Cloudflare Worker serves a folder of files. No server code, and no build step unless the site needs a generator.
- One site, one hostname. Each site lives on its own subdomain as a Worker custom domain. Production exists nowhere else.
- Every change goes through a pull request with a live preview, a comment with its links, a QR code for phones and Lighthouse scores.
- Production is the baseline. Visual regression compares the preview with the live site, so there are no stored screenshots to maintain.
- Pinned, so it behaves the same next year. Exact versions of every
tool, a committed
package-lock.jsonand a fixed compatibility date. - Least privilege. Each repository has its own Cloudflare token that can only deploy Workers, and it expires after a year.
- Nothing left behind. Previews are deleted when the pull request closes, and outdated comments are collapsed.
- The documentation lives with the code. README and CLAUDE.md in every repository; here, the site itself.
Where each feature is in this repository
Try it: /new is a redirect to the New site page, and a missing page shows the custom 404.