Cloudflare Computer Dependencies: Complete Monorepo Package Guide
The cloudflare/computer monorepo manages four interconnected npm packages through workspaces, with runtime dependencies ranging from Cap'n Proto serialization (capnweb) to FUSE filesystem bindings (fuse-native) and JavaScript parsing (acorn).
Cloudflare Computer is a monorepo that provides a virtual filesystem and RPC layer for Cloudflare Workers. Understanding the cloudflare/computer dependencies is essential for contributors integrating the storage layer, RPC contracts, client SDK, or daemon components into their applications.
Monorepo Architecture and Workspace Structure
The repository uses npm workspaces to coordinate multiple packages under a single root package.json. This structure ensures that workspace dependencies like @cloudflare/dofs and capnweb resolve to consistent versions across all modules.
The dependency graph follows a unidirectional data flow:
- @cloudflare/dofs provides the SQLite-backed storage foundation
- @cloudflare/computer-rpc implements the Cap'n Proto protocol layer using
capnweb - @cloudflare/computer exposes the high-level client SDK with
acornandjust-bash - @cloudflare/computerd runs the system daemon with
fuse-nativefor filesystem mounting
Runtime Dependencies by Package
Each package in the monorepo declares specific production dependencies required for execution in Cloudflare Workers or Node.js environments.
@cloudflare/dofs (Storage Layer)
The storage package operates as pure TypeScript with zero external runtime dependencies. It relies entirely on Cloudflare's native Durable Object APIs and SQLite bindings available in the Workers runtime.
Development dependencies in packages/dofs/package.json include:
@cloudflare/vitest-pool-workersfor testing@cloudflare/workers-typesfor TypeScript definitionstypescript,vitest, andwranglerfor build and deployment tooling
@cloudflare/computer-rpc (RPC Contract)
This package implements the Cap'n Proto RPC protocol (capnweb) that bridges the Durable Object storage and the computerd daemon.
Runtime dependencies:
@cloudflare/dofs(workspace link)- capnweb for Cap'n Proto serialization
Development dependencies include @cloudflare/workers-types, @types/ws, typescript, vitest, and ws for WebSocket type definitions.
@cloudflare/computer (Client SDK)
The public client API exposes high-level filesystem primitives and shell-scripting capabilities to applications.
Key runtime dependencies in packages/computer/package.json:
- acorn for JavaScript AST parsing
- capnweb for RPC communication
- just-bash for shell script execution
The extensive development dependency list includes build tools like esbuild, rolldown, and zod for schema validation, alongside workspace links to @cloudflare/computer-rpc and @cloudflare/dofs.
@cloudflare/computerd (Daemon)
The daemon package runs inside sandbox containers, mounting virtual filesystems via FUSE and handling RPC server operations.
Runtime dependencies:
@cloudflare/computer-rpc(workspace)@cloudflare/dofs(workspace)- @platformatic/vfs for virtual filesystem abstractions
- fuse-native for FUSE bindings
The minimal dev dependency set includes only vitest for unit testing.
Development Dependencies and Build Tools
Across the monorepo, shared development dependencies ensure consistent build pipelines. The root package.json defines workspace-level tooling, while individual packages declare specific compilers and test runners.
Critical dev dependencies include:
- TypeScript for type checking across all packages
- Vitest with
@cloudflare/vitest-pool-workersfor testing in the Workers runtime - Wrangler for deployment and local development
- esbuild and rolldown for bundling the client SDK
- isomorphic-git and memfs for filesystem operations in test environments
Installing and Using the Packages
To install the complete dependency tree locally:
git clone https://github.com/cloudflare/computer.git
cd computer
npm install
npm run build
Using the Client SDK
Import the filesystem creator in a Cloudflare Worker:
import { createFs } from "@cloudflare/computer";
export default {
async fetch(request, env) {
const fs = await createFs(env.DATABASE);
const file = await fs.readFile("/hello.txt", "utf8");
return new Response(file);
},
};
The createFs function requires a DATABASE binding that implements the @cloudflare/dofs interface.
Running the Daemon Locally
Build and start the RPC daemon for local testing:
npm run build:bin --workspace @cloudflare/computerd
node packages/computerd/dist/cli/computerd.cjs start --port 8080
This command launches the RPC server on port 8080 and attempts to mount the FUSE filesystem at the configured path.
Key Source Files and Configuration
The following files define the cloudflare/computer dependency structure:
package.json– Root workspace configuration and shared dev toolingpackages/dofs/package.json– Storage layer dependencies (zero runtime)packages/rpc/package.json– Cap'n Proto RPC dependencies includingcapnwebpackages/computer/package.json– Client SDK withacornandjust-bashpackages/computerd/package.json– Daemon configuration withfuse-nativepackages/computer/src/backends/worker-shell/script/build-bundle.mjs– Build script for shell-script bundles
Summary
- The cloudflare/computer monorepo uses npm workspaces to manage four core packages with distinct dependency profiles.
- Runtime dependencies include
capnwebfor RPC serialization,fuse-nativefor filesystem mounting, andacornfor JavaScript parsing. - @cloudflare/dofs operates with zero external runtime dependencies, relying solely on Cloudflare's native APIs.
- Development tooling spans TypeScript, Vitest, Wrangler, and esbuild/rolldown for consistent builds across packages.
- Installation requires
npm installat the root, followed bynpm run buildto compile workspace dependencies.
Frequently Asked Questions
What are the main runtime dependencies for the Cloudflare Computer client SDK?
The client SDK (@cloudflare/computer) requires three primary runtime dependencies: acorn for parsing JavaScript code, capnweb for Cap'n Proto RPC communication, and just-bash for executing shell scripts within the virtual filesystem.
Does the cloudflare/computer storage layer have any external dependencies?
No. The @cloudflare/dofs package has zero runtime dependencies, functioning as pure TypeScript that leverages Cloudflare's built-in SQLite and Durable Object APIs. It only declares development dependencies for testing and type checking.
How are dependencies shared across the cloudflare/computer monorepo?
The repository uses npm workspaces to hoist and synchronize common dependencies. Packages reference each other via workspace links (e.g., @cloudflare/dofs in packages/rpc/package.json), ensuring that shared libraries like capnweb maintain consistent versions across the RPC layer, client SDK, and daemon.
What build tools are required to compile cloudflare/computer from source?
Contributors need Node.js with npm workspaces support, TypeScript for compilation, and Vitest for testing. The client SDK specifically requires esbuild and rolldown for bundling, while the daemon requires native build capabilities for fuse-native FUSE bindings.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →