Servers

Express server

A real npm install of Express from the registry, then its server, which restarts as you edit server.js.

bash · ~/app
editor

The project's files open here.

Changes save as you type. Press Escape, then Tab, to leave the editor.

preview

The page the server serves shows here.

  1. boot
  2. npm install
  3. start
  4. ready

idle

betaClientVM is pre-1.0 (v0.2.0): things can break, and APIs may change between releases. Found a bug? Open an issue.

About this demo

The instance starts with a package.json and a server.js, nothing else. The unmodified npm that Node 24 bundles installs Express and its dependencies from the registry, into the instance’s own filesystem.

When server.js listens on port 3000, a service worker on the instance’s origin serves the page to the preview. Edit server.js in the editor and the demo restarts the server for you.

How it's built

const app = await vm.createInstance({
  fs: { from: { home: { user: { app: { 'package.json': pkg, 'server.js': server } } } } },
});

app.onPortOpen((port, url) => (preview.src = url));
await app.exec('npm install && npm start', { cwd: '/home/user/app' });