Skip to content
Runtime APIs / Runtime globals

Runtime APIs

Runtime globals

Your Worker gets Cloudflare's globals on Node.js, such as fetch(), Request, crypto, streams, timers, and WebSocket, under one fixed compatibility profile.

Drop-in

Runs on Node.js runtime with workerd-shaped globals, cloudflare:* and node:* modules

Works
fetch(), Request, Response, Headers, URL, streams, crypto, timers, WebSocket, and WebSocketPair
Differs
One fixed compatibility profile: Orange ignores your compatibility_date and most compatibility_flags
Missing
URL.createObjectURL(), custom fetchers, and some Cloudflare crypto algorithms
Migration
Not needed A Worker holds no data. Deploy its code to Orange.
Scales by
Runner count

Your Worker sees the same globals as on Cloudflare, such as fetch(), Request, Response, crypto, streams, timers, and WebSocket. Orange installs them on Node.js before your Worker’s module loads.

Quickstart

  1. Keep your Wrangler file

    Leave compatibility_date and compatibility_flags as they are. Orange always runs 2026-09-03 with nodejs_compat.

    {
      "name": "hash",
      "main": "src/index.ts",
      "compatibility_date": "2026-09-03",
      "compatibility_flags": ["nodejs_compat"]
    }
  2. Use the globals

    Call crypto, TextEncoder, and Response as on Cloudflare.

    export default {
      async fetch(request): Promise<Response> {
        const data = new TextEncoder().encode(await request.text());
        const digest = await crypto.subtle.digest("SHA-256", data);
        const hex = [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, "0")).join("");
        return Response.json({ sha256: hex });
      },
    } satisfies ExportedHandler;
  3. Run it

    orange dev warns about each flag that it does not need:

    orange dev
    ! Orange always has Node.js APIs, so it does not need compatibility_flags ["nodejs_compat"]

    Hash a string:

    curl -d hello localhost:8787
    {"sha256":"2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"}

How it works

  • Orange installs every Cloudflare global before your Worker’s module runs, so code at module scope sees them too.
  • Most are the Node.js and Undici implementations, adapted to match workerd where the conformance tests compare the two.
  • console writes to the orange dev output. An unhandled rejection or an exception in a timer is printed there, and the Worker keeps running.
AI context Compatibility, limits and details

Written for LLMs and coding agents: every edge case, measurement, and known deviation. You do not need it to use the feature.

Compatibility

FeatureStatusNotes
atob, btoa, ByteLengthQueuingStrategy, CountQueuingStrategy, CustomEvent, queueMicrotask, TextDecoder, TextEncoder, and WebSocketRequestResponsePairSupported
The other 68 globals, such as fetch, Headers, Request, Response, URL, URLSearchParams, Blob, FormData, DOMException, Event, the streams, crypto, console, performance, structuredClone, WebAssembly, WebSocket, WebSocketPair, caches, HTMLRewriter, scheduler, and the four timer functionsPartialEach family has its own section below.
Body, ExtendableEvent, FetchEvent, origin, ScheduledEvent, and TailEventNot supportedSee The global manifest.
URL.createObjectURL()Not supportedSee Deviations.
compatibility_date and compatibility_flagsPartialOne fixed profile. See Compatibility date and flags.

Limits

Orange does not copy Cloudflare’s resource limits on the globals (see Deviations). A global that Node.js or Undici backs has that implementation’s limits. A request has no time limit; see Fetch events.

The global manifest

Orange intersects the value-bearing declarations with the globals exposed across the pinned workerd global prototype chain. The current profile has 83 Cloudflare global names. Before it loads the Worker entrypoint, the runtime installs a manifest with exactly those names.

  • packages/runtime-node/src/globals/implementations.ts holds the status of each name: implemented, partial, or not implemented.
  • A partial value must be assignable to the complete Cloudflare contract. An implemented value also needs exact inferred types.
  • A global that Orange does not implement keeps the Node.js value of that name when Node.js has one. Otherwise it is a placeholder. Calling or constructing it, or reading or setting a property, throws Cloudflare global <name> is not implemented by OpenOrange.
  • Headers, Request, Response, URL, URLSearchParams, Blob, DOMException, Event, ReadableStream, WritableStream, TransformStream, console, and the four timer functions are backed by pinned Undici or Node.js primitives.
  • performance and structuredClone() use the captured Node.js web-platform implementations. WebAssembly exposes the captured Node.js namespace.
  • The runtime captures the Node.js constructors and functions before it installs the Cloudflare manifest, so the HTTP substrate, Cap’n Web, and RivetKit keep using compatible host primitives.
  • Node.js globals without a Cloudflare counterpart stay available at runtime, but the generated Worker types leave them out.

Compatibility date and flags

Orange runs one profile, 2026-09-03 with nodejs_compat. Worker code should behave as it does on Node.js, so Orange does not switch runtime behavior by date or flag. orange dev warns about each flag that it does not apply:

! Orange always has Node.js APIs, so it does not need compatibility_flags ["nodejs_compat"]
! Orange ignores compatibility_flags ["streams_enable_constructors"]
In wrangler.jsoncOn Orange
compatibility_dateIgnored, except for static assets: from 2025-04-01, navigation requests prefer asset serving, as on Cloudflare. See Static assets.
nodejs_compat, nodejs_compat_v2, and nodejs_alsNode.js APIs are always on. orange dev prints the first warning above.
request_signal_passthrough and no_request_signal_passthroughApplied. With request_signal_passthrough, a copy of an incoming request also follows its client’s disconnect. Without it, the default, a copy passed to a subrequest or over RPC does not.
assets_navigation_prefers_asset_serving and assets_navigation_has_no_effectApplied. See Static assets.
Any other flagIgnored. orange dev prints the second warning above.

HTTP

  • The HTTP globals support normalized headers, repeated Set-Cookie values, buffered request and response bodies, cloning, the body readers, and the Response.error(), Response.redirect(), and Response.json() constructors.
  • URL parsing, mutation, query iteration, and live searchParams mutation work.
  • Outbound fetch() converts an Orange request to the pinned Undici substrate, and wraps its response back into a Worker-compatible response. Blob and FormData bodies work.
  • A request with a custom fetcher throws NotSupportedError: Custom request fetchers are not implemented yet. The encodeResponseBody option throws NotSupportedError: encodeResponseBody is not implemented yet.
  • When Orange sends a response whose Content-Encoding is exactly gzip or br, it compresses the body and drops Content-Length, as workerd does.
  • A response created with encodeBody: "manual" already holds encoded bytes, so Orange sends them as they are.
  • The two rules above apply to Worker responses, Durable Object fetch() responses, and service binding responses, whose callers read the decoded body.
  • The encoding and HTTP implementations delegate their substrate behavior to Node.js, and conform to the pinned Cloudflare constructors.

Streams

  • A ReadableStream body is used as is, so it locks only when the body is read.
  • Reading a body accepts any ArrayBuffer or ArrayBufferView chunk, as workerd does.
  • An iterable body becomes a stream whose cancel() calls the iterator’s return().
  • A byte ReadableStream that does not set autoAllocateChunkSize gets workerd’s default of 4096 bytes, so a default read still exposes controller.byobRequest.

WebSockets

  • WebSocket supports outbound client connections, as RivetKit and Cap’n Web use them.
  • WebSocketPair creates two entangled Worker endpoints, with acceptance, queued delivery, copied text and binary frames, close validation, close events, and the latest default close auto-reply behavior.
  • Response accepts a pair endpoint with status 101 and exposes it through response.webSocket. The runtime couples that endpoint to real client and Durable Object transport connections.
  • A status-101 WebSocket response keeps its socket. It rejects cloning, a non-null body, a missing socket, and a status other than 101, as pinned workerd does.
  • serializeAttachment() and deserializeAttachment() work on WebSocket endpoints.

Crypto

crypto delegates standard Web Crypto operations to Node.js. It adds the Cloudflare extensions that the current Workers types use: subtle.timingSafeEqual(), and streaming SHA-1, SHA-256, SHA-384, and SHA-512 digests through crypto.DigestStream.

Timers and microtasks

  • setTimeout() and setInterval() return a Timeout object that converts to its numeric ID, as workerd does with enable_nodejs_global_timers. It has ref(), unref(), hasRef(), and refresh(), for Node.js libraries that expect timer handles.
  • IDs come from one shared pool, and either clear function cancels a timeout or an interval.
  • queueMicrotask(), setTimeout(), and setInterval() reject a callback that is not a function when they are called.

Errors and diagnostics

  • console forwards to the Node.js console captured before the Worker globals are installed, so Worker diagnostics reach the orange dev output.
  • An unhandled promise rejection is reported as a background diagnostic, and does not stop the shared runtime process.
  • The global scope dispatches unhandledrejection and rejectionhandled events, as workerd does.
  • An exception thrown from a timer, a microtask, or an event listener is reported the same way, and does not stop the runtime process.

Deviations

  • fetch() decodes deflate response bodies through Undici. Workerd decodes only gzip and br, and passes other codings through.
  • URL.createObjectURL() throws URL.createObjectURL is not implemented yet.
  • These are not implemented: Cloudflare-specific outbound request metadata, some Cloudflare crypto algorithms, exact stream queuing semantics, exact timer delays, scheduling and resource-limit behavior, performance-entry semantics, and structured-clone host types.
  • A global that keeps its Node.js value behaves as Node.js does. Orange has not verified it against workerd.

Conformance

  • The conformance check verifies that the global manifest has no missing or extra Cloudflare names, checks supported values against the reference contract, and runs behavior fixtures against the pinned Cloudflare runtime.
  • The HTTP fixture compares header iteration and Set-Cookie handling, buffered request bodies, cloning, response constructors, status metadata, and the exact tested errors.
  • The WebSocket fixture compares the pair’s shape, upgrade responses, queued text and binary frames, close validation, event data, ready states, and close auto-reply.
  • The check also verifies that the manifest is installed before the Worker module evaluates.
  • src/config/load-wrangler.test.ts checks that another compatibility date loads, and the two warnings for ignored flags.

Recorded results from the conformance run of 2026-11-10 (Orange ea40348), 1,670 of 1,851 tests passing across every area. Each check is works when every result passed and partial when some did. The full feature matrix is on the compatibility page.

Workers
Check Status Results