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 authenticated REST procedures, /openapi.json, a Hono notification route that emits to a channel, global session procedures, retained history, presence, and a React client.
Read the files in this order:
src/api.tsdeclares the REST metadata,session.whoami, and 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 and uses Hono for/openapi.jsonand/notifications.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, endpoint calls, and local secret setup.