Run on Workers, Deno and Bun
Run the same MainSDK routes on Cloudflare Workers, Deno and Bun, know which interfaces each runtime lacks, and start from the edge reference.
Status Status is where the work is: Planned (in a milestone, not started), Building (tickets in progress), Preview (usable, may change), then the stability it ships at.
Stability The promise an interface ships with.
- Stable Follows semantic versioning; breaking changes need a new major, 12 months of overlap and a codemod.
- Beta Usable in production; may change before it becomes stable.
- Experimental May change or go away; needs an explicit opt-in in main.yaml.
You will run one set of routes on three runtimes and see which parts a runtime can't run. It takes about 15 minutes.
You need
- A MainSDK app. Start from
apps/examples/edge-referenceif you have none.
1. Keep routes as a Request in and a Response out
The reference's src/routes.ts takes the policy engine and email interface as arguments and returns a Response, so Hono mounts it on Workers and a test calls it directly. Nothing in it imports a Node module.
2. Declare the runtime
targets:
edge:
runtime: workerdmainsdk check raises MAIN-PORT-0001 when you add disk, system or cluster to a workerd target. RUNTIME_GAPS lists every declared gap per runtime with its fix.
3. Run the checks the reference runs
.github/workflows/ci.yml runs mainsdk check and mainsdk assure --standard soc2 on every pull request.
Check that it works
- The portable suite prints one JSON line on each runtime with the same test count.
policy.decidestays under 1 ms at p99 on Node, Bun and Deno. On Workersperformance.now()only moves on I/O, so that budget is measured from outside.
Was this page helpful?