logo
Virtual Runtime Engine

Run frontend apps,
inside the browser.

VRE mounts a virtual filesystem and executes HTML, CSS, and JavaScript entirely client-side. Inspect DOM, styles, console, network, sources, logs, and errors through a structured API built for agents, IDEs, sandboxes, and live previews.

Zero servers DevTools‑style API Drop‑in embed Agent‑ready Snapshot & restore Screenshot API

VRE running in this page

An inspectable browser runtime,
not a basic iframe preview.

Virtual filesystem, network interception, console capture, DOM inspector, and a programmatic API — all living in the browser.

01

Virtual Filesystem

Pass a plain JSON tree of files. VRE intercepts every request and serves them from memory — no server, no S3. Supports inline content, host‑fetched assets, and CDN URLs transparently.

readFile() writeFiles() snapshotFilesystem() diffFile()
02

Devtools API

Query console logs, network requests, DOM snapshots, computed styles, and box models — all programmatically. The same data the Elements and Network panels show, available to your code in real time.

getConsoleLogs() getNetworkLog() getDOM() getBoxModel()
03

Agent Interface

One call returns a complete serialisable snapshot — status, files, DOM, errors, logs, network. Pass it directly into an LLM prompt. Designed from the ground up for AI coding tools and automated testing.

getContext() runScript() eval() capture()
04

Interaction Layer

Click, type, scroll, hover, focus — fire real browser events inside the preview iframe from your code. Wait for elements, console messages, or network requests before proceeding. Like a headless driver, without the headless browser.

click() type() waitForElement() scroll()

Built for programmatic control.

Every method is designed to be called by code — agents, test runners, IDE extensions, or your own tooling.

Quick start

One script tag. Pass a filesystem object. Call run().

<div id="vre"></div>
<script src="file-system.js"></script>

<script type="module">
import { VRE } from "https://preview.codevre.dev/v1/vre.esm.js";

const vre = VRE.mount({
  ownerId: 'YOUR_OWNER_ID',
  container: "#vre",
  fileSystem: window.fileSystem,
  entryPath: "/index.html",
  devtoolsOpen: true,
});
vre.run();
</script>

getContext(opts?)

Returns a complete serialisable snapshot — status, files, DOM, errors, logs, network.

// Everything your agent needs, one call
const ctx = await vre.getContext();

// Structured result ready for an LLM prompt:
{
  status: { running, ready, entryPath },
  files: [{ path, mimetype, size }],
  errors: [{ level, message, origin }],
  consoleLogs: [{ level, message, timestamp }],
  networkLog: [{ url, method, status, duration }],
  dom: { type, tag, children, ... }
}

eval(code, opts?)

Evaluate JavaScript inside the preview iframe.

const title = await vre.eval('document.title');

const len = await vre.eval(
  'document.querySelectorAll(".item").length'
);

// evalAsync wraps in an async IIFE
const data = await vre.evalAsync(`
  return await fetch('/api/data').then(r => r.json())
`);

writeFiles(files, opts?)

Write multiple files at once with a single reload.

vre.writeFiles([
  { path: '/index.html', content: html },
  { path: '/style.css', content: css },
  { path: '/app.js', content: js },
]);

// Change the entry point on reload
vre.writeFiles(files, { entryPath: '/dashboard.html' });

snapshotFilesystem()

Save and restore filesystem state safely.

const token = vre.snapshotFilesystem();

// Agent writes and runs code
vre.writeFiles([{ path: '/app.js', content: agentCode }]);

// Roll back if needed
vre.restoreSnapshot(token);

runScript(steps)

Run declarative actions with results + errors.

const { results, errors } = await vre.runScript([
  { action: 'waitForElement', args: ['#app'] },
  { action: 'click', args: ['#submit'] },
  { action: 'waitForConsole', args: ['Done'] },
  { action: 'capture', args: [] },
]);

queryDOM(selector)

Query DOM snapshot using CSS selectors.

await vre.getDOM({ fresh: true });

const buttons = vre.queryDOM('button');
const cards = vre.queryDOM('.card');

// Inspect deeper
const el = await vre.getElement(buttons[0].path);
const box = await vre.getBoxModel(buttons[0].path);
// → { margin, border, padding, content }

capture(opts?)

Capture screenshots of the preview.

// Full viewport
const png = await vre.capture();

// Target element
const card = await vre.capture({ selector: '#card' });
const hero = await vre.captureElement('.hero');

Where VRE fits.

VRE sits between generated code and the browser: an embeddable, zero-server runtime that runs frontend apps and exposes DOM, styles, console, network, errors, and files through a programmatic API.

01 —

AI coding tools

Every agent generating HTML, CSS, or JS needs somewhere to run it. Browser runtime fidelity for frontend apps. Zero cloud cost per execution. An API that reads back exactly what happened.

02 —

Online IDEs & learning platforms

Most runtimes are vertically integrated into someone else's product. VRE is embeddable — drop it into your bootcamp, interview tool, or docs site.

03 —

Browser-based dev tools

Extensions, devtools panels, and sandbox utilities that need a controlled preview with real inspection capabilities and a full programmatic surface.

04 —

Docs & interactive examples

Replace static code snippets with live, editable examples. Let users tweak code and instantly see output — no setup, no sandbox links, no external tools.

05 —

Frontend testing & QA

Run deterministic UI tests entirely in-browser. Simulate clicks, capture DOM, inspect layout, and assert behavior without spinning up Playwright or CI infrastructure.

06 —

Component playgrounds

Power design systems and component libraries with isolated, inspectable previews. Load components as files, mutate props, and observe real DOM output programmatically.


Ship the runtime.
Keep the server bill.

One script tag. A filesystem object. That's the entire setup. No infrastructure, no cold starts, no per-execution charges.

Get started free Read the docs