Configs2026年5月18日·1 分钟阅读

workerd — Cloudflare Workers JavaScript Runtime

workerd is the open-source JavaScript and WebAssembly runtime that powers Cloudflare Workers. It can be self-hosted to run Workers-compatible code locally or on your own infrastructure with the same V8 isolate-based execution model.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
workerd Runtime
通用 CLI 安装命令
npx tokrepo install d7bc2488-52f7-11f1-9bc6-00163e2b0d79

Introduction

workerd is the open-source runtime behind Cloudflare Workers, released by Cloudflare in 2022. It uses V8 isolates to run JavaScript and WebAssembly workloads with sub-millisecond cold starts and strong per-request isolation. Unlike Node.js, it implements Web Platform APIs (fetch, Request, Response, crypto) rather than Node-specific APIs.

What workerd Does

  • Executes JavaScript and TypeScript using V8 isolates with Web Platform APIs
  • Runs WebAssembly modules alongside JavaScript workers
  • Provides per-request isolation without the overhead of separate processes or containers
  • Implements the Service Workers API and Cloudflare-specific bindings (KV, R2, D1)
  • Serves as the local runtime behind wrangler dev for Workers development

Architecture Overview

workerd is written in C++ using the Cap'n Proto framework for its configuration and RPC layer. Each incoming request runs in its own V8 isolate, providing memory isolation without process-level overhead. The runtime implements a subset of Web Platform APIs (Fetch, Streams, Web Crypto, URL, TextEncoder) and adds Cloudflare-specific bindings. Configuration is defined in a Cap'n Proto schema file that specifies services, routes, and bindings.

Self-Hosting & Configuration

  • Build from source using Bazel with a C++20 compiler (clang 15+)
  • Configuration uses Cap'n Proto schema files to define workers and routing
  • Bind workers to specific ports and URL patterns via the config
  • Environment variables and secrets are injected through the binding configuration
  • Can run standalone or be embedded as a library in other C++ applications

Key Features

  • Sub-millisecond cold starts using V8 isolate reuse
  • Per-request memory isolation without container overhead
  • Web Platform API compatibility (not Node.js APIs)
  • WebAssembly support for running compiled code alongside JS
  • Same runtime used in production by Cloudflare Workers globally

Comparison with Similar Tools

  • Node.js — general-purpose JS runtime with OS-level APIs; workerd focuses on Web Platform APIs with isolate-level isolation
  • Deno — secure JS/TS runtime; workerd is more specialized for edge/serverless workloads
  • Bun — performance-focused JS runtime; workerd prioritizes isolation and cold start speed over raw throughput
  • WinterJS — Wasmer-based JS runtime; workerd uses V8 and has battle-tested production parity with Cloudflare
  • Fastly Compute — proprietary edge runtime; workerd is open source and self-hostable

FAQ

Q: Can I run workerd locally for development? A: Yes. The wrangler CLI uses workerd under the hood for local development via wrangler dev.

Q: Does workerd support Node.js APIs? A: Partially. A Node.js compatibility layer is available for common modules like Buffer and crypto, but workerd primarily targets Web Platform APIs.

Q: Is workerd suitable for self-hosted production use? A: workerd is designed for Cloudflare infrastructure. Self-hosting is possible but requires building from source and managing the configuration yourself. Community tooling around self-hosting is limited.

Q: What is the difference between workerd and miniflare? A: miniflare was a Node.js-based Workers simulator. It has been replaced by workerd as the local runtime, providing true parity with the production environment.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产