Deploy your own
Publish the Worker + Durable Object to your own Cloudflare account and domain.
beam's edge is one Cloudflare Worker with one Durable Object class. Deploying it
is a few wrangler commands โ and once it's up, you own the whole tunnel: your
account, your domain, your token.
Prerequisites
- A Cloudflare account (the free plan includes Workers + Durable Objects).
node+npmlocally.
Deploy
cd worker
npm install
# The token the CLI must present to claim a name. Generate one:
openssl rand -hex 32
npx wrangler secret put API_TOKEN # paste it
npm run deploy # publishes the workerThat's it โ the Worker is live at its *.workers.dev URL. Point the CLI at it:
beam webhook listen myhook --server https://<your-worker>.workers.dev --token <the-token>Custom domain
To serve beam on your own subdomain, add a custom-domain route in
wrangler.jsonc (the apex zone must be on the same Cloudflare account) and
redeploy. Cloudflare auto-provisions DNS + TLS:
{
"routes": [
{ "pattern": "beam.example.com", "custom_domain": true }
]
}Then your public endpoint is https://beam.example.com/webhook/<name> and you can
bake server=https://beam.example.com into the config file.
Local dev
Copy .dev.vars.example โ .dev.vars, set API_TOKEN, then:
npm run devPoint the CLI at the local Worker (it serves over HTTP, so allow insecure):
beam webhook listen myhook --server http://localhost:8787 --insecureWhat's in the worker
worker/
โโโ src/index.ts router ยท token auth ยท WebhookHub DO (hibernation API)
โโโ wrangler.jsonc DO binding ยท sqlite migration ยท custom-domain route
โโโ .dev.vars.example local API_TOKEN
โโโ package.json wrangler scripts (dev/deploy/tail)See How it works for what each piece does at request time.