How cloudflare/workerd works
workerd is Cloudflare’s JavaScript/Wasm server runtime, used to host Workers, develop them locally, and proxy HTTP traffic. The principal flow is configuration defining Workers and sockets, the server binding listeners to services, and a Worker handling an incoming request to produce a response. The graph also preserves documented capability bindings and major runtime API families. The README and sampled server header support the entry-point relationships; unsampled subsystem links are shown only as dashed, unverified relationships.
Main entry points: worker-entrypoint.h Worker Entrypoint · server.h Server · worker.h Service Routing · workerd.capnp Runtime Config
Components 18
Server and Services
- Runtime Config
src/workerd/server/workerd.capnp - Server
src/workerd/server/server.h - HTTP Socket
src/workerd/api/sockets.h - Service Routing
src/workerd/io/worker.h
Worker Execution
- Worker Entrypoint
src/workerd/io/worker-entrypoint.h - Module Loading
src/workerd/api/worker-loader.h - Isolate Runtime
src/per_isolate/main.ts
Worker APIs
- Web Streams
src/per_isolate/webstreams/streams.ts - HTTP APIs
src/workerd/api/http.h - Cloudflare APIs
src/cloudflare/workers.ts
State and Bindings
- Service Bindings
src/workerd/api/worker-rpc.h - Durable Objects
src/workerd/api/actor.h - Actor Storage
src/workerd/io/actor-storage.h
Runtime Compatibility
- Node Compatibility
src/node/http.ts - Python Runtime
Other components
- Operator
- External Resources
- HTTP Response
Connections 20
- Operator → Runtime Config: configures
- Operator → Server: starts
- Runtime Config → Server: configures
- Server → HTTP Socket: binds listeners
- HTTP Socket → Service Routing: routes requests
- Service Routing → Worker Entrypoint: dispatches
- Worker Entrypoint → HTTP Response: returns
- Worker Entrypoint → Module Loading: loads modules
- Worker Entrypoint → Isolate Runtime: executes in
- Worker Entrypoint → HTTP APIs: handles fetch
- Worker Entrypoint → Web Streams: uses streams
- Worker Entrypoint → Cloudflare APIs: uses APIs
- Worker Entrypoint → Node Compatibility: uses compatibility APIs
- Worker Entrypoint → Python Runtime: runs Python
- Worker Entrypoint → Service Bindings: calls services
- Service Bindings → Service Routing: dispatches locally
- Worker Entrypoint → Durable Objects: uses actors
- Durable Objects → Actor Storage: persists state
- Worker Entrypoint → External Resources: accesses capabilities
- Server → Worker Entrypoint: constructs workers