Skip to main content
A Durable Object is the general-purpose stateful component in Verglas. Every object has a stable ID, an ordered event loop, and durable storage. Use one object per natural coordination key: room, tenant, customer, device, workflow, or document. Use ctx.blockConcurrencyWhile() when asynchronous initialization must finish before any handler is dispatched.

Define and bind an object

The named ID is deterministic. Two Worker instances that call idFromName("global") reach the same logical object, and that object serializes their requests.

Storage APIs

SQL cursors also expose one(), raw(), columnNames, rowsRead, and rowsWritten.

Alarms

Schedule work on the same object without running a separate scheduler:

Design guidance

  • Choose IDs that spread unrelated work across objects.
  • Keep one object responsible for one consistency boundary.
  • Put large append-only event volumes in a Stream instead of one application DO.
  • Use alarms for object-local follow-up work, not as a global batch scheduler.