Official package · Automation and infrastructure
Cloudflare Worker templates, deployed in one click
Ready-made Workers that run on your own Cloudflare account, next to your site. Press Deploy to Cloudflare, enter your app key and secret, and the Worker handles one job at the edge: signing private and presence channels for your logged-in users, or holding visitors in a waiting room. Your channels, queues and settings stay in your Hibira account.
Cloudflare Worker templatesGitHub ↗Deploy to Cloudflare ↗
Fastest way: one prompt with the Hibira plugin
Install the plugin in your AI coding agent and paste the prompt. The agent signs you in, creates a free app if you need one, writes the code and sends a test event. GitHub ↗
Install the plugin
claude plugin marketplace add hibira-io/agent-plugin claude plugin install hibira@hibiraPaste this prompt
Add Hibira Cloudflare Workers (Cloudflare Worker templates) to this project. Follow https://hibira.io/guides/cloudflare, adapted to how this project is already set up. If I have no Hibira app yet, create a Free one that allows http://localhost so I can test right away. Keep the app key and secret in environment variables, add placeholders to .env.example, and never commit real values or send the secret to a browser. When you are done, send a test event, show me it arriving, and list the files you changed.
Prefer to do it by hand? These are the steps below:
- Channel auth: private and presence channels for sites and apps with no backend. It checks the token your login already issues (Clerk, Auth0, Supabase, Firebase, Cloudflare Access or your own) and signs only the channels your rules allow, such as each user’s own private-user channel.
- Waiting room: a queue in front of any page behind Cloudflare, with no code changes, on any Cloudflare plan.
- Sending without a backend: with PUBLISH set, signed-in users send chat messages, votes and reactions through the channel auth Worker’s /publish. It fills in the sender from the login token, so nobody can post as someone else.
- AI streaming: the backend for an AI chat built with useChat(). Answers from Workers AI, Anthropic or any OpenAI-compatible model reach every tab over a channel, keep going after the tab closes and pick up again after a reload.
- Each template is a folder in one repository, with its settings explained and a way to deploy without the button. All of them fit the Workers free plan.
Sign in to see these snippets with your own cluster host. Sign in
Install
https://deploy.workers.cloudflare.com/?url=https://github.com/hibira-io/cloudflare/tree/main/channel-auth → sign in to Cloudflare and GitHub → HIBIRA_KEY, HIBIRA_SECRET: from your app page → JWKS_URL: your login's public keys, for example https://YOUR-APP.clerk.accounts.dev/.well-known/jwks.json → CHANNELS: private-user-{id},presence-* → DeployUse it
import Pusher from 'pusher-js'; const auth = 'https://hibira-channel-auth.YOUR-SUBDOMAIN.workers.dev'; const headersProvider = () => ({ Authorization: `Bearer ${getToken()}` }); const pusher = new Pusher('YOUR_APP_KEY', { cluster: 'hkg', wsHost: 'ws.hibira.io', enabledTransports: ['ws', 'wss'], channelAuthorization: { endpoint: `${auth}/pusher/auth`, headersProvider }, userAuthentication: { endpoint: `${auth}/pusher/user-auth`, headersProvider }, }); pusher.subscribe(`private-user-${userId}`).bind('order.shipped', (order) => { console.log('Your order shipped', order); });Send events
// PUBLISH: presence-room-* PUBLISH_EVENTS: message HIBIRA_APP_ID: your app ID await fetch(`${auth}/publish`, { method: 'POST', headers: { 'Content-Type': 'application/json', ...headersProvider() }, body: JSON.stringify({ channel: 'presence-room-1', event: 'message', data: { text: 'Hello' } }), }); // Everyone on the channel gets data.sender from the token: { id, name, picture } pusher.subscribe('presence-room-1').bind('message', ({ text, sender }) => show(sender.name, text));
Before you start
- getToken() returns your login’s current token, for example await clerk.session.getToken() or the access_token of a Supabase session. The Worker checks its signature, expiry, issuer and audience before signing anything.
- In CHANNELS, {id} is the user’s ID, {claim} any claim in the token and * the rest of the name, so private-org-{org_id}-* lets members of an organisation share its channels.
- Your app secret is stored as a Worker secret and never reaches the browser. The Worker keeps no data.
- Typing hints, cursors and other things that are fine to miss can go straight from the browser as client- events on a private or presence channel, once Client events is on in the app’s settings.
- Messages that start from a change in your data are better sent from where the change happens: a Supabase Edge Function, a Firebase Cloud Function, or the Hibira nodes for n8n, Make, Activepieces and Node-RED.
- Open the Worker’s own address in a browser to see whether its setup is complete and which settings are missing. The page is in your language and never shows a setting’s value.
Use the app key from your dashboard; the secret stays on your server. Channels, events and authorization endpoints work exactly as they do with Pusher. Create your free account →