# How to Deploy Applications Using Cloudflare Computer's Runtime Types

> Deploy applications with Cloudflare Computer's runtime types. Learn to use container shell, worker shell, and worker JavaScript for seamless code execution within Durable Objects.

- Repository: [Cloudflare/computer](https://github.com/cloudflare/computer)
- Tags: how-to-guide
- Published: 2026-08-15

---

**Cloudflare Computer lets you run code inside a Durable Object through three runtime types—`container-shell`, `worker-shell`, and `worker-javascript`—each selected via the `backend` option in `workspace.runtime.exec()`.**

Cloudflare Computer extends Cloudflare Workers with persistent compute environments backed by Durable Objects. Choosing the right **runtime type** determines whether your code runs in a full Linux container, a lightweight bash shell, or a JavaScript module environment. This guide walks through deploying applications with each backend using the official `@cloudflare/computer` package.

## Understanding Cloudflare Computer Runtime Types

Cloudflare Computer offers three distinct backends for executing code. Your selection depends on what your workload requires:

| Runtime ID | Execution Environment | Best For |
|------------|----------------------|----------|
| `container-shell` | Full Linux container with FUSE mount | Native binaries, system packages, complete Linux environments |
| `worker-shell` | `just-bash` inside a Dynamic Worker | Fast text processing, Git operations, simple commands without container overhead |
| `worker-javascript` | ECMAScript module in a Dynamic Worker | Structured JavaScript with workspace access and trusted modules |

All runtimes share the same entry point in [`packages/computer/src/runtime/runtime.ts`](https://github.com/cloudflare/computer/blob/main/packages/computer/src/runtime/runtime.ts). The `WorkspaceRuntime.exec()` method routes your request to the appropriate backend:

```typescript
const handle = await workspace.runtime.exec(source, {
  backend: "container-shell",   // or "worker-shell" / "worker-javascript"
  cwd: "/workspace",
  encoding: "utf8",
});
const result = await handle.result();

```

The runtime interface specification in [`docs/05_runtime_interface.md`](https://github.com/cloudflare/computer/blob/main/docs/05_runtime_interface.md) defines the complete API contract, backend routing logic, and result shapes.

## Deploying a Worker with Durable Object and Runtime Backend

Follow these steps to deploy a Cloudflare Computer application with your chosen runtime type.

### 1. Install the Computer Package

```bash
npm install @cloudflare/computer

```

The [`packages/computer/README.md`](https://github.com/cloudflare/computer/blob/main/packages/computer/README.md) contains complete installation instructions and dependency requirements.

### 2. Create a Durable Object with Backend Attachment

This example configures the `container-shell` backend. The pattern is identical for other runtimes—only the backend class and identifier change.

```typescript
// src/index.ts
import { Workspace } from "@cloudflare/computer";
import { CloudflareContainerBackend } from "@cloudflare/computer/backends/container";

export class ContainerExample extends DurableObject {
  private workspace?: Workspace;

  async fetch(request: Request) {
    const ws = await this.getWorkspace();
    // Route processing logic here
  }

  private async getWorkspace() {
    if (!this.workspace) {
      const backend = new CloudflareContainerBackend({
        binding: this.env.CONTAINER,
      });
      this.workspace = new Workspace({ 
        backends: { "container-shell": backend } 
      });
    }
    return this.workspace;
  }
}

```

The container backend implementation lives in `packages/computer/backends/container`. Reference the complete example in [`examples/container/README.md`](https://github.com/cloudflare/computer/blob/main/examples/container/README.md).

### 3. Configure wrangler.jsonc

Bind your Durable Object, runtime service, and any storage resources:

```jsonc
{
  "name": "computer-container",
  "compatibility_date": "2024-01-01",
  "pages": { "binding": "DO" },
  "services": [{ 
    "binding": "CONTAINER", 
    "service": "computerd", 
    "environment": "production" 
  }],
  "durable_objects": [{ 
    "binding": "ContainerExample", 
    "class_name": "ContainerExample" 
  }]
}

```

Each example in the repository contains a working `wrangler.jsonc` you can adapt.

### 4. Deploy to Cloudflare

**Local development:**

```bash
npm run dev --workspace @example/computer-container

```

This command starts Docker, launches `computerd`, and runs `wrangler dev` simultaneously.

**Production deployment:**

```bash
npm run deploy --workspace @example/computer-container

```

This executes `wrangler deploy`, the standard mechanism for shipping Workers and Durable Objects to Cloudflare's edge.

See [`examples/worker-javascript/README.md`](https://github.com/cloudflare/computer/blob/main/examples/worker-javascript/README.md) and [`examples/container/README.md`](https://github.com/cloudflare/computer/blob/main/examples/container/README.md) for deployment details specific to each runtime.

## Runtime-Specific Deployment Examples

### Container-Shell Runtime

Use this for commands requiring native binaries or full Linux capabilities:

```typescript
const execHandle = await workspace.runtime.exec(
  "cat /workspace/hello.txt && uname -a",
  { backend: "container-shell", encoding: "utf8" }
);
const { stdout, exitCode } = await execHandle.result();
console.log("Command output:", stdout);

```

The FUSE mount provides persistent workspace storage across invocations.

### Worker-Shell Runtime

Deploy this for lightweight, fast-executing commands without container startup overhead:

```typescript
const execHandle = await workspace.runtime.exec(
  "grep -R TODO .",
  { backend: "worker-shell", cwd: "/workspace", encoding: "utf8" }
);
const { stdout } = await execHandle.result();
console.log(stdout);

```

As implemented in [`examples/worker-shell/README.md`](https://github.com/cloudflare/computer/blob/main/examples/worker-shell/README.md), this backend excels at text tooling and Git operations via the `ws:git` module.

### Worker-JavaScript Runtime

Deploy structured JavaScript modules with controlled I/O:

```typescript
const source = `
  import { readFile } from "node:fs/promises";
  export default async () => {
    const data = await readFile("/workspace/package.json", "utf8");
    return JSON.parse(data).name;
  };
`;
const execHandle = await workspace.runtime.exec(source, {
  backend: "worker-javascript",
  input: { foo: "bar" },
  env: { NODE_ENV: "production" },
});
const { value } = await execHandle.result();
console.log("Package name:", value);

```

According to the Cloudflare Computer source code, this runtime grants access to `ws:git` and `ws:artifacts` trusted modules while sandboxing other capabilities.

## Key Source Files for Deployment

| File | Purpose |
|------|---------|
| [`packages/computer/src/runtime/runtime.ts`](https://github.com/cloudflare/computer/blob/main/packages/computer/src/runtime/runtime.ts) | `WorkspaceRuntime.exec()` implementation and exec-handle plumbing |
| [`docs/05_runtime_interface.md`](https://github.com/cloudflare/computer/blob/main/docs/05_runtime_interface.md) | Runtime API design, backend routing, and result specifications |
| [`examples/worker-shell/README.md`](https://github.com/cloudflare/computer/blob/main/examples/worker-shell/README.md) | Minimal worker-shell deployment example |
| [`examples/container/README.md`](https://github.com/cloudflare/computer/blob/main/examples/container/README.md) | Full container backend with Docker integration |
| [`examples/worker-javascript/README.md`](https://github.com/cloudflare/computer/blob/main/examples/worker-javascript/README.md) | JavaScript module backend with structured input/output |

## Summary

- **Three runtime types** cover the spectrum from full Linux containers (`container-shell`) to lightweight shells (`worker-shell`) to structured JavaScript (`worker-javascript`).
- **Single API entry point**: `workspace.runtime.exec()` with `backend` option routes to the appropriate environment.
- **Deployment requires**: `@cloudflare/computer` package, Durable Object class with backend instantiation, `wrangler.jsonc` configuration, and standard `wrangler deploy`.
- **Container backend** sits in `packages/computer/backends/container` with full examples in `examples/container/`.
- **Worker runtimes** execute in Dynamic Workers with `just-bash` or ECMAScript module support documented in their respective example READMEs.

## Frequently Asked Questions

### What is the difference between worker-shell and container-shell runtimes?

**`worker-shell`** runs `just-bash` directly in a Dynamic Worker without container overhead—ideal for fast Git operations and text processing. **`container-shell`** provisions a full Linux container with FUSE-mounted storage, required for native binaries, package installations, or complete Linux environments. Choose `worker-shell` for speed; choose `container-shell` for compatibility.

### How do I pass data into a worker-javascript runtime?

Use the `input` option in `workspace.runtime.exec()`. According to [`docs/05_runtime_interface.md`](https://github.com/cloudflare/computer/blob/main/docs/05_runtime_interface.md), this structured data becomes available to your ECMAScript module. Retrieve results through the `value` property on the resolved handle's result—the module's default export return value.

### Can I use multiple runtime types in one Durable Object?

Yes. Instantiate multiple backends and register them under different names in the `backends` object passed to `Workspace`. Invoke each by specifying the corresponding `backend` identifier in `exec()` calls. The runtime implementation in [`packages/computer/src/runtime/runtime.ts`](https://github.com/cloudflare/computer/blob/main/packages/computer/src/runtime/runtime.ts) handles routing dynamically.

### What Cloudflare services integrate with Computer deployments?

Cloudflare Computer integrates with **Durable Objects** for persistence, **R2** for object storage (optional seeding), and standard **Workers** for request handling. The `wrangler.jsonc` binds these together—see any example's configuration for the complete service dependency pattern.