Elliot Brandt


How I host this site for free with Cloudflare Pages

This site is hosted behind a fast global CDN with high uptime and DDoS protection, has comprehensive version history (via git), and requires essentially zero maintenance — all at no cost apart from domain registration.

This is possible because this site is built using only static HTML/CSS (no JS for now, but that's subject to change). This keeps the hosting cost low enough that some companies are willing to host static sites for free, in exchange for gaining mindshare and developer loyalty/lock-in. I use Cloudflare Pages for this site, but several other options are available, such as Vercel, Netlify, and GitHub Pages. They differ slightly in features and limitations, but all share the same core functionality.

I hand-write the HTML and CSS for this site, but for a more streamlined experience a static site generator could be used. If I keep adding more content regularly, I'll consider migrating to one such as Eleventy, Hugo, or Zola. For now, VS Code snippets are enough to keep me sane while repeating content between pages. All content is stored in a GitHub repository.

To start making changes, I create a branch for whatever I'm doing (for example, adding this blog post!), and work on it locally until I'm happy with my changes. I then merge this to the staging branch of the repository. Cloudflare Pages picks up this change and automatically deploys the site folder in the staging branch to a random, unique domain. Once I've made sure everything looks good on the staging domain, I merge my changes to the master branch, and Cloudflare Pages deploys them to this site.

There are some downsides to hosting a site in this fashion. You lose some control over configuration, and you're limited to static content unless it's fetched by JS at load time from an API hosted elsewhere. A Cloudflare Pages specific quirk is that if you want to host a site at the apex of your domain (for example ebrandt.net instead of www.ebrandt.net), you'll need to use Cloudflare's nameservers instead of the ones provided by your registrar.

For side projects I do outside of my job, I prefer to keep maintenance and monetary requirements as low as possible so that keeping them running doesn't become a chore. For this reason, I'm happy to accept the downsides in exchange for fast, reliable, and free hosting that doesn't require any day-to-day maintenance.