Hima Blog Logo

Hosting my blog with Cloudflare Pages

3 min read

By Hima

developmenttech

Introduction

Recently, I've decided to revive my blog because I had some extra time during the summer break, and I thought it would be nice to be able to document different aspects of my life - technology and life included. So I just vibed something up in matters of minutes based on my previous blog's codebase.

But here comes another problem, how should I deal with hosting of the site?

The Problem I Was Solving

I needed a quick, reliable, easy, and cost-effective way to host my static sites. Since my blog is purely a static site that renders my blog posts based on the mdx files available in my posts directory in the repository, no backend was needed, so the problem was reduced to simply hosting a static site rather than a webapp, which is considerably easier.

I did not want to spin up my own CI pipeline on GitHub Actions to re-deploy the site whenever I update my blog with a new blog post. I also did not want to deal with the infrastructure side by hook it up to somewhere with Terraform, so the solution had to be simple.

I remembered one of my previous companies was hosting their site on Cloudflare Pages and I dabbled with it quite a bit, so I've decided to try that out!

Why Cloudflare Pages?

What really sold me on Cloudflare Pages was really simple, it solved all the problems that I was describing above.

To be specific, here's what made it stand out:

Of course, I still had to reconfigure my DNS namespace from Porkbun to Cloudflare, since my domain is originally in Porkbun, but that was a trivial issue to deal with.

The Setup Process

The entire setup took less than 5 minutes:

  1. Connected my GitHub repository to Cloudflare Pages
  2. Specified my build command: bun run build
  3. Set the root directory: /frontend
  4. Set the build artifact: /out
  5. Map my domain to the project
  6. Deploy!

That's it. Cloudflare handles everything else automatically.

What I Love About It

Automatic Deployments

Every time I push changes to my main branch, Cloudflare automatically:

Final Thoughts

Both this blog and my personal website are now hosted on Cloudflare Pages. The deployment process has become so effortless that I can focus entirely on creating content and improving features rather than worrying about infrastructure at all.