Aaron Boodman (CEO of Rocicorp, creator of Replicache, ex-Google Chrome) explains durable objects in a three-tweet thread: “The name is awful but I can explain it to you. It’s a really cool and unique architectural primitive.”

The pitch

  • Think serverless functions, but stateful. A serverless function is a stateless JS program uploaded to Vercel: request in, result out, program destroyed. A durable object is the same thing except the external interface is a class, not a function — and Cloudflare keeps the instance running.
  • Same URL, same object. If another request hits the same URL, CF routes it to the same running program and the same JS object in memory. You keep state across invocations. “That’s it, that’s the whole pitch.”
  • Cheap, so you can have zillions. Low-power programs (max RAM ~1GB), cheap to run — a natural fit for chatrooms, multiplayer games, and similar stateful problems.

Why it’s not just functions with global state

The difference is the guarantees:

  • Functions might reuse a JS context between invocations — but there’s no guarantee, and you’ll never get concurrent requests on one instance.
  • A DO guarantees exactly one instance per object. Chat state never splits; every client hitting the same URL gets the same running instance server-side.
  • The app layer of common stacks is stateless — “basically it’s database or nothing” for shared state. Routing fast-moving state (AI chat, games, chatrooms) through a central database is expensive: locking, contention, cost.
  • DOs flip the model: many small programs with in-memory state, nothing shared between them — no contention, no locking, low cost. They persist at whatever rate suits them (batch saves every 5s) with no concurrent-writer invalidation, because there are no concurrent writers.