> ## 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.

# Browser Quickstart

> Run a Mirage workspace in a browser page with Vite and @struktoai/mirage-browser.

`@struktoai/mirage-browser` runs a workspace inside the page: the shell, the
commands and an in-memory filesystem, with no server and no credentials.

## Create the app

**1. Start a Vite app**

Vite needs Node 20.19+ or 22.12+:

```bash theme={null}
npm create vite@7 mirage-browser -- --template vanilla-ts
cd mirage-browser
npm install @struktoai/mirage-browser
```

With pnpm, also add `@struktoai/mirage-core`: Vite's dev server finds
Mirage's WebAssembly files through it.

**2. Replace src/main.ts**

```ts src/main.ts theme={null}
import { MountMode, RAMVFS, Workspace } from '@struktoai/mirage-browser'

async function main(): Promise<void> {
  const ws = new Workspace({ '/data': new RAMVFS() }, { mode: MountMode.WRITE })
  await ws.shell('echo "hello mirage" > /data/hello.txt')
  const result = await ws.shell('cat /data/hello.txt')
  document.querySelector<HTMLDivElement>('#app')!.textContent = result.stdoutText
  await ws.close()
}

void main()
```

Mounts are read-only unless you set a mode. `MountMode.WRITE` lets the shell create and change files under `/data`.

**3. Run it**

```bash theme={null}
npm run dev
```

Open the URL Vite prints. The page shows `hello mirage`.

## Next steps

> [card] [Keep files in the browser](https://docs.mirage.strukto.ai/typescript/vfs/opfs.md)
>
> OPFS keeps a workspace's files across page loads.

> [card] [Run python3 in the page](https://docs.mirage.strukto.ai/typescript/runtime/pyodide.md)
>
> Pyodide in a worker, with workspace files.

> [card] [Browser limitations](https://docs.mirage.strukto.ai/typescript/limitations.md#browser)
>
> CORS, storage quotas and Node-only mounts.


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