If you pay attention, at the end of the page, it says "built with zola", so you may wonder, what the <...> is Zola? Fair enough, I did not have a clue either.
But why?
The hard truth: most websites do not need a backend. Portfolios, consultancy pages, blogs, documentation, small business brochures, all of which end up running on WordPress, with a mashup of plugins, on a shared hosting plan that takes an eternity to load. There are legit use cases that require a backend, mostly anything that needs to process data, like your bank, online shop or SaaS product, however, backends do not come for free and should be avoided unless you actually need one.
Static is the new black
Static websites are nothing new, in fact, they are rather old but they are coming back in fashion. There are plenty of options to create one, you may ask Google or your favourite LLM about it. I went with Zola because it comes with zero dependencies, which means setup is basically "download file, run file", and like everything in Rust: It's fast. The templating language is Tera, basically Jinja2 with a Rust accent. Visit their website; they will do a way better job at explaining it than I.
Cloudflare and how this all works
This site is deployed and served through Cloudflare Pages. Cloudflare needs no introduction, they're the CDN (Content Delivery Network) that a big chunk of the internet runs through, and you may have noticed it when sites are down.
- Speed: We can use Cloudflare's global network for content delivery, which means the website files are served from the closest node to whoever is accessing the site. The actual workings are way more complicated than that, but you get the idea.
- Security and Reliability: Your server cannot get hacked if you do not have a server (insert smort meme of choice). Cloudflare can handle the rest, including DDoS.
- Cost: Hosting static files through Cloudflare Pages is free (I know right?). This entire site costs me nothing beyond the domain (at least for now).
Version control and publishing
Usually, deploying the site can be done as simply as zola build and uploading the generated public folder using the Cloudflare website. However, a bit of automation is always fun, there are two options for Zola websites hosted in GitHub: Push and Pull.
- Pull: Cloudflare can monitor your GitHub repo and run
zola buildin their servers when a new commit is pushed. - Push: Using GitHub Actions and Cloudflare APIs, a new version of the site is built and pushed after a merged pull request.
I favoured the push model as GitHub Actions give a bit more flexibility. Note that this can get expensive if you want to keep your repo private without an active subscription, as GitHub requires a paid plan to use API secrets on private repos.
Closing thoughts
The whole setup process has been interesting, especially given that I do not come from a web development background. If I am being totally honest, there were some doubts about the whole thing as well as a fair amount of cursing at my LLMs. However, now that it is all done, I am quite satisfied with the results, albeit I have learned more HTML and CSS than I would have liked.
— Leonardo.