The Zero-Pipeline Deploy: Inside dynamic-workers-rollout-demo
How Eric Clemmons combined Cloudflare Dynamic Workers and Key-Value storage to turn infrastructure rollouts into instant database writes.
- The repository demonstrates treating code as data by storing executable JavaScript strings in a globally distributed Key-Value store.
- A Durable Object acts as a globally consistent control plane to manage traffic routing without the flickering caused by eventual consistency.
- Synchronous edge stubbing allows multiple micro-frontends to be fetched and composed in parallel with zero network overhead.
Bypassing the CI/CD Conveyor Belt
Modern deployment pipelines are a miracle of automation, but they are undeniably slow. Even the fastest edge networks require build steps, packaging, and global propagation time. Operations teams wait minutes for a simple rollback to take effect.
The dynamic-workers-rollout-demo offers a radical alternative. Built by Eric Clemmons, it bypasses the build pipeline entirely by treating infrastructure as dynamically loaded data. It shifts the paradigm from pushing code to pulling state.
You can now have a Worker spin up other Workers, called Dynamic Workers, at runtime to execute code on-demand in a secure, sandboxed environment.
Code as Data in the KV Store
The architecture centers on a single, stable Gateway worker. Instead of containing application logic, this Gateway looks up raw JavaScript strings stored in a Cloudflare KV namespace. It executes them on the fly.
Writing a new string to the KV store instantly deploys a new version. The database becomes the deployment target.
The Globally Consistent Crossfader
Naive KV rollouts suffer from eventual consistency. If a developer slides a traffic dial to 10 percent, propagation delays cause traffic flickering for users across different regions.
To solve this, the project uses a Durable Object as a stateful crossfader. This ensures a canary rollout is mathematically consistent globally. Specific user IDs are deterministically hashed to the correct version.
export class RolloutConfig extends DurableObject {
async fetch(request: Request) {
// Block concurrency until state is fully loaded
await this.ctx.blockConcurrencyWhile(async () => {
this.state = await this.ctx.storage.get('config');
});
return new Response(JSON.stringify(this.state));
}
}
Synchronous Stubbing at the Edge
The magic happens through the env.LOADER.get() API. The Gateway initiates multiple worker fetches in parallel, such as an API worker and a Layout worker.
Because these execute in the same edge isolate or a warm neighbor, it achieves micro-service composition without network overhead. The Gateway does not wait for KV fetch completion before executing the next line of code.
The Control Plane Trade-off
This custom routing pattern offers immense power, but it competes with native platform primitives. Teams must weigh the flexibility of a custom Gateway against the operational simplicity of built-in tools.
| Feature | Custom Gateway (This Repo) | Native Gradual Deployments |
|---|---|---|
| Traffic Control | Custom logic (User ID, Headers) | Percentage split only |
| State Management | Durable Objects & KV | Native Platform Invisible |
| Target Use Case | Dynamic Micro-frontends | Standard API Rollouts |
| Complexity | High (Requires custom code) | Low (Dashboard toggle) |