---
title: "Run on Workers, Deno and Bun"
description: "Run the same MainSDK routes on Cloudflare Workers, Deno and Bun, know which interfaces each runtime lacks, and start from the edge reference."
section: "guides"
status: "Planned for 1.6"
spec: "more-runtimes"
canonical: "https://mainsdk.dev/docs/guides/run-on-edge-runtimes"
updated: "2026-10-28"
---

# 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: Planned for 1.6 · Canonical: https://mainsdk.dev/docs/guides/run-on-edge-runtimes · Updated: 2026-10-28

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-reference` if 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

```yaml title="main.yaml"
targets:
  edge:
    runtime: workerd
```

`mainsdk 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.decide` stays under 1 ms at p99 on Node, Bun and Deno. On Workers `performance.now()` only moves on I/O, so that budget is measured from outside.
