# cloudflare/computer architecture

> Architecture diagram of the GitHub repository cloudflare/computer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cloudflare/computer
- Repository: https://github.com/cloudflare/computer

## Overview

#### Purpose and Public Entry Points
Cloudflare Computer is a preview TypeScript monorepo for Durable Object–hosted workspaces: an authoritative SQLite-backed virtual filesystem plus pluggable execution runtimes. Consumers primarily use `@cloudflare/computer` through `packages/computer/src/index.ts`, construct a Workspace, use filesystem APIs, and invoke `workspace.runtime.exec(source, { backend })`. The underlying filesystem is independently usable through `packages/dofs/src/index.ts`.

#### Workspace Orchestration
`@cloudflare/computer` is the Durable Object-facing integration layer. It owns Workspace lifecycle, client/proxy boundaries, runtime registration, heartbeat/observation, and the uniform execution interface.
- `packages/computer/src/workspace.ts`
- `packages/computer/src/runtime/runtime.ts`
- `packages/computer/src/client.ts`

Execution is selected by stable backend ID and connected lazily. The uniform runtime boundary hides whether source is shell text or an ECMAScript module.

#### Authoritative Durable Object Filesystem
`@cloudflare/dofs` supplies the durable virtual filesystem, backed by Durable Object SQLite. Its filesystem implementation provides POSIX-like operations over a schema/revision model; blobs, metadata, and path resolution remain authoritative here rather than in execution environments.
- `packages/dofs/src/fs/filesystem.ts`
- `packages/dofs/src/schema/core.ts`
- `packages/dofs/src/storage.ts`

The sync subsystem computes, transfers, applies, and coalesces changes between this store and remote projections, including blob and watermark handling.
- `packages/dofs/src/sync/push.ts`
- `packages/dofs/src/sync/fetch.ts`
- `packages/dofs/src/sync/apply.ts`

#### Runtime Backends
Three execution paths implement the runtime abstraction:
- **Container:** projects the workspace into a sandbox container with a real FUSE filesystem and Linux userland. `packages/computer/src/backends/container/cloudflare-container.ts`, `packages/computer/src/backends/container/container-lifecycle.ts`
- **Isolate shell:** runs just-bash in a Cloudflare Dynamic Worker and accesses Workspace directly over Workers RPC. `packages/computer/src/backends/worker-shell/worker-shell.ts`, `packages/computer/src/backends/worker-shell/adapter.ts`
- **Isolate JavaScript:** evaluates modules in fresh Dynamic Workers, supplying Workspace-backed filesystem support and curated modules/imports. `packages/computer/src/backends/worker-javascript/worker-javascript.ts`, `packages/computer/src/backends/worker-javascript/module-graph.ts`

#### Container Daemon and RPC Boundary
`computerd` runs inside the container as a Node daemon. It exposes HTTP/WebSocket RPC, mounts the remote filesystem through FUSE, and executes local processes against that mount. This creates the principal distributed boundary: container-side filesystem operations synchronize to the Durable Object store over Cap’n Web RPC.
- `packages/computerd/src/cli/computerd.ts`
- `packages/computerd/src/fuse/vfs.ts`
- `packages/computerd/src/exec/runner.ts`

`@cloudflare/computer-rpc` defines shared client/server and wire interfaces used across that boundary.
- `packages/rpc/src/interface.ts`
- `packages/rpc/src/client.ts`
- `packages/rpc/src/server.ts`

#### Integrated Services and Capability Surfaces
Computer exposes workspace-aware Git, artifacts, asset upload, mounts, and agent-oriented tools as higher-level capability surfaces. These sit above the authoritative filesystem and runtime selection rather than replacing either.
- `packages/computer/src/git/index.ts`
- `packages/computer/src/artifacts/index.ts`
- `packages/computer/src/assets/index.ts`

External infrastructure includes Cloudflare Durable Objects with SQLite, Workers RPC and Dynamic Workers, Cloudflare Containers, R2-backed mounts, Workers AI, and Cloudflare Artifacts. The container release image is assembled around a prebuilt Linux x64 daemon in `packages/computer-computerd-linux-x64/Dockerfile`.

#### Consumer Shapes
Runnable Workers under `examples/` are integration entry points rather than core services: HTTP workspace demos start at `examples/container/src/index.ts`, `examples/worker-shell/src/index.ts`, and `examples/worker-javascript/src/index.ts`. The comparison application combines a browser UI with a Worker orchestrator for side-by-side container and isolate agent runs: `examples/think-compare-runtimes/worker/index.ts`.

Main entry points: [`packages/computer/src/workspace.ts`](https://github.com/cloudflare/computer/blob/main/packages/computer/src/workspace.ts) (Workspace lifecycle), [`packages/dofs/src/fs/filesystem.ts`](https://github.com/cloudflare/computer/blob/main/packages/dofs/src/fs/filesystem.ts) (DO filesystem), [`packages/computer/src/runtime/runtime.ts`](https://github.com/cloudflare/computer/blob/main/packages/computer/src/runtime/runtime.ts) (Runtime abstraction), [`packages/computer/src/index.ts`](https://github.com/cloudflare/computer/blob/main/packages/computer/src/index.ts) (Computer package)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public APIs"]
  node_consumer(("Consumers &amp; examples<br/>entry points<br/>[index.ts]"))
  node_computer["Computer package<br/>Durable Object integration<br/>[index.ts]"]
  node_capabilities["Workspace capabilities<br/>Git, artifacts, assets<br/>[index.ts]"]
end

subgraph group_durable["Durable Workspace"]
  node_workspace["Workspace lifecycle<br/>orchestrator<br/>[workspace.ts]"]
  node_client["Workspace client<br/>proxy boundary<br/>[client.ts]"]
  node_runtime["Runtime abstraction<br/>execution interface<br/>[runtime.ts]"]
  node_dofs[("DO filesystem<br/>authoritative VFS<br/>[filesystem.ts]")]
  node_schema["Filesystem schema<br/>SQLite schema<br/>[core.ts]"]
  node_storage[("DO storage<br/>SQLite persistence<br/>[storage.ts]")]
  node_sync["Filesystem sync<br/>projection sync<br/>[apply.ts]"]
end

subgraph group_runtimes["Execution Backends"]
  node_container_backend["Container backend<br/>runtime backend"]
  node_shell_backend["Isolate shell backend<br/>runtime backend<br/>[worker-shell.ts]"]
  node_shell_adapter["Shell RPC adapter<br/>Workers RPC adapter<br/>[adapter.ts]"]
  node_js_backend["Isolate JavaScript backend<br/>runtime backend"]
  node_module_graph["Module graph<br/>module resolver<br/>[module-graph.ts]"]
end

subgraph group_container["Container Boundary"]
  node_computerd["computerd daemon<br/>container daemon<br/>[computerd.ts]"]
  node_fuse["FUSE virtual filesystem<br/>remote mount<br/>[vfs.ts]"]
  node_runner["Process runner<br/>local executor<br/>[runner.ts]"]
  node_rpc["Computer RPC<br/>shared wire protocol<br/>[interface.ts]"]
end

node_consumer -->|"uses"| node_computer
node_computer -->|"creates"| node_workspace
node_computer -->|"exposes"| node_client
node_workspace -->|"authoritative files"| node_dofs
node_dofs -->|"uses"| node_schema
node_dofs -->|"persists to"| node_storage
node_sync -->|"applies projections"| node_dofs
node_workspace -->|"exec delegates to"| node_runtime
node_capabilities -->|"workspace-aware services"| node_workspace
node_runtime -->|"backend: container"| node_container_backend
node_runtime -->|"backend: shell"| node_shell_backend
node_runtime -->|"backend: javascript"| node_js_backend
node_shell_backend -->|"accesses Workspace via"| node_shell_adapter
node_shell_adapter -.->|"Workers RPC"| node_workspace
node_js_backend -->|"loads modules through"| node_module_graph
node_js_backend -.->|"filesystem support"| node_workspace
node_container_backend -->|"starts"| node_computerd
node_computerd -->|"executes"| node_runner
node_runner -->|"uses mount"| node_fuse
node_fuse -->|"remote filesystem RPC"| node_rpc
node_rpc -.->|"Cap'n Web RPC"| node_dofs

click node_consumer "https://github.com/cloudflare/computer/blob/main/examples/container/src/index.ts"
click node_computer "https://github.com/cloudflare/computer/blob/main/packages/computer/src/index.ts"
click node_workspace "https://github.com/cloudflare/computer/blob/main/packages/computer/src/workspace.ts"
click node_client "https://github.com/cloudflare/computer/blob/main/packages/computer/src/client.ts"
click node_runtime "https://github.com/cloudflare/computer/blob/main/packages/computer/src/runtime/runtime.ts"
click node_dofs "https://github.com/cloudflare/computer/blob/main/packages/dofs/src/fs/filesystem.ts"
click node_schema "https://github.com/cloudflare/computer/blob/main/packages/dofs/src/schema/core.ts"
click node_storage "https://github.com/cloudflare/computer/blob/main/packages/dofs/src/storage.ts"
click node_sync "https://github.com/cloudflare/computer/blob/main/packages/dofs/src/sync/apply.ts"
click node_capabilities "https://github.com/cloudflare/computer/blob/main/packages/computer/src/git/index.ts"
click node_container_backend "https://github.com/cloudflare/computer/blob/main/packages/computer/src/backends/container/cloudflare-container.ts"
click node_shell_backend "https://github.com/cloudflare/computer/blob/main/packages/computer/src/backends/worker-shell/worker-shell.ts"
click node_shell_adapter "https://github.com/cloudflare/computer/blob/main/packages/computer/src/backends/worker-shell/adapter.ts"
click node_js_backend "https://github.com/cloudflare/computer/blob/main/packages/computer/src/backends/worker-javascript/worker-javascript.ts"
click node_module_graph "https://github.com/cloudflare/computer/blob/main/packages/computer/src/backends/worker-javascript/module-graph.ts"
click node_computerd "https://github.com/cloudflare/computer/blob/main/packages/computerd/src/cli/computerd.ts"
click node_fuse "https://github.com/cloudflare/computer/blob/main/packages/computerd/src/fuse/vfs.ts"
click node_runner "https://github.com/cloudflare/computer/blob/main/packages/computerd/src/exec/runner.ts"
click node_rpc "https://github.com/cloudflare/computer/blob/main/packages/rpc/src/interface.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_consumer,node_computer,node_capabilities toneBlue
class node_workspace,node_client,node_runtime,node_dofs,node_schema,node_storage,node_sync toneAmber
class node_container_backend,node_shell_backend,node_shell_adapter,node_js_backend,node_module_graph toneMint
class node_computerd,node_fuse,node_runner,node_rpc toneRose
```

## Components

### Public APIs

- [Consumers & examples](https://github.com/cloudflare/computer/blob/main/examples/container/src/index.ts): entry points · Workers construct and operate workspaces. · `examples/container/src/index.ts`
- [Computer package](https://github.com/cloudflare/computer/blob/main/packages/computer/src/index.ts): Durable Object integration · Workspace-facing public package. · `packages/computer/src/index.ts`
- [Workspace capabilities](https://github.com/cloudflare/computer/blob/main/packages/computer/src/git/index.ts): Git, artifacts, assets · Higher-level services built over Workspace state. · `packages/computer/src/git/index.ts`

### Durable Workspace

- [Workspace lifecycle](https://github.com/cloudflare/computer/blob/main/packages/computer/src/workspace.ts): orchestrator · Owns lifecycle, runtime registration, and observation. · `packages/computer/src/workspace.ts`
- [Workspace client](https://github.com/cloudflare/computer/blob/main/packages/computer/src/client.ts): proxy boundary · Client/proxy access to a Workspace. · `packages/computer/src/client.ts`
- [Runtime abstraction](https://github.com/cloudflare/computer/blob/main/packages/computer/src/runtime/runtime.ts): execution interface · Lazily selects a backend by stable ID. · `packages/computer/src/runtime/runtime.ts`
- [DO filesystem](https://github.com/cloudflare/computer/blob/main/packages/dofs/src/fs/filesystem.ts): authoritative VFS · POSIX-like filesystem over durable SQLite state. · `packages/dofs/src/fs/filesystem.ts`
- [Filesystem schema](https://github.com/cloudflare/computer/blob/main/packages/dofs/src/schema/core.ts): SQLite schema · Revision and metadata model. · `packages/dofs/src/schema/core.ts`
- [DO storage](https://github.com/cloudflare/computer/blob/main/packages/dofs/src/storage.ts): SQLite persistence · Durable Object-backed storage. · `packages/dofs/src/storage.ts`
- [Filesystem sync](https://github.com/cloudflare/computer/blob/main/packages/dofs/src/sync/apply.ts): projection sync · Transfers, applies, and coalesces blobs and watermarks. · `packages/dofs/src/sync/apply.ts`

### Execution Backends

- [Container backend](https://github.com/cloudflare/computer/blob/main/packages/computer/src/backends/container/cloudflare-container.ts): runtime backend · Projects the workspace into a Linux container. · `packages/computer/src/backends/container/cloudflare-container.ts`
- [Isolate shell backend](https://github.com/cloudflare/computer/blob/main/packages/computer/src/backends/worker-shell/worker-shell.ts): runtime backend · Runs just-bash in a Dynamic Worker. · `packages/computer/src/backends/worker-shell/worker-shell.ts`
- [Shell RPC adapter](https://github.com/cloudflare/computer/blob/main/packages/computer/src/backends/worker-shell/adapter.ts): Workers RPC adapter · Connects the shell to Workspace APIs. · `packages/computer/src/backends/worker-shell/adapter.ts`
- [Isolate JavaScript backend](https://github.com/cloudflare/computer/blob/main/packages/computer/src/backends/worker-javascript/worker-javascript.ts): runtime backend · Evaluates modules in fresh Dynamic Workers. · `packages/computer/src/backends/worker-javascript/worker-javascript.ts`
- [Module graph](https://github.com/cloudflare/computer/blob/main/packages/computer/src/backends/worker-javascript/module-graph.ts): module resolver · Curates imports and Workspace-backed modules. · `packages/computer/src/backends/worker-javascript/module-graph.ts`

### Container Boundary

- [computerd daemon](https://github.com/cloudflare/computer/blob/main/packages/computerd/src/cli/computerd.ts): container daemon · HTTP/WebSocket RPC daemon inside the container. · `packages/computerd/src/cli/computerd.ts`
- [FUSE virtual filesystem](https://github.com/cloudflare/computer/blob/main/packages/computerd/src/fuse/vfs.ts): remote mount · Mounts the Durable Object filesystem in the container. · `packages/computerd/src/fuse/vfs.ts`
- [Process runner](https://github.com/cloudflare/computer/blob/main/packages/computerd/src/exec/runner.ts): local executor · Runs Linux processes against the FUSE mount. · `packages/computerd/src/exec/runner.ts`
- [Computer RPC](https://github.com/cloudflare/computer/blob/main/packages/rpc/src/interface.ts): shared wire protocol · Client, server, and interfaces for the distributed boundary. · `packages/rpc/src/interface.ts`

## Connections

- Consumers & examples → Computer package: uses
- Computer package → Workspace lifecycle: creates
- Computer package → Workspace client: exposes
- Workspace lifecycle → DO filesystem: authoritative files
- DO filesystem → Filesystem schema: uses
- DO filesystem → DO storage: persists to
- Filesystem sync → DO filesystem: applies projections
- Workspace lifecycle → Runtime abstraction: exec delegates to
- Workspace capabilities → Workspace lifecycle: workspace-aware services
- Runtime abstraction → Container backend: backend: container
- Runtime abstraction → Isolate shell backend: backend: shell
- Runtime abstraction → Isolate JavaScript backend: backend: javascript
- Isolate shell backend → Shell RPC adapter: accesses Workspace via
- Shell RPC adapter → Workspace lifecycle: Workers RPC
- Isolate JavaScript backend → Module graph: loads modules through
- Isolate JavaScript backend → Workspace lifecycle: filesystem support
- Container backend → computerd daemon: starts
- computerd daemon → Process runner: executes
- Process runner → FUSE virtual filesystem: uses mount
- FUSE virtual filesystem → Computer RPC: remote filesystem RPC
- Computer RPC → DO filesystem: Cap'n Web RPC
