> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mirage.strukto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Cloudflare Container Machine in TypeScript

> Run captured programs in a Cloudflare Container, from its Durable Object or from anywhere through a relay.

Runs programs in a Cloudflare Container, from its Durable Object or from anywhere through a relay. Settings and notes: [Cloudflare Container](https://docs.mirage.strukto.ai/home/setup/machine/cloudflare_container.md).

## Install

```bash theme={null}
npm install @struktoai/mirage-node ssh2
```

The relay Worker itself needs `@struktoai/mirage-cloudflare`.

## Usage through a relay

```typescript theme={null}
import { MountMode, RAMVFS, Workspace } from '@struktoai/mirage-node'

const ws = new Workspace(
  { '/data': new RAMVFS() },
  {
    mode: MountMode.EXEC,
    machines: {
      box: {
        provider: 'cloudflare_container',
        url: 'https://mirage-relay.example.workers.dev/box',
        token: 'relay-token',
        mountType: 'ssh',
        captures: ['@python', '@external'],
      },
    },
  },
)
await ws.shell("python3 -c 'print(1 + 1)'")
```

In a browser, install `@struktoai/mirage-core` and import `@struktoai/mirage-core/machine/cloudflare_container/handle`
once to register the provider, and use `mountType: 'own'` or leave it
unset.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.