DURABLE OBJECTS

1

Overview

How Durable Objects works

Durable Objects combine compute and storage in single global instances. Each object coordinates clients, keeps consistent state, and runs close to whoever starts the interaction.

Think of it this way

It's like a virtual room with a single coordinator. Everyone enters the same room and the coordinator keeps order, state, and real-time updates.

Features

  • Single global instances
  • Strong consistency
  • Built-in SQLite
  • WebSocket Hibernation
1/9
CLIENTES GLOBAIS📱💻🖥️↓🎯Vários clientes, 1 salaEVENTOS E WORKERS⚙️⚡ Chamada instantâneaCLOUDFLARE DURABLE OBJECTSROTEAMENTO POR IDMesmo nome sempre chega na mesma instância🏷️"room-42"→🔢idFromName()→🎯Stub únicoINSTÂNCIA ÚNICAExecução serial, sem race conditions123fila processada uma por vezESTADO EM MEMÓRIA🧠Cache local entre requisiçõesESTADO SQLITE (Storage API)🗄️Storage🔄Transações⏳PITR📊10GB/objetoHIBERNATION🟢Conectado→😴Dormindo→🔔Acordadocusto zero enquanto dormeBROADCAST📡1 mensagem → N clientes conectadosCONSISTÊNCIA✅Ordem garantidaAPPS EM TEMPO REAL💬Chat🎲Games📝Collab✓ Estado sempre sincronizadoLEGENDAFluxo ativo na etapaHover