9,786
stars
+0+10+300
581
forks
27
watchers
–
prs
–
issues
14
releases
–
discussions
README
Cloudflare Computer
Cloudflare Computer is a virtual filesystem that lives inside a
Durable Object. The Durable Object holds the authoritative state in
SQLite and exposes one pluggable execution surface through
workspace.runtime. Three backends ship today:
- Container projects the SQLite state into a sandbox container as
a real FUSE mount. A sandbox-side daemon (computerd) mounts the state
as a filesystem and syncs changes back over a capnweb RPC channel.
Full Linux userland, real binaries, real network.
- Isolate shell runs just-bash
in a Dynamic Worker. It reaches the authoritative Workspace over
Workers RPC, so there is no second store or sync round trip.
- Codemode runs an ECMAScript module in a fresh Dynamic
Worker with structured input/results, durable relative imports,
configured libraries, Workspace-backed node:fs/promises, and host modules such as
codemode:git, codemode:artifacts, and codemode:container.
A Workspace may register multiple backends under stable IDs.
workspace.runtime.exec(source, { backend }) is the single execution
entry point; the selected backend defines whether source is a shell
command or an ECMAScript module. Backends connect lazily on first use.
Workspace can also be constructed without a backend at all, giving
callers the filesystem on its own.
[!IMPORTANT]
The @cloudflare/computer package should be considered suitable for
production use. The package contains work-in-progress and experimental
components such as the ContainerBackend. These should be considered
unsuitable for production use. See the status reference for more details.
The specification under docs/ is forward-looking — read it for
intent, not as description of the code today.
Using it
If you want to build on Cloudflare Computer, install
@cloudflare/computer and follow that
package's README — it has the installation steps, the entrypoint map,
and worked examples of the fs and runtime surfaces.
To contribute feedback, see CONTRIBUTING.md.
Approved collaborators should follow COLLABORATORS.md
for setup, build, and test instructions.
Examples
The examples/ directory holds runnable consumers of the
public surface. Each is a Worker workspace with its own README.
- examples/container — runs computerd inside a
container the Durable Object schedules itself, mounts a workspace, and
talks to the object over capnweb. A write / read / exec HTTP
surface. The launch names the image and the instance size, because
scheduling_policy: "durable_object" moves both out of the config.
- examples/container-legacy — the same
surface against a container the platform schedules and sizes from the
containers block. Uses the deprecated legacy container backend; new
code should follow examples/container.
- examples/worker-shell — same HTTP surface as the
container example, but the shell runs just-bash
in a Dynamic Worker loaded through env.LOADER. No container.
- examples/codemode — mirrors
worker-shell, but exec evaluates an