How celld runs Workers on your own infrastructure
By Flavio
Updated
Tagged: Cloudflare
celld runs Workers and Durable Objects on your own machines, with one SQLite database per cell and S3-compatible storage.
celld, launched by Ryan Dahl, is an open source implementation of Cloudflare Workers and Durable Objects that runs on machines you control. This guide walks through its self-hosted architecture: the nodes, each cell’s SQLite database, and the S3-compatible bucket sitting behind them. If you want to learn the managed Cloudflare service first, start with my Durable Objects tutorial.
You write a Worker and bind a Durable Object using the same JavaScript APIs and a familiar wrangler.jsonc file, then run celld on your own VMs instead of deploying to Cloudflare. Every Durable Object gets its own SQLite database replicated to an S3-compatible bucket you control, and that bucket coordinates the nodes too. There’s no separate database cluster, placement service, membership system, or consensus service to operate.
I use Cloudflare Workers, D1, Durable Objects, Queues, R2, and plenty of other Cloudflare services across my projects, and I like the platform. Seeing one of its best ideas turned into infrastructure we can run anywhere is really interesting. Ryan announced celld on August 5, 2026, releasing version 0.1.0 that week under the Apache 2.0 license in the denoland/celld repository. I wrote this post against 0.1.0, and the current 0.6 release is still a beta, so it’s too early to move an important production system onto it. For an experiment, though, it’s well worth trying.
First, what is a Durable Object?
A normal serverless function is stateless. It takes a request, does some work, and sends back a response, while the next request might land on a different machine.
That works fine until requests need to coordinate. Picture a chat room with 500 people connected at the same time: messages need one clear order, connections share state, and two users might update the room at the same moment. You can build that with a database, locks, a message broker, and a WebSocket service (my free Real-time Web Applications course covers the foundations behind these long-lived connections), or you can route every request for that room to a single Durable Object.
A Durable Object is a small, named server with private persistent storage. You might create one per:
- chat room
- user
- document
- game
- project
- device
- AI agent
Every request for a given object lands in the same logical place. The object processes one event at a time, keeps hot state in memory, stores data in SQLite, holds WebSocket connections, and schedules alarms. The whole model comes down to giving every independent piece of state one owner, which removes a lot of coordination code from your app.
With Cloudflare’s managed product, Cloudflare handles the machines, routing, storage, failover, global placement, and operations. celld keeps that programming model and swaps out the managed platform for V8, SQLite, LTX, an S3-compatible bucket, and a small fleet of your own machines.
What is a cell?
In celld, a cell is a Durable Object. Each one has:
- a stable name
- one current owner node
- one JavaScript isolate
- one private SQLite database
- one ownership epoch
- a replicated copy of its durable state in object storage
The name works as the address. Say I create a cell for an Events Logger project called flaviocopes.com. Every event for that project goes to that exact cell, while another project like demo-shop gets its own cell and its own database.
The two projects don’t share tables or a database lock, so a bug that damages one database can’t touch the other. Your app is sharded from the start. Compare that with the usual multi-tenant setup where every customer shares one big database and every query includes a tenant_id. In celld, each cell has its own SQLite file on disk, giving you a physical boundary between tenants.
The complete architecture
At its core, celld combines five pieces: V8, SQLite, LTX, S3, and Tokio.
V8 runs the Worker code
Each celld node embeds V8, the same JavaScript engine powering Chrome, Node.js, Deno, and Cloudflare Workers. When you run celld deploy, it reads a supported Wrangler project and bundles the Worker with esbuild.
The same node serves both stateless Worker requests and stateful cells. Its runtime implements a useful slice of the Cloudflare Workers API, including fetch, service bindings, JavaScript RPC, Durable Objects, alarms, static assets, streams, WebSockets, and part of the Node.js compatibility layer. Only the supported APIs run without changes, and we’ll look closely at where that line sits later on.
SQLite stores each cell
Every cell gets its own SQLite database. (If you haven’t worked with SQLite before, my free SQLite course covers how it works and how to use its tools.) That gives each object transactions, indexes, SQL queries, and a familiar file format, while keeping every unit of state small. Moving a database for one chat room or one project is much easier than moving a database for an entire app.
Only one writer can update a cell at a time. celld enforces this with an ownership epoch that fences off stale writers: if a node loses ownership, any late writes it tries to make land under an old epoch path that’s no longer authoritative.
LTX replicates SQLite changes
LTX is the transaction file format used by Litestream, and celld includes its own Rust implementation. It turns SQLite changes into segments that can be stored in and restored from object storage.
Your local SQLite file keeps warm reads and execution fast, while the LTX copy in the bucket makes the state durable and movable across nodes. celld won’t acknowledge a durable write until that data reaches the bucket. That’s what the project means by RPO=0: killing a node shouldn’t lose a write the caller already got a success response for. (I explain RPO, RTO, and recovery planning in my free Backup and Restore course.) An unacknowledged request can still fail, and RPO=0 covers data loss on acknowledged writes rather than zero downtime.
S3 is the source of truth
Every node in the fleet points at the same S3-compatible bucket, which stores:
- deployments
- SQLite and LTX state
- cell ownership records
- node leases
- peer authentication material
Because the bucket handles both storage and coordination, celld relies on object storage compare-and-swap to grant one node ownership of a cell. Whenever another node takes over, the ownership epoch advances.
Distributed coordination didn’t vanish here; celld just moved it onto the object store’s conditional-write and consistency guarantees. There’s no Raft cluster or separate consensus service inside celld, since the object storage provider already runs a distributed system under the hood. When S3 is already the most durable part of your infrastructure, that’s a good trade-off.
Tokio runs the node
celld is written in Rust and uses Tokio for asynchronous work. A single node handles HTTP traffic, peer requests, WebSockets, SQLite work, replication, leases, restoration, and cell lifecycle management. The first release ships as both a small static executable and a Docker image.
What happens during a request?
Let’s trace what happens when a request heads to a cell.
Traffic can land on any node in the fleet. The Worker picks the target cell by name, and celld checks which node currently owns it:
- If the cell already lives on the same node, the request stays local.
- If another node owns it, celld forwards the request through its authenticated peer protocol.
- If no node owns it yet, a node claims it with a conditional bucket write, restores its SQLite state, and starts the isolate.
From there, the code runs in V8. Whenever the request changes durable state, celld writes to SQLite locally and replicates the committed change to the bucket before sending back the response.
That gives you a practical split across the system:
- warm work runs locally
- durable writes pay for one object storage round trip
- inactive state sits in cheap object storage
- nodes stay replaceable
Why celld does not need a control plane
Most distributed systems start with a list of machines and extra machinery to track who joined, who left, who’s healthy, where each shard lives, and who moves it after a failure. celld skips the separate control plane and uses the bucket for that coordination instead.
When a node starts, you give it bucket credentials and an address peers can reach. It writes a lease to the bucket, and other nodes discover it there, with no join command and no fixed membership file. Cell ownership is also a record in the bucket, so if a node disappears and its lease expires, another node claims the cell, restores its SQLite database, and keeps going.
Making nodes disposable means the bucket does double duty as the root of authority for the whole fleet. Anyone holding those credentials controls deployments, ownership, state, and peer authentication, so the security documentation recommends scoping credentials to one fleet bucket.
Hibernation changes the cost model
A cell doesn’t need to stay in memory forever. Once it goes idle, celld can hibernate it, leaving its durable state in the bucket while freeing the JavaScript isolate and local working state from RAM. The next request wakes it back up.
That model works well for apps with many mostly idle entities. Suppose you run one cell per customer project across 100,000 projects, and only 300 are getting traffic right now. Those 300 active cells use RAM while the other 99,700 sit as objects in the bucket. That’s the same cost advantage that makes Cloudflare Durable Objects so appealing: you pay for your active working set instead of the whole population.
celld’s homepage lists a few early measurements:
- about 4 MB of RAM per resident trivial cell
- about 1,000 resident cells on one 8 GB node
- around 4 ms to wake a hibernated cell on the local benchmark machine
- around 90 ms for a durable region-local write
- around 20 seconds for failover after killing a node
Those numbers come from different setups: the speed and density tests ran on an Apple M-series laptop, while the durability measurements used a regional VM fleet paired with a nearby bucket.
The testing documentation adds a larger cluster run. Ten nodes with 4 vCPUs and 8 GB of RAM each held 10,000 resident cells and 20,000 WebSocket connections. After two nodes stopped, all cell data was available again after about 11 seconds at the tail, with spare capacity left on the remaining nodes. Those are encouraging early numbers, though you’ll still want to benchmark them against your own app’s workload and payload sizes.
The cost claim needs context
The celld homepage compares self-hosting against long-lived Cloudflare Durable Objects, and the gap looks huge at first glance. Their model puts 1,000 resident cells on an 8 GB VM at $48 a month, bringing the total to roughly $49 a month. On Cloudflare’s Workers Paid plan, 1,000 continuously active 128 MB Durable Objects come out to about $4,150 a month. That specific workload, where lots of objects stay awake all month, is where the “orders of magnitude cheaper” claim comes from.
Smaller apps look very different. Cloudflare’s free plan covers tiny workloads without a bill, and you don’t have to manage any infrastructure. When you self-host, the VM price is only part of what you pay for:
- load balancers and public ingress
- object storage requests and data transfer
- spare capacity for node failures
- monitoring and logs
- backups and recovery tests
- security updates
- operator time
The celld cost chart points out that real application traffic and writes add more compute and bucket usage on top of that baseline. You also scale in whole nodes, so even your very first cell needs a machine running. The chart alone isn’t a good reason to switch. Pick celld when the architecture fits your app and you want control over the failure domain, storage, placement, and cost curve.
A tiny celld application
If you’ve worked with Durable Objects before, the code will look completely familiar. Here’s a Worker that routes every request to a counter named room-42:
export class Counter {
constructor(state) {
this.state = state
}
async fetch() {
let count = (await this.state.storage.get('count')) ?? 0
count++
await this.state.storage.put('count', count)
return new Response(JSON.stringify({ count }))
}
}
export default {
async fetch(request, env) {
const id = env.COUNTER.idFromName('room-42')
return env.COUNTER.get(id).fetch(request)
},
}
The binding and migration go in wrangler.jsonc, just like a regular Cloudflare project:
{
"name": "counter",
"main": "index.js",
"compatibility_date": "2026-08-05",
"durable_objects": {
"bindings": [
{
"name": "COUNTER",
"class_name": "Counter"
}
]
},
"migrations": [
{
"tag": "v1",
"new_sqlite_classes": ["Counter"]
}
]
}
Instead of deploying to a Cloudflare account, you push the bundle to an object storage bucket:
celld deploy . \
--bucket s3://flavio-celld-lab
Then you start a node pointed at that same bucket:
celld \
--bucket s3://flavio-celld-lab \
--listen 0.0.0.0:8080 \
--advertise cell-a.internal:8080
For S3, celld picks up credentials from the standard AWS credential chain. If you’re using R2 or another S3-compatible store, you can pass the endpoint and region instead. Worker projects need esbuild on your PATH, while asset-only deployments don’t.
What runs unchanged?
The launch announcement says Workers and Durable Objects code can run unchanged, as long as you stick to the supported APIs. On the Cloudflare compatibility page, celld lists support for:
- Workers, including module Workers and
fetch - Durable Objects with SQLite storage, plus Durable Object Facets
- Static assets,
_headers, and_redirects - Cron Triggers
- Dynamic Workers
- KV, Queues, D1, Workflows, and R2
- alarms
- inbound hibernatable WebSockets
- outbound WebSocket clients
- service bindings
- most JavaScript RPC behavior
- common Web Platform APIs
- part of Web Crypto
- part of the Node.js API
Containers are still experimental, and Python Workers are only partial (fetch handlers on Pyodide 0.28).
Plenty of Cloudflare’s broader platform sits outside that list. Workers AI, Vectorize, Hyperdrive, Browser Rendering, and Email Workers aren’t implemented. The Cache API always misses because there’s no shared edge cache, and celld doesn’t terminate TLS, so custom domains stay on your reverse proxy.
For configuration, celld reads wrangler.json and wrangler.jsonc, and skips wrangler.toml. If your config has an unsupported key, the deployment stops instead of silently proceeding, which I prefer because a compatibility layer that quietly ignores a binding is a trap. Even with that safeguard, run a real test suite before moving an existing Worker over, since projects often rely on a Node.js module or a subtle runtime detail that never shows up in the config file.
This is not Cloudflare on your own server
celld gives you the runtime and state model, without Cloudflare’s network around it. You won’t get managed global ingress, anycast routing, DDoS protection, TLS, an account system, a multi-tenant scheduler, or a worldwide placement layer. Each celld fleet runs a single application deployment, so you put your own reverse proxy or load balancer in front, handle TLS there, and decide which regions to run and how traffic reaches them.
Nodes talk to each other over a signed peer protocol with HMAC authentication, body signatures, clock limits, and replay protection, but the transport itself is plain HTTP. The limitations page recommends keeping peer addresses on a private network or an encrypted overlay like WireGuard or Tailscale (my free Tailscale course walks through setting that up). Don’t expose the peer port to the public internet, and don’t run hostile multi-tenant workloads on it yet, since that’s still a hard beta limitation.
The architecture I find most interesting
What grabs my attention more than self-hosting a Cloudflare API is how celld uses object storage as the foundation for a stateful system. Most web apps put one database in the center:
application nodes -> shared database
celld flips that layout around:
requests -> named cells -> private SQLite databases -> object storage
Instead of moving rows or tables around, you move a small SQLite database tied to one logical actor. That changes how the system behaves in a few practical ways.
Contention stays local
A busy project can’t lock the database for another project, because only requests targeting the same cell have to wait in line.
Failure has a smaller blast radius
When a cell gets corrupted, the damage stays inside that single object database rather than taking down a shared database for every customer. Your VMs and object storage bucket are still shared failure domains, so you still have to plan for machine and bucket outages.
State moves with the computation
The node that owns a cell runs its code and opens its SQLite file locally, so warm requests never cross a network hop to reach a database. When ownership shifts to another node, the database shifts with it. That model fits chat rooms, collaborative docs, games, connected devices, workflows, and agents really well.
Cells are a good home for AI agents
I mentioned agents in that list, and since I run coding agents every day, I’ve seen this workload up close. An agent is long-lived and stateful: it carries conversation history, working memory, tool results, and a stream of progress events, and it can spawn sub-agents that need all the same things.
Cells match that shape naturally. Every agent gets a name so requests always land in the right place, with its history and memory stored in its own SQLite database. Events run one at a time, so two tool results won’t corrupt the state. An agent can set an alarm to pick up work later, and hibernate while waiting on a slow model response or waiting on me.
Having a database per agent also solves a real write bottleneck. Agents log constantly, writing events on every step and every tool call. Put a thousand agents on one shared database and that stream turns into a scaling headache, whereas giving each agent its own database keeps those writes completely separate.
You get isolation too. Normally, keeping agents from reading each other’s state means spinning up a container or VM for each one. A cell gives you a similar boundary inside a few megabytes of RAM, and it wakes up in milliseconds instead of the seconds a container takes. If you build a dashboard to watch an agent run, it can hold a hibernatable WebSocket to that cell so progress streams live and the connection stays alive while the agent sleeps between steps.
Before celld, using this pattern for an agent platform meant tying the whole product to one provider. Now you can run the same architecture on your own machines. Looking at my own projects, a couple of them map neatly onto cells too.
I could rebuild Events Logger around cells
Events Logger is the first project I’d experiment with. Right now it’s a self-hosted Astro, HTMX, and Alpine.js app where every tracked app sends events to one HTTP API, everything goes into one local SQLite database, and HTMX polls for updates in the dashboard. It’s small and works well as it is.
Moving it to celld changes the storage boundary by giving each project its own cell:
events:flaviocopes.com
events:demo-shop
Inside each cell, SQLite holds that project’s events, categories, favorites, and insight cards. The public API doesn’t have to change at all: the top-level Worker authenticates the API key, reads the project ID, and forwards the request with idFromName(projectId). From there, the cell inserts the event and updates its local aggregates in a single transaction.
On the dashboard side, a hibernatable WebSocket can replace HTMX polling so new events show up right away without repeated requests. When nobody is looking at a project or writing to it, the cell hibernates on its own. That shifts Events Logger from a single process with one database into a distributed service with one database per project.
The tricky piece is the global dashboard. Because cells stay isolated by design, you can’t run one SQL query across every project database. You either maintain an explicit index cell with a small summary of each project, or fan out queries across several cells and merge the results. That’s the trade-off you make for isolation, and it forces a useful question early on: which data really needs to be global?
What makes Events Logger a great test case is that the existing API contract stays identical. I can build the celld version alongside the current one, send the same events to both, kill nodes on purpose, and compare the outputs without risking any production data.
Work Tracebook could gain optional private sync
Work Tracebook is built local-first. Coding agents append events to a JSONL file on my Mac using an interprocess lock, and a native SwiftUI app watches that file to render a live dashboard and daily chronicle. Nothing leaves the machine, and I want to keep that privacy boundary instead of turning the local file into a mandatory cloud service.
celld could still power an optional private sync mode, using one cell per project rather than one cell per task. Putting a whole project in one cell keeps its events ordered in a single SQLite database. The CLI appends to the local JSONL file first, then forwards the same event to the project cell. On the display side, the macOS app opens a single WebSocket and updates whenever another machine or a remote agent reports progress.
Right now, Work Tracebook only shows what happens on one Mac. Adding a celld fleet lets you pull together reports from a laptop, a desktop, a remote server, and hosted coding agents without trying to share a filesystem across all of them.
The local JSONL file still has to stay the immediate source of truth on each machine, so the CLI keeps working even when the network drops. Uploads need an outbox and stable event IDs so retries never create duplicate entries, leaving the cell as a converging shared view of everything that happened. That takes more work than swapping out a storage call: celld gives you serialized server state, while you still have to build the offline-first sync layer on top of it.
One database per workspace
I built a Cloudflare app where every workspace gets its own D1 database, so customer data stays physically separated without sprinkling workspace_id into every table and query. The isolation is great, but the plumbing behind it gets heavy fast. You need a control database for accounts and routing, calls to the Cloudflare API to spin up new tenant databases, dynamic Worker bindings that every deployment has to preserve, and a pool of pre-created databases for local development since you can’t provision them the same way on your laptop.
With celld, one database per tenant is just how it works out of the box. Map each workspace or website to a single cell, pick a name, and the first request creates its SQLite database automatically. All that D1 provisioning code, binding generation, and local database pool disappears. Each tenant’s widgets, submissions, subscribers, analytics, and settings sit together in one private database, cell alarms take care of per-tenant cleanup and monitoring schedules, and hibernation fits naturally because most small websites sit quiet most of the day.
At the same time, that exact app shows where celld stops. It also relies on KV, R2, Queues, Analytics Engine, Cron Triggers, Turnstile, email, and Cloudflare’s managed routing, and celld doesn’t ship equivalents for any of those. You can piece some of them together yourself:
- cell alarms instead of cron for tenant-specific work
- direct object storage access for uploads
- an external email API called over
fetch - a cell-backed queue for focused workflows
- a reverse proxy for custom domains and TLS
Doing that means building and running a small platform around the runtime. You trade away the tenant-database provisioning scripts, and in return you take on ingress, queues, storage adapters, monitoring, security, and failover yourself.
I would not rebuild everything with celld
Even when a new piece of infrastructure looks genuinely good, most apps don’t need it. Moving flaviocopes.com to celld wouldn’t make any sense, since the site is mostly static and Cloudflare Pages already handles it fine. Same for HostingPicker, where the value comes from curated data and client-side comparisons rather than per-user server state.
My rule of thumb is straightforward:
Use celld when the product contains many independent, stateful things that need coordination.
Look for a few concrete signs before reaching for it:
- one natural name per unit of state
- many units, with only a small active set at any given time
- concurrent writes hitting the same unit
- long-lived WebSockets
- per-tenant data isolation
- alarms or durable workflows
- a need to move state between replaceable machines
If your app is mostly static, read-heavy, or depends on global queries across all rows, stick with a regular database.
How I would test celld
If I sit down to benchmark celld on one of my own projects, Events Logger is the first candidate. The initial prototype only needs one celld node and one R2 bucket, covering project creation, event ingestion, recent events, and a live WebSocket feed. Once that works, add a second node over a private Tailscale network and put a small reverse proxy in front to split traffic across both machines.
From there, the test plan is concrete:
- create 1,000 project cells
- push numbered events to each project
- keep WebSocket feeds open for a smaller active set
- kill one node during writes
- verify every acknowledged event after recovery
- restart the node and watch it rejoin
- compare latency and bucket operations against the current app
After the happy path holds up, push on the messy failure modes. See what happens when R2 returns 429, when the private network drops packets, or when the fleet runs out of spare memory, and check how painful it is to inspect one broken cell and restore it by hand. celld already has a solid test suite of its own, including differential tests against workerd, deterministic simulations of the coordination protocol, and live fleets with injected failures, but running your own workload against it is still the only way to see how the latency, costs, and recovery behavior look in practice.
What I like about the project
The biggest appeal for me is that celld is small enough to hold in your head as a complete system. The whole architecture comes down to five clear pieces:
- JavaScript isolates for computation
- one SQLite database per stateful object
- LTX for durable replication
- conditional object storage writes for ownership
- replaceable Rust nodes for execution
Its boundaries are right out in the open. Warm reads stay local, durable writes wait on object storage, failover waits on lease acquisition and restoration, global queries require an explicit design, and public ingress is your job as the operator. Running it yourself still means dealing with failures, except now you own the failure path and can inspect every part of it directly.
I also like what this does for portability. Durable Objects is a great programming model, and until now it’s been locked to a single managed platform. Having a second runtime gives the API a real compatibility target, gives applications an exit path, and lets the model evolve outside one vendor, even if you keep deploying to Cloudflare.
What would stop me from using it today
Right now, the beta status is the biggest blocker. The supported API surface is still moving, the security docs explicitly warn that hostile multi-tenant workloads are unsafe, and peer traffic requires a private encrypted network. You also don’t get managed ingress or global placement, and capacity and load-shedding behavior are still being tuned.
Things are changing fast, too. During launch week, the README, limitations page, and 0.1.0 release notes didn’t even match on every pressure-shedding default, which is normal two days after an initial release. It’s up to version 0.6 now, and I’d still read the source and the latest release notes carefully before putting a fleet in production.
For my own projects, though, the biggest gap is everything surrounding the runtime rather than the runtime API itself. Next to Workers, Cloudflare gives me DNS, TLS, DDoS protection, logs, queues, email, object storage, AI services, deployments, and secrets out of the box. celld is a focused compute and state primitive, which is what makes it clean, and also why adopting it means wiring up the rest of that stack yourself.
A very good architecture experiment
celld is a clean way to package a strong stateful programming model, rather than a free clone of Cloudflare. One named object owns one SQLite database: active objects sit right next to the code using them, idle ones fold back into object storage, a conditional bucket record decides ownership, and a new machine joins the fleet just by pointing at the same bucket.
It’s easy to picture Events Logger running as one cell per project, or Work Tracebook as one cell per synced project, even if neither one is ready for a production rewrite today. I’m going to keep following how it matures. If you want to dig deeper, read the celld documentation, browse the source code, and spend some time with the limitations and security boundary pages before trying it on real workloads.
Want me to talk about your product? You can sponsor this site.
Related posts about cloudflare: