Skip to content

Latest commit

 

History

History

README.md

Dynamic Workers

Demonstrates Dynamic Worker Loaders — spin up sandboxed, disposable isolates at runtime from a host Worker.

Deploy to Cloudflare

Get started

npm install   # from the repo root
npm start     # from this directory

How it works

The host Worker exposes a /api/run endpoint. The React frontend sends user-written code to it, and the server loads it into a one-off dynamic isolate:

const worker = env.LOADER.load({
  compatibilityDate: "2026-01-28",
  mainModule: "worker.js",
  modules: {
    "worker.js": code
  },
  globalOutbound: null
});

const result = await worker
  .getEntrypoint()
  .fetch(new Request("https://worker/"));
  • LOADER.load() — creates a one-off dynamic isolate
  • globalOutbound: null — blocks all outbound network access from the dynamic Worker

Learn more