Establishing connection...

Chat


Chat is a real-time, multi-room WebSocket communication application. Built on Cloudflare Workers and utilizing Durable Objects, it supports persistent, synchronized, and low-latency chat sessions between multiple concurrent users within custom-defined rooms.

Technical Stack

State & WebSocket Sync

Compute EngineCloudflare Workers
State CoordinatorDurable Objects (Single-instance routing)
WebSocket SyncPartyKit (PartyServer API integration)
Session LogicWebSockets (in-memory pub/sub)

Data & Storage

DB EngineDurable Object SQL Storage API
Chat HistoryServerless SQL tables scoped per room
Frontend UIVanilla JS & WebSockets
LanguageTypeScript

Durable SQL Storage API: Instead of holding chat history entirely in RAM or making slow external database roundtrips, the chat room’s Durable Object writes directly to its own local, high-speed SQLite database file using Cloudflare’s SQL Storage API.

Core Features

  • Multi-Room Separation — Dynamic room generation based on URL slug paths. Users in the same URL route are grouped into a dedicated Durable Object instance.
  • WebSocket Broadcasts — Messages sent by a user are instantly broadcast to all active connections in that room, ensuring real-time text delivery.
  • Automatic History Load — When a new user opens a room, the Durable Object queries its local SQL table to retrieve and render the chat room’s message history.
  • PartyServer Simplicity — Leverages the PartyKit/PartyServer API to streamline socket connections and event routing without complex state management code.
Cloudflare WorkersDurable ObjectsSQL Storage APIWebSocketsPartyKitTypeScriptReal-Time Sync
visitor@christran.io — bash
visitor@christran.io:~$type a command and press Enter. try help or ls
visitor@christran.io:~$