Quickback Docs

Realtime

Real-time updates via WebSockets with Cloudflare Durable Objects.

The Quickback Stack uses Cloudflare Durable Objects to broadcast real-time updates over WebSockets. CRUD events and custom broadcasts are delivered to connected clients with the same security layers (firewall isolation, role-based filtering, field masking) applied.

Architecture

┌──────────────────────────────────────────┐
│            Quickback Worker              │
│                                          │
│  ┌──────────┐    DO binding   ┌────────────────────┐
│  │ Hono API │ ──────────────► │ Broadcaster (DO)   │
│  │          │                 │ WebSocket manager   │
│  └──────────┘                 └─────────┬──────────┘
│                                         │
└─────────────────────────────────────────┼┘
                                          │ WebSocket

                                 ┌────────▼─────────┐
                                 │  Browser Clients  │
                                 │   (CMS, Account,  │
                                 │    Admin, Custom)  │
                                 └──────────────────┘

The Broadcaster Durable Object runs inline in your main Quickback worker — no separate worker deployment needed. The API calls the DO directly via its binding (in-process, no network hop).

  1. Quickback Worker — Your compiled API with the Broadcaster DO class exported from the same worker.
  2. Broadcaster (Durable Object) — Manages WebSocket connections per organization. One instance per org.
  3. Browser Clients — CMS, Account, Admin, and custom frontends connect via WebSocket on the same origin.

Key Features

FeatureDescription
Organization-scopedEach org gets its own Durable Object instance
Role-based filteringOnly send events to users with matching roles
Per-role maskingDifferent users see different field values based on their role
User-specific targetingSend events to a specific user within an org
Custom broadcastsArbitrary events beyond CRUD
Custom namespacesdefineRealtime() for type-safe event helpers
Ticket-based authHMAC-signed tickets verified at WebSocket upgrade — no HTTP round-trip

Enabling Realtime

Add realtime to individual table definitions:

export default defineTable(applications, {
  firewall: { organization: {} },
  realtime: {
    enabled: true,
    onInsert: true,
    onUpdate: true,
    onDelete: true,
    requiredRoles: ["recruiter", "hiring-manager"],
    fields: ["id", "candidateId", "stage"],
  },
});

And enable the realtime binding in your database config. The compiler generates the Durable Object class, helper functions, and wrangler bindings — all within your main worker.

Pages

  • Durable Objects Setup — Configuration, wrangler bindings, event formats, masking, and custom namespaces
  • Using Realtime — WebSocket connection, authentication, and client-side handling

On this page