hire enzo
list all projects
Launch day: 2023-06-02


What Cloudflare Durable Objects are.

Cloudflare Workers allow you to upload JS code to respond to HTTP requests that run in 200+ globally distributed datacenters. This reduces user-to-server latency to less than 50ms regardless of user location.

Edge hosting solutions do not handle state well as there is no central location.

In typical web servers state is stored in a central location. This is the simplest possible set-up (single web server, single database), but has a few disadvantages:

Durable Objects are defined in JS classes that are bundled with a Cloudflare Worker. The worker acts as a proxy to receive public HTTP requests and then instantiates a Durable Object to pass the HTTP request to.

Durable Object’s have these features:

What Durafetch is.

Durafetch consists of two parts:

A missing feature of Durable Objects is the ability to inspect and observe state outside of the JS API - you cannot access your data unless your write the HTTP endpoints yourself.


The two main use cases I have in mind are:

  1. Development

    • When developing you need to refresh and run code paths repeatedly as you modify the code. Not being able to see what the state of the storage is makes this very difficult as you have to either print the values to a console, or write your own solution to read the state.
    • Even if you can read the state, you often need to filter/query it. SQL allows you to do this.
  2. Production

    • Accessing and querying your server based state. E.g. How many sign-ups, sales. Usage based billing etc.

Why D1 cannot be used (for now)

Cloudflare have a SQLite based persistence API called D1 that looks good.

Take a look

Durafetch is described in more detail at durafetch.com or the Github repo.