Cloudflare Workers
Deploy with D1, cron triggers and a Worker that owns both fetch and scheduled.
A Cloudflare deployment is a Worker that does two things: serve the framework
and run the scheduler. The generator's overlay wires both, binds D1 before
every request and points wrangler at the bundled migrations.
The Worker
cloudflareWorker(statusPage) returns { fetch, scheduled }. The generated
Worker keeps its own fetch so the framework handler can serve pages and
assets, and reuses scheduled, which wraps the run in context.waitUntil().
Cron triggers
The three expressions must match checks.interval, checks.summaryCron and
checks.cleanupCron. Derive them instead of copying:
runCloudflareScheduled() compares the incoming event.cron against the
three configured expressions and runs only the matching job. An unknown
trigger is deliberately a no-op, which makes stale cron configuration during
a deploy harmless.
Deploy
- 1
Create the database
bashCopy the returned
database_idintowrangler.jsonc. - 2
Apply migrations
bash - 3
Set secrets
bashWithout it the management API answers
503— which is the safe default, not a working configuration. - 4
Build and publish
bash - 5
Verify
bashThen trigger a check once so the page is not empty:
bash
Local development
bun dev on a Cloudflare project migrates the local D1 state and builds and
serves the actual Worker — it is not a framework hot-reload proxy. Re-run
it after changing application code.
That is deliberate: a framework dev proxy cannot catch Worker-only startup errors, which are exactly the failures a Cloudflare deployment produces.
Platform constraints
Workers do not expose node:net or node:tls, so
tcp and ssl monitors record
… monitoring is unavailable in this runtime. and report down.
Use http and dns, which work everywhere, and run
certificate checks from a Node or Bun host if you need them.
nodejs_compatis required for the framework server bundle.- The snapshot cache is per-isolate, which absorbs bursts but is not shared.
- Keep
checks.intervalwithin Cloudflare's cron granularity for your plan.