# How to Build the Cloudflare Computer Project: Complete Setup Guide

> Build the Cloudflare Computer project by cloning the repo and running npm install and build commands. Learn to bundle the native computerd binary with our complete setup guide.

- Repository: [Cloudflare/computer](https://github.com/cloudflare/computer)
- Tags: getting-started
- Published: 2026-08-09

---

**You can build the Cloudflare Computer project by cloning the monorepo, running `npm install` from the root to resolve workspace dependencies, and executing `npm run build` to compile all TypeScript packages, with optional steps to bundle the native `computerd` binary using Node's Single Executable Application (SEA) workflow.**

The Cloudflare Computer repository implements a SQLite-backed virtual filesystem with FUSE integration and Cap'n Proto RPC channels. Because it uses **npm workspaces**, the entire system builds from a single root directory with unified dependency management across packages like `@cloudflare/dofs` and `@cloudflare/computer-rpc`. This guide walks through the complete build process as documented in [`COLLABORATORS.md`](https://github.com/cloudflare/computer/blob/main/COLLABORATORS.md) and the individual package READMEs.

## Prerequisites

Before building, ensure your environment meets the requirements listed in [`COLLABORATORS.md`](https://github.com/cloudflare/computer/blob/main/COLLABORATORS.md):

- **Node.js** ≥ 22 and **npm**
- A recent **Linux kernel** if you intend to run the FUSE-based Container backend
- **FUSE development headers** on Linux to compile the native addon:

```bash

# Debian/Ubuntu

sudo apt-get install build-essential libfuse-dev

```

## Building the Cloudflare Computer Project

The build process follows three distinct phases: dependency installation, TypeScript compilation, and optional native binary bundling.

### Clone and Install Workspace Dependencies

Always run the installation from the repository root to maintain the workspace integrity. Running `npm install` inside an individual package creates a nested lockfile and breaks the workspace resolver.

```bash
git clone https://github.com/cloudflare/computer.git
cd computer
npm install

```

As noted in [`COLLABORATORS.md`](https://github.com/cloudflare/computer/blob/main/COLLABORATORS.md), this single command resolves dependencies for all packages—including `packages/dofs`, `packages/rpc`, and `packages/computerd`—simultaneously.

### Compile TypeScript Sources

Build every workspace package to its respective `dist/` directory:

```bash
npm run build

```

According to [`packages/computerd/README.md`](https://github.com/cloudflare/computer/blob/main/packages/computerd/README.md), running the test suite without this step fails because many test files import compiled artifacts from sibling packages.

### Build the Native computerd Binary (Optional)

If you need to run the **Container** backend locally or produce the Docker image, build the `computerd` daemon binary:

```bash
npm run build:bin --workspace=@cloudflare/computerd

```

This command uses Node's **Single Executable Application (SEA)** workflow to bundle the CLI with `esbuild`, inject the binary payload, and optionally sign the macOS binary. The final artifact lands under `packages/computerd/bin/computerd`.

### Build Docker Images (Optional)

For examples that spin up a container backend (such as `examples/container` and `examples/think`), build the pre-built image:

```bash
npm run build:docker

```

This requires Docker to be installed and running on your system.

## Testing the Build

Verify the compilation by running the full test suite:

```bash
npm test

```

To test a specific package rather than the entire workspace:

```bash
npm test --workspace @cloudflare/dofs

```

On non-Linux platforms, FUSE-related tests in `packages/computerd` are automatically skipped due to the lack of kernel support.

## Understanding the Workspace Architecture

The monorepo ships several distinct layers:

- **`packages/dofs`**: Implements the SQLite-backed virtual filesystem primitives (e.g., `applyChanges`, `stageBlob`, `fetchObjects`)
- **`packages/rpc`**: Defines Cap'n Proto (capnweb) wire types and shared RPC helpers used by both client and server
- **`packages/computerd`**: The FUSE-mount daemon that runs inside a sandbox container, syncing changes over the RPC channel
- **`packages/computer`**: The public-facing API consumed by Durable Objects
- **`packages/computer-computerd-linux-x64`**: Pre-built `computerd` binary for Linux-x64 distribution

At runtime, a **Workspace** holds a **Durable Object** which stores the authoritative SQLite state. This state can be projected into a Container runtime via the `computerd` daemon, accessed through an Isolate shell, or manipulated via Isolate JavaScript evaluation.

## Summary

- **Clone** the repository and run `npm install` from the root to resolve all workspace dependencies at once
- **Compile** TypeScript sources with `npm run build` before running tests or importing packages
- **Bundle** the native `computerd` binary using `npm run build:bin --workspace=@cloudflare/computerd` when working with the Container backend
- **Test** the entire project with `npm test`, noting that FUSE tests require Linux
- **Reference** [`COLLABORATORS.md`](https://github.com/cloudflare/computer/blob/main/COLLABORATORS.md) for contributor-specific workflows and `docs/` for design intent (though source code may diverge from specifications)

## Frequently Asked Questions

### What version of Node.js is required to build Cloudflare Computer?

The project requires **Node.js ≥ 22** and a compatible npm version. This is enforced to support the Single Executable Application (SEA) workflow and modern TypeScript features used across the workspace packages.

### Do I need Linux to build and run the full project?

You can build the TypeScript packages on any platform, but the **FUSE-based Container backend** requires a Linux kernel and `libfuse-dev` headers. The `computerd` daemon and its associated tests are automatically skipped on macOS and Windows during `npm test`.

### How do I build only the computerd binary without compiling the entire workspace?

Run the workspace-specific build command: `npm run build:bin --workspace=@cloudflare/computerd`. This executes the Node SEA bundling process specifically for the daemon package without rebuilding sibling packages like `@cloudflare/dofs` or `@cloudflare/computer`.

### Why must I run npm install from the repository root instead of individual package directories?

The Cloudflare Computer repository uses npm workspaces to link dependencies across `packages/dofs`, `packages/rpc`, and other modules. Installing from a subdirectory creates isolated `node_modules` and lockfiles that break the workspace resolution, leading to "module not found" errors when packages import from one another.