Examples
Follow the runnable Cloudflare chat application from shared contract to server host and React client.
The Cloudflare chat example is a runnable application. It includes global session procedures, a room channel, typed client events, retained history, presence, and a React client.
Read the files in this order:
src/api.tsdeclaressession.whoamiand thechat.{roomId}channel.src/chat-server.tsimplements global procedures, channel authorization, events, and the channel-scopedinfoprocedure.src/worker.tsconnects those implementations to Cloudflare Durable Objects.src/app.tsxuses the client from a React view.
The example’s display-name bearer token is local development scaffolding. Replace identityFromRequest with your application’s authentication before deployment. Its README has the commands and local secret setup.