Browser-native Node.js

Run Node in the browser

Add a filesystem, shell, package manager, dev server, editor, terminal, and live preview to your product.

  • Runs in the browser
  • Starts in seconds
  • Works with npm

Choose your layer

Choose your integration surface.

Build a browser runtime with Client, React, or Elements, and add coding agents with plugins.

Five-minute quickstart

Create your first sandbox.

3 steps
1

Install the client

Add the low-level SDK to any browser application.

bash
npm install @nodesandbox-ai/client
2

Create and start

Seed a project, install its dependencies, then explicitly start its dev script. Use onReady to run basic shell commands while installation continues.

sandbox.ts
import { Sandbox } from '@nodesandbox-ai/client';

const sandbox = await Sandbox.create({
  apiKey: import.meta.env.VITE_NODESANDBOX_API_KEY,
  source: {
    type: 'files',
    files: {
      'package.json': JSON.stringify({
        scripts: { dev: 'vite --host 0.0.0.0' },
        dependencies: { vite: '8.1.3' },
      }),
      'index.html': '<h1>Hello from NodeSandbox</h1>',
    },
  },
});

const preview = await sandbox.start();
console.log(preview.url);
3

Render the preview

Use the returned per-sandbox URL in your own iframe, or let React and Elements render it.

preview.ts
const frame = document.createElement('iframe');
frame.src = preview.url;
mount.append(frame);

// Kills your dev server and tears down the runtime.
sandbox.dispose();
frame.remove();

Add agents and custom commands

The sandbox provides files, shell commands, Node/npm, and previews. Add optional programs to each instance with plugins; their assets load when a command first runs.

plugins.ts
import { opencodePlugin } from '@nodesandbox-ai/plugin-opencode';

const sandbox = await Sandbox.create({
  apiKey,
  source,
  plugins: [opencodePlugin()],
});
const terminal = sandbox.terminals.create({ startCommand: 'opencode' });
await terminal.open();

Read the plugin overview, configure Claude Code, OpenCode, or Codex, or develop your own plugin.

Use Elements' agent workspace to add an agent sidenav and mobile agent/preview tabs without wiring terminal input and output yourself.