Web platform globals
The WHATWG web-platform globals modern JavaScript expects without an import: fetch and its Request/Response types, URL, the streams triple, Blob and the encoding primitives, WebCrypto, and events and timers. This page covers that surface and the three tiers, protocol crate, host module, and runtime intrinsic, each global is built from.
Beyond the language and the Node modules, Cruft ships the WHATWG web-platform surface modern JavaScript assumes ambiently: fetch and its value types, URL, streams, binary and encoding primitives, WebCrypto, and events/timers. All are globals, no import, matching the shape code written for browsers, Node 18+, and edge runtimes expects. This page covers the surface and the three-tier ownership architecture behind it.
The ownership architecture
Every web global is built from up to three tiers, and the split is a deliberate governing rule:
| Tier | Owns | Examples |
|---|---|---|
| Protocol crates | reusable protocol/data layers, no I/O | URL parsing, TLS records, WebCrypto primitives, stream machinery, form encoding |
| Host modules | I/O, clocks, network capability, process state | the actual socket under fetch, the timer wheel |
| Runtime intrinsics | the JavaScript-visible objects and glue | the URL constructor your code sees |
The payoffs: these crates are testable as pure Rust without a running engine; the capability system hooks the host tier, so sealed mode covers fetch exactly as it covers node:http (there is no "web API" hole in the sandbox); and one implementation serves many surfaces, the same TLS stack sits beneath fetch, node:https, and node:tls.
Networking: URL and fetch
The WHATWG value types are complete and faithful: URL parses into live components whose setters re-serialize href; URLSearchParams is an ordered multimap with form-encoding semantics (+ for spaces, correct percent-escaping), and a URL's searchParams is a live view, mutating it rewrites the URL. These types carry a disproportionate share of ecosystem weight (every router, every HTTP client wrapper), which is why they get dedicated crates.
fetch performs real HTTP/1.1 over http:// and https:// with Request/Response/Headers as spec-shaped value types, and response.body is a real streaming ReadableStream. Redirect following and AbortSignal wiring both work: a fetch follows cross-host redirects, and passing an AbortController's signal aborts an in-flight request. Both were gaps earlier in development and have since been closed.
Streams
The WHATWG streams triple, ReadableStream, WritableStream, TransformStream, is implemented with the spec's actual mechanics: pull-driven flow, high-water-mark backpressure, and promise-based reader/writer locks. pipeThrough composes transforms. These are the plumbing beneath web-shaped I/O generally, so the implementation lives in its own crate; node:stream is a separate Node-idiom adapter (documented in the Node compatibility layer). The two stream worlds are siblings over the same underlying machinery; neither wraps the other, matching how Node itself ships both.
Binary and encoding
The full binary toolkit a web-shaped program reaches for, with Blob covering byte parts, UTF-8 string encoding, async text()/arrayBuffer() readers, and slice:
structuredClone is the same structured-clone machinery that underlies worker send in Imogen, exposed as a global. The clone semantics you can observe synchronously, what's cloneable, how graphs and cycles copy, functions rejected, are the same rules that govern what crosses a worker boundary. The same implementation serves both.
WebCrypto
crypto ships the two synchronous random primitives (randomUUID, getRandomValues) and a complete crypto.subtle: digest (SHA-1/256/512), HMAC, AES-GCM, ECDSA over P-256, P-384, and P-521, RSA sign/verify, HKDF/PBKDF2/ECDH derivation and agreement, X25519 and Ed25519, and full key interchange, spki/pkcs8 DER in both directions plus jwk import and export for EC keys.
(See TLS and cryptography for the implementation and its security boundaries.) Two things make this surface notable. First, completeness of the algorithm set: subtle is one of the few large web surfaces Cruft states as done rather than tiered, it is the modern ecosystem's JWT/signature/key-exchange workhorse, so partial support would poison a long tail of auth libraries. Second, ownership: the primitives are the project's own, the same independence that defines the engine extends to the cryptography. The capability angle from the compartments page applies here too: a tenant's clock can be coarsened, and crypto randomness is a granted capability like any other authority.
Events, timers, and diagnostics
These are the WHATWG eventing spine (with once listeners, removeEventListener, defaultPrevented, the semantics libraries feature-detect), alongside the timers that span both idioms, including Node's setImmediate:
All of them are feeders of the job queue documented in the Exegesis, host surfaces that convert time and events into enqueued jobs, with the queue's drain order as the only contract.
console and performance round out diagnostics; the console surface is substantive (group, table, count, and time all function, and table renders real box-drawn output).