Orange Book
Build

Workers Runtime versus Node.js

Decide whether code will run on Workers by checking Web APIs, compatibility dates, and Node compatibility.

Edited and verified by Orange Book Editorial Team ·

BUILDINTERMEDIATE18 minutesVerified 2026-08-26

Core decision

Workers is centered on Web Platform APIs; it is not simply a nearby Node server. Check whether an API exists, then the compatibility date, and only then consider a polyfill.

Three compatibility states

StateMeaningAction
Fully supportedWorkers implements the APIAdd a small runtime test
Partially supportedOnly some methods or behavior workRead the API-specific limits
StubImport works but calls throwNever treat a successful build as runtime proof

For a new Worker whose compatibility date is 2026-08-04 or later, Node.js compatibility and v2 are enabled by default and the official guidance says to omit the positive flag. Do not blindly rewrite an older project: preserve its date, run regression tests, and advance the date deliberately.

Think in edge primitives

export default {
  async fetch(request: Request): Promise<Response> {
    const url = new URL(request.url);
    const upstream = await fetch(`https://api.example.com${url.pathname}`);
    return new Response(upstream.body, upstream);
  },
};

This uses Request, Response, URL, and fetch; it assumes no filesystem, resident process, or mutable memory shared reliably across requests.

Review AI-generated code

  1. Search for fs, net, child_process, native binaries, and server-listen code.
  2. Classify each API against the current Node compatibility table; an import is not evidence.
  3. Execute success and failure branches with wrangler dev.
  4. Update compatibility dates in an isolated change with behavior notes.

Continue across runtimes and toolchains

  • When Bun manages dependencies and invokes Wrangler, deployed code still executes in workerd. The Bun guide to Cloudflare Workers focuses on that boundary.
  • Deno and Workers expose many Web APIs, but their permission, persistence, deployment, and Node compatibility models are not interchangeable. Read Deno versus Node and Bun, then bring each dependency back to this page for verification.

Use the related technology guide network for the complete cross-site map.

Primary sources

Did this page help you complete your goal?

Beta feedback is generated in this browser and is never uploaded automatically.

On this page