workerd / node
AGENTS.md8.8k starsChanged 9 months agoApache-2.0View on GitHub
TypeScript and JavaScript layer implementing Node.js compatible built-in modules for Workers. It is split across multiple layers: It is common, but not required, for top-level .ts files to re-export from internal/ via node-internal: specifiers. This allows for a clean separation between public API surface and internal implementation details. See README.md for 12 policy rules governing compat scope and philosophy. node:* modules are gated behind the nodejs_compat compatibility flag. The node:async_hooks module can be enabled individually via the nodejs_als compatibility flag.
Trending
Quiet since August.thin dataabout the whole repository
Who's talking about cloudflare/workerd
- A Hacker News story“OS Workerd, Cloudflare's JavaScript/WASM Runtime”Hacker News · Sep 27, 2022 · 27 points
- withastro/astro“Cloudflare adapter returning [object Object]”GitHub · Oct 10, 2025 · 18 reactions
- supabase/supabase-js“The 'cache' field on 'RequestInitializerDict' is not implemented - Cloudflare Workers”GitHub · Mar 28, 2024 · 16 reactions
- nodejs/node“src: improve buffer.transcode performance”GitHub · Aug 1, 2024 · 13 reactions
- NixOS/nixpkgs“Package request: workerd”GitHub · Nov 12, 2024 · 12 reactions
The biggest 5 of 12 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 12
Talked about on GitHub, Bluesky and Hacker News (12 times).
On GitHub · 6
- Oct 10, 2025Cloudflare adapter returning [object Object] — withastro/astro18 reactions · 15 comments
- Mar 28, 2024The 'cache' field on 'RequestInitializerDict' is not implemented - Cloudflare Workers — supabase/supabase-js16 reactions · 24 comments
- Aug 1, 2024src: improve buffer.transcode performance — nodejs/node13 reactions · 26 comments
- Nov 12, 2024Package request: workerd — NixOS/nixpkgs12 reactions · 8 comments
- Feb 19, 2024Add Curve25519 — w3c/webcrypto9 reactions · 16 comments
1 more on GitHub
- Nov 3, 2025Optimize TextEncoder::encode — nodejs/performance7 reactions · 33 comments
On Bluesky · 4
- Mar 24, 2026workerd : le runtime JavaScript/Wasm open source de Cloudflare Workers — @news.humancoders.com4 likes and reposts
- Aug 22, 2026Current status: trying to build github.com/cloudflare/w... on various sandbox providers — @jeremymorrell.dev1 likes and repost
- Mar 24, 2026workerd : le runtime JavaScript/Wasm qui propulse Cloudflare Workers est maintenant open source. Basé sur les standards web, il permet… — @humancoders.com1 likes and repost
- Nov 5, 2024Technically workers are open source github.com/cloudflare/w... — @userops.bsky.social1 likes and repost
On Hacker News · 2
- Sep 27, 2022OS Workerd, Cloudflare's JavaScript/WASM Runtime27 points · 2 comments
- Oct 5, 2023Cloudflare workers is adopting Ada URL parser2 points
In this repository61 other files it gives its agents.
- AGENTS.mdAGENTS.md
- build/AGENTS.mdAGENTS.md
- src/cloudflare/AGENTS.mdAGENTS.md
- src/per_isolate/AGENTS.mdAGENTS.md
- src/per_isolate/crypto/AGENTS.mdAGENTS.md
- src/per_isolate/webfs/AGENTS.mdAGENTS.md
- src/per_isolate/webstreams/AGENTS.mdAGENTS.md
- src/pyodide/AGENTS.mdAGENTS.md
- src/rust/AGENTS.mdAGENTS.md
- src/rust/cxx/AGENTS.mdAGENTS.md
- src/tests/node/AGENTS.mdAGENTS.md
- src/tests/node/http-client/AGENTS.mdAGENTS.md
- src/tests/node/http-server/AGENTS.mdAGENTS.md
- src/tests/node/net/AGENTS.mdAGENTS.md
- src/tests/node/stream/AGENTS.mdAGENTS.md
- src/tests/streams/AGENTS.mdAGENTS.md
- src/tests/streams/cache/AGENTS.mdAGENTS.md
- src/tests/streams/compression/AGENTS.mdAGENTS.md
- src/tests/streams/digest/AGENTS.mdAGENTS.md
- src/tests/streams/encoding/AGENTS.mdAGENTS.md
- src/tests/streams/formdata/AGENTS.mdAGENTS.md
- src/tests/streams/htmlrewriter/AGENTS.mdAGENTS.md
- src/tests/streams/identity/AGENTS.mdAGENTS.md
- src/tests/streams/inspect/AGENTS.mdAGENTS.md
- src/tests/streams/iocontext/AGENTS.mdAGENTS.md
- src/tests/streams/piping/AGENTS.mdAGENTS.md
- src/tests/streams/r2-patterns/AGENTS.mdAGENTS.md
- src/tests/streams/readable/AGENTS.mdAGENTS.md
- src/tests/streams/readable-byte/AGENTS.mdAGENTS.md
- src/tests/streams/scaling/AGENTS.mdAGENTS.md
- src/tests/streams/sockets/AGENTS.mdAGENTS.md
- src/tests/streams/strategies/AGENTS.mdAGENTS.md
- src/tests/streams/transform/AGENTS.mdAGENTS.md
- src/tests/streams/writable/AGENTS.mdAGENTS.md
- src/workerd/api/AGENTS.mdAGENTS.md
- src/workerd/api/crypto/AGENTS.mdAGENTS.md
- src/workerd/api/node/AGENTS.mdAGENTS.md
- src/workerd/api/streams/AGENTS.mdAGENTS.md
- src/workerd/io/AGENTS.mdAGENTS.md
- src/workerd/jsg/AGENTS.mdAGENTS.md
- src/workerd/server/AGENTS.mdAGENTS.md
- src/workerd/util/AGENTS.mdAGENTS.md
- types/AGENTS.mdAGENTS.md
- bazel-test-hygieneSkill
- commit-categoriesSkill
- dad-jokesSkill
- find-and-run-testsSkill
- identify-reviewerSkill
- investigation-notesSkill
- kj-styleSkill
- markdown-draftsSkill
- parent-project-skillsSkill
- pr-review-guideSkill
- receiving-code-reviewSkill
- rust-reviewSkill
- ts-styleSkill
- update-v8Skill
- wd-test-formatSkill
- workerd-api-reviewSkill
- workerd-safety-reviewSkill
- The first 60 shown.
The file
Files
src/node/ — Node.js Compatibility (TypeScript)
OVERVIEW
TypeScript and JavaScript layer implementing Node.js compatible built-in modules for Workers.
It is split across multiple layers:
- An internal layer consisting of:
- Non-user-importable TypeScript and JavaScript files in
internal/that implement core logic, utilities, and C++ JSG module declarations. - C++ JSG modules (
src/workerd/api/node/) expose native ops vianode-internal:*specifiers - Some native internal modules may be implemented in Rust
- Non-user-importable TypeScript and JavaScript files in
- A public layer of TypeScript files at the top-level that are user-importable.
It is common, but not required, for top-level .ts files to re-export from internal/ via node-internal: specifiers. This allows for a clean separation between public API surface and internal implementation details.
See README.md for 12 policy rules governing compat scope and philosophy.
MODULE GATING
node:* modules are gated behind the nodejs_compat compatibility flag.
The node:async_hooks module can be enabled individually via the nodejs_als compatibility flag.
Runtime compat flags checked via Cloudflare.compatibilityFlags['flag_name']:
| Flag | Guards |
enable_nodejs_http_server_modules | http Server/createServer, https Server |
nodejs_zlib | zlib streaming classes (Deflate, Gzip, etc.) |
enable_nodejs_process_v2 | Extended process/events functionality |
remove_nodejs_compat_eol_v22/v23/v24 | EOL deprecation of specific API surfaces (crypto, util, tls, process) |
Most modules require nodejs_compat + nodejs_compat_v2 flags (enforced by C++ side, not visible here).
ADDING NEW INTERNAL MODULES
New .ts and .js files in internal/ are auto-discovered by the build system via
glob(["internal/*.ts", "internal/*.js"]) in BUILD.bazel. No explicit registration is needed —
just create the file and it becomes importable via its node-internal: specifier.
For example, creating internal/internal_fs_glob.ts immediately makes
node-internal:internal_fs_glob available as an import specifier. No changes to BUILD.bazel or
any registration macro are required.
What does require explicit wiring:
- New top-level
node:*public modules need a corresponding.tsfile insrc/node/and must be registered in the C++ module registry (src/workerd/api/node/node.h, theNODEJS_MODULESmacro). - New C++ JSG native modules require a
.d.tsdeclaration file ininternal/to declare the shape of the native module.
CONVENTIONS
internal/*.js(not.ts) = upstream Node.js ports (streams_readable.js, streams_writable.js, etc.); paired with.d.tstype declarationsinternal/*.d.tswithout matching.ts= declares C++ JSG module shape (crypto.d.ts →node-internal:crypto)internal/*.d.tswith matching.js= types for ported JS (streams_readable.d.ts → streams_readable.js)- Top-level files are thin: import from
node-internal:*, re-export withexport { ... }/export * from - Feature-gated exports use
if (!flag) { throw ... }or conditional class assignment patterns - Shared validators in
internal/validators.ts; shared errors ininternal/internal_errors.ts _prefix files (e.g.,_http_agent.ts,_stream_readable.ts) = Node.js legacy internal module aliases- Some Node.js compat APIs are non-functional stubs that are either non-ops or throw when called
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

