Web standard APIs
Workerd implements the following web standards:Fetch API
The Fetch API provides interfaces for making HTTP requests and handling responses. It includesRequest, Response, Headers, and the global fetch() function.
Streams API
The Streams API enables efficient processing of data streams. Workerd provides both standard WHATWG streams and optimized internal byte streams.WebSocket API
The WebSocket API enables real-time bidirectional communication between clients and servers.Cache API
The Cache API provides programmatic control over HTTP caching.Crypto API
The Crypto API implements the Web Crypto standard for cryptographic operations.Encoding APIs
The Encoding APIs provide text encoding and decoding functionality.Storage APIs
Workerd extends web standards with storage APIs:KV storage
KV storage provides a key-value store for your applications.Durable Objects
Durable Objects provide strongly consistent, coordinated state.R2 storage
R2 storage provides object storage with an S3-compatible API.Architecture
Workerd’s runtime APIs are implemented in C++ with JavaScript bindings through the JSG (JavaScript Glue) layer. This architecture provides:- Performance: Native C++ implementations for critical operations
- Compatibility: Adherence to web standards where applicable
- Extensions: Additional APIs beyond web standards for serverless use cases
- Type safety: TypeScript definitions generated from C++ implementations
API organization
The runtime APIs are organized in the source code undersrc/workerd/api/:
http.h/http.c++- Fetch API (Request, Response, fetch)streams/- Streams API implementationsweb-socket.h/web-socket.c++- WebSocket APIcache.h/cache.c++- Cache APIkv.h/kv.c++- KV storage APIactor-state.h/actor-state.c++- Durable Objects storager2-bucket.h/r2-bucket.c++- R2 storage APIcrypto/- Web Crypto API implementationsencoding.h/encoding.c++- Text encoding APIs
Next steps
Fetch API
Learn about HTTP requests and responses
Streams API
Process data efficiently with streams
Durable Objects
Build stateful applications
R2 storage
Store and retrieve objects