Bringing Node.js Compatibility to Workers
Cloudflare Workers launched three years ago with JavaScript support powered by V8 Isolates, letting developers run code across data centers in over 100 countries. Now the platform is extending that foundation to accommodate the Node.js ecosystem—without abandoning its sandboxed architecture.
Workers and Node.js share a common DNA: both run JavaScript on V8. But the similarities end there. Node.js assumes a server environment with generous resources, while Workers runs on lightweight Isolates designed for fast cold starts and secure multi-tenancy. That design difference shapes how Cloudflare is approaching Node.js compatibility.
What Works Today
A significant portion of the npm ecosystem already runs on Workers. Over 20,000 packages that rely on webpack or another polyfill bundler are compatible with the platform out of the box. That includes widely used libraries for encryption (node-jose), routing (itty-router), and API queries (graphql).
To help developers identify compatible dependencies, Cloudflare maintains a catalogue of vetted libraries. Once you pick a package, you can bundle it with the wrangler CLI's webpack support and deploy it as a Worker. This approach mirrors how Gatsby users can deploy static sites to Workers with their existing build pipeline.
What's Coming Next
The polyfill-based approach has limits. Node.js packages tend to be large because server-side code rarely worries about download size. Workers currently cap code at 1MB, which bundling can quickly exhaust. Cloudflare plans to raise that limit so developers don't have to compromise on dependencies.
Beyond packaging, the next phase is supporting native Node.js modules—those that rely on underlying system APIs. The goal is to reimplement the most important modules and polyfill their functionality directly into the Workers runtime, not to run Node.js itself. That distinction matters for two reasons:
- Node.js was never designed as a sandbox. Its own
vmmodule documentation warns against running untrusted code. - True sandboxing would require containers, which sacrifice the performance and 0ms cold starts that Isolates provide.
Cloudflare is starting with the Stripe.js SDK and Twilio Client JS SDK, plus the net module so popular database clients can connect. The company is also crowd-sourcing priorities through a leadership board where developers can vote on which libraries and APIs matter most—whether that's statistics packages, email utilities, or templating engines.
The effort to make popular Node.js libraries work seamlessly is ongoing, but the direction is clear: support the ecosystem without compromising the security or performance model that defines Workers.



