Using Cloudflare Durable Objects

2025-04-03

In the previous post I explored using Cloudflare KV for managing blog content. While I didn’t think the eventually consistent model would be a problem, it turned out that list and get were not consistent, which led to errors for a full minute after new content was published. This did have a familiar feeling - I mention in that post that I had seen framework adapters for Cloudflare Pages use KV for storing content, and I remember similar buggy behaviour following each deploy.

Let’s explore using Durable Objects instead…

Managing content in Cloudflare KV

2025-03-27

The easiest way of managing content for a developer blog is probably just Markdown files living in the repo. Frameworks like Astro come with support for this built-in, but it’s trivial to do in any framework using Vite for the build process, with the built-in glob import:

const posts = import.meta.glob('./posts/*.md');

Which generates something that you can iterate over:

{
  './posts/post1.md': () => import('./posts/post1.md'),
  './posts/post2.md': () => import('./posts/post2.md'),
  // ...
}

I’m exploring an approach on Cloudflare, and trying to avoid any build step (except for wranglers inbuilt esbuild). It’s easy to include markdown files using rules and then import them directly in your worker, but it’s not easy to list all the files for the index.

So instead of storing Markdown in the repo, I’m experimenting with using Cloudflare KV. I’m pretty sure many of the framework adapters for Workers used KV to store content before Cloudflare Pages and then Workers Assets came along, so it seems like a pretty standard option for that kind of thing.

Landscaping

2025-03-01

It’s been a minute since I’ve stepped back to survey landscape for web development frameworks in 2025. I took some time this week to do so. Note that I am really delving into Cloudflare at the moment, so I’m testing each of these out with Cloudflare Workers with the new static assets feature, instead of the now deprecated Pages.

Python Dependency Management

2024-07-05

Python package management has long been a struggle. In January 2017, the PipEnv project was started, and by 2018 it became the officially recommended package manager.

It brought a fantastic npm-like experience to Python, with easy configuration via a YAML Pipfile and a straightforward CLI. But then it went dead, not seeing any releases between November 2018 and April 2020. People moved on to Poetry, and I ended up using Conda quite a bit, especially when numpy/scipy was required.

While it does look like PipEnv has seen regular releases since April 2020, I’m seeing more people just use the built in pip+virtualenv tools. Here is how to do that…

Example Blog Post

2024-01-30

This is an example blog post written in MDX format. You can use all the standard Markdown features plus JSX components.

This is the preview section that will show on the homepage. Everything before the page break will be used as the preview text.

Base64 Conversion

2023-01-04

Here is how to convert a string to and from base64 from the terminal.

echo "abcdef" | base64
YWJjZGVmCg==

echo YWJjZGVmCg== | base64 -d
abcdef

AWS re:Invent 2022

2022-12-28

After a couple of years of cancelled bookings due to COVID-19,
this year was the first time I’ve been able to attend AWS re:Invent.
What a conference. Unlike any other event I’ve ever seen, the scale of this thing is wild, even for Vegas.
Everyone warned me about travelling through LAX on the busiest travel day of the year.
But overall, things were pretty smooth.
After over 24 hours of flights and layovers, the trip from Adelaide->Sydney->Los Angeles->Las Vegas ended in a wonderful thanksgiving lunch with friends I hadn’t seen since 2019.

The conference was incredible. But here are five lessons for next time…

RQ with SQS

2022-04-14

RQ is a great library for building a simple decoupled worker queue, which can invoke arbitrary functions from your code base.

As the name implies, it requires a redis service. If you’re deploying on AWS, you might already have familiarity with SQS and prefer to use that instead. Inspired by RQ, here’s how we do it with no dependencies whatsoever…