RepoCloudflare (Workers AI)Cloudflare (Workers AI)published Dec 24, 2025seen 5d

cloudflare/durable-chat-template

TypeScript

Open original ↗

Captured source

source ↗

cloudflare/durable-chat-template

Language: TypeScript

Stars: 7

Forks: 3

Open issues: 1

Created: 2025-12-24T00:54:56Z

Pushed: 2026-04-23T21:01:14Z

Default branch: main

Fork: no

Archived: no

README:

Durable Chat App

![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/templates/tree/main/durable-chat-template)

!Template Preview

With this template, you can deploy your own chat app to converse with other users in real-time. Going to the demo website puts you into a unique chat room based on the ID in the url. Share that ID with others to chat with them! This is powered by Durable Objects and PartyKit.

How It Works

Users are assigned their own chat room when they first visit the page, and can talk to others by sharing their room URL. When someone joins the chat room, a WebSocket connection is opened with a Durable Object that stores and synchronizes the chat history.

The Durable Object instance that manages the chat room runs in one location, and handles all incoming WebSocket connections. Chat messages are stored and retrieved using the Durable Object SQL Storage API. When a new user joins the room, the existing chat history is retrieved from the Durable Object for that room. When a user sends a chat message, the message is stored in the Durable Object for that room and broadcast to all other users in that room via WebSocket connection. This template uses the PartyKit Server API to simplify the connection management logic, but could also be implemented using Durable Objects on their own.

Getting Started

Outside of this repo, you can start a new project with this template using C3 (the create-cloudflare CLI):

npm create cloudflare@latest -- --template=cloudflare/templates/durable-chat-template

A live public deployment of this template is available at https://durable-chat-template.templates.workers.dev

Setup Steps

1. Install the project dependencies with a package manager of your choice:

npm install

2. Deploy the project!

npx wrangler deploy

3. Monitor your worker

npx wrangler tail

Notability

notability 3.0/10

Routine repo template with low stars