Shaf Lab

Durable edge state

Edge isolates that hold strongly consistent, stateful storage, such as Durable Objects.

Durable edge state is strongly consistent, stateful storage that lives next to edge compute. Cloudflare Durable Objects are one example: a named isolate that holds data and handles requests in sequence, so two writes cannot silently overwrite each other. You reach for this when a simple key-value store is too weakly consistent, and a regional database is too far away.

The usual cases are a collaborative document, a per-user or per-room counter, a lock, or a small transactional store that must not lose an increment. Each unit of state has an identity, and requests for that identity are routed to the same isolate. That gives you a single writer without standing up a traditional server.

Keep each unit small and well keyed. If you stuff a whole product into one object, you will serialize work that could have been parallel. If you split too finely, you will invent distributed transactions you did not want. Model the natural identity first — a document id, a game room, a user — and put only that state inside.

When you only need eventually consistent reads of a config value, a replicated key-value store is simpler. Durable edge state is for the cases where the order of writes matters.