Server-first
workerd is designed specifically for server environments, not for command-line tools or graphical user interfaces. This focus means:- Optimized for long-running processes
- Designed for handling concurrent requests
- Built-in support for operational concerns like metrics and logging
- No assumptions about interactive user input
Standard-based
Built-in APIs are based on web platform standards wherever possible. workerd implements:fetch()API for HTTP requests- Web Streams API for data streaming
- Web Crypto API for cryptographic operations
- URL and URLSearchParams APIs
- TextEncoder/TextDecoder for encoding
- Standard JavaScript features (ES modules, async/await, etc.)
- Familiarity: Developers already know these APIs from browser development
- Interoperability: Code can often run in both browsers and workerd
- Future-proof: Standards evolve with community input and broad implementation
- Documentation: Abundant resources exist for standard APIs
- No suitable standard exists
- The functionality is fundamentally server-specific
- The API provides significant value to the platform
Nanoservices
workerd enables splitting applications into components that are decoupled and independently deployable like microservices, but with the performance of a local function call. When one nanoservice calls another:- The callee runs in the same thread and process
- No network latency or serialization overhead
- Sub-millisecond invocation time
- Shared memory space when appropriate
Homogeneous deployment
Instead of deploying different microservices to different machines, deploy all nanoservices to every machine in your cluster. This approach simplifies:- Load balancing: Any machine can handle any request
- Failover: No single point of failure for any service
- Scaling: Add capacity by adding machines, not by orchestrating specific services
- Routing: No service discovery needed
- Keeping workers lightweight (fast startup, low memory)
- Isolating workers for security
- Managing resources efficiently across many workers
Capability bindings
workerd uses capabilities instead of global namespaces to connect services and resources. Traditional approach (global namespace):Composability
The same worker code can connect to different resources by changing only the configuration:Security
Capability-based security makes certain attack classes impossible:- SSRF prevention: Workers cannot access arbitrary URLs by default
- Principle of least privilege: Grant only the specific access needed
- Audit trail: Configuration explicitly documents all resource access
Testability
Easy to inject mock services for testing:Always backwards compatible
Updating workerd to a newer version will never break your JavaScript code. workerd’s version number is simply a date, corresponding to the maximum compatibility date supported by that version. You can always configure your worker to use a past date, and workerd will emulate the API as it existed on that date. Every worker must specify a compatibility date:Strong compatibility guarantees
- Your worker will work the same way forever
- You can update workerd without testing every worker
- No surprise breakage from runtime updates
Controlled breaking changes
When workerd needs to fix a bug or change behavior:- The fix is implemented behind a compatibility flag
- The flag is enabled for all compatibility dates after a specific date
- Workers with older dates continue using the old behavior
- Workers can opt in early using explicit compatibility flags
Progressive modernization
You can update compatibility dates incrementally:- Update one worker at a time
- Test the behavior with the new date
- Roll back by reverting the config if needed
- Update remaining workers when ready
compatibility-date.capnp: