pylon-workers
Status: experimental / unverified. This crate has been built and its
unit tests pass, but it has never been deployed end-to-end to Cloudflare
Workers. Several APIs were written against the worker crate's documented
surface without live testing. Use at your own risk.
What works
D1DataStore— aDataStoreimplementation that generates SQLite-dialect SQL and executes it through a pluggableD1Executortrait. The SQL generation is unit-tested. Safe to use outside of Workers by implementingD1Executoragainst any SQLite-compatible backend.NoopAll— stub implementations of the router's service traits (rooms, cache, pubsub, jobs, scheduler, workflows, files, openapi) for platforms that don't offer those capabilities. Safe to use.durable_objectmodule — helper primitives (do_websocket_sink,persist_to_do_storage,restore_from_do_storage,register_do_subscriber) + a JavaScript template for writing your own Durable Object class. These are library building blocks, not a working deployment.
What is NOT verified
handlermodule (behind theworkersfeature). Uses theworkercrate's#[event(fetch)]macro and callsfutures::executor::block_oninside the fetch handler. The block-on strategy almost certainly does not work onwasm32-unknown-unknown(single-threaded, no pool). This module has never been built with--features workersagainst the realworkercrate.- End-to-end deploy. Nobody has run
worker-build --release --features workersorwrangler deployagainst this crate. - The Durable Object handler integration. The JS template is a
starting point, not an integrated flow. Wiring the DO to the Rust
Shardabstraction requires bindings that don't exist yet.
What would be needed for a real Workers path
- Replace
futures::executor::block_onwith genuinely async execution. Either:- Add an
AsyncDataStoretrait alongside the sync one - Or make
DataStoreitself async (affects every platform)
- Add an
- Actually build with
worker-buildand iterate until it compiles and deploys. Expect multiple API surprises withworkervs. what's documented. - Write an integration test that hits a deployed Worker from a test script and asserts behavior end-to-end.
- Add Durable Object bindings so shards survive across DO instances and survive hibernation.
- Swap the
ureq-based OAuth and email HTTP clients forfetch()(available inside Workers) —ureqcan't run in WASM.
Using this crate today
The safe subset you can depend on:
use ;
// Implement D1Executor for your own DB connection and get a working
// DataStore for free:
let store = new;
For deployment to actual Cloudflare Workers, we recommend waiting until
this crate has been marked stable. Until then, self-hosting (via the
pylon-runtime crate) is the supported path.
Tracking
See [issue #TODO — file this] for the path to 1.0.