Beta build. Report issues to your operator channel.

← All guides · Home

Guide

How to build instant messaging on Cloudflare Workers

cloudflare workers websocket + durable objects chat — shared state coordination per room, D1 history, realtime without a VPS. For Cloudflare Pages, Vercel, or Netlify fronts.

Start with Cloudflare’s chat demo (mental model)

The official Workers WebSocket chat example shows: Worker upgrade → one Durable Object per room → fan-out to connected clients. Treat it as hello-world, not multi-tenant production.

Cloudflare Workers WebSocket chat demo

Use Cloudflare’s vocabulary

Buyers researching DOs see the same phrases in official docs: coordination, shared state, chat rooms, WebSocket hibernation, transactional consistency. FluxyChat is the production chat layer built on those primitives.

Rules of Durable Objects

Understand what production adds

  • JWT auth per tenant and room membership checks in D1.
  • History pagination and reconnect/backoff on the client.
  • Quotas, webhooks, GDPR export, operator console.
  • Human + agent events on the same room WebSocket.

Pick your deploy split

Next.js or Nuxt on Vercel/Netlify for HTTP + UI; FluxyChat Worker on Cloudflare for chat. Avoid Vercel WebSocket limits and a second Pusher/Ably vendor.

Go deeper with a walkthrough

Worker routing at `/ws/room/:roomId`, RoomDurableObject, SDK useChat, and self-host commands — in the long-form Dev.to article.

How to Build a Realtime Chat App on Cloudflare Workers (Without Managing a Socket Fleet)

Production next step

FluxyChat packages the same stack: RoomDurableObject, D1 history, multi-tenant JWT, reconnect-aware SDK, and operator console. MIT self-host or hosted beta.

Topics: cloudflare workers websocket · durable objects chat · shared state coordination · pusher alternative · realtime without vps · vercel websocket limits · ably alternative next.js

Canonical path: /guides/cloudflare-workers-chat