The workers-rs repository provides ergonomic Rust bindings for developing Cloudflare Workers entirely in Rust, compiled to WebAssembly. This project enables developers to write serverless functions on Cloudflare's edge computing platform using Rust instead of JavaScript, leveraging the wasm32-unknown-unknown compilation target to produce efficient WebAssembly modules.
The repository is classified across multiple domains including Cloudflare, Rust, Serverless, Edge computing, WebAssembly, Platform, Development, API, and Runtime. It serves as a bridge between the Rust ecosystem and Cloudflare's Workers platform, allowing developers to use standard Rust crates and modules as long as they compile to the WebAssembly target. The project uses wrangler, Cloudflare's command-line tool, for running and publishing workers locally and to production.
Development activity shows consistent engagement with a median issue and pull request response latency of 25.5 hours across 164 tracked items. The most active contributors include guybedford with 121 events, kflansburg with 73 events, and lukevalenta with 26 events. Bug reports represent the most common issue label with 9 instances, followed by good first issue labels with 3 instances. The repository maintains connections with major projects including Microsoft's VSCode, the Rust language repository, and Microsoft's TypeScript project through overlapping contributor networks.
The crate provides several key features for building workers. An HTTP feature flag introduced in version 0.0.21 replaces custom types with standard types from the http crate, enabling direct use of frameworks like axum and hyper. The Router abstraction allows parameterized routes with access to route parameters, shared data, environment bindings, and request context within handler functions.
Bindings to Cloudflare services are accessible through environment parameters provided to entrypoints and route handlers. The repository supports Durable Objects, which require implementing the DurableObject trait with the durable_object attribute macro. Durable Objects can leverage SQLite for persistent relational database storage through the state.storage().sql() interface. Key-Value storage, Secrets, Variables, and Version metadata bindings are all supported through the environment interface.
The project includes experimental support for Workers RPC, allowing inter-worker communication. RPC servers export methods using wasm-bindgen, while RPC clients require manual binding generation. The repository provides an experimental code generator for describing RPC interfaces using WIT (WebAssembly Interface Type), a lightweight format designed for the WebAssembly Component model, with support currently limited to primitive types.
CPU limit detection is available through the worker::signals API, enabling graceful backoff when workers approach platform-imposed CPU limits. The panic recovery feature with the --panic-unwind flag allows panics to be caught and converted to JavaScript exceptions rather than terminating the WebAssembly instance, enabling workers to continue serving requests after panic events. This feature uses the nightly Rust toolchain and rebuilds std with panic unwinding support, automatically recovering from critical errors by reinitializing the WebAssembly instance on subsequent requests.
Getting started with workers-rs involves using cargo generate to scaffold from templates, with optional configuration for panic unwinding and abort recovery. The project is published on crates.io as the worker crate and maintains comprehensive documentation on docs.rs.