Frameworks

Todo app

A React todo app on the Vite dev server, with an API you can curl from bash and code that hot-reloads as you edit it.

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 vite-react-ts preset boots with its node_modules already installed. The demo writes its own files over it: a React app and a small API, written as a Vite dev-server middleware that keeps the todos in todos.json.

The page polls the API, so a todo added with curl from bash, or typed into todos.json in the editor, shows up within a second. Edits to App.tsx or index.css hot-reload without a page reload.

How it's built

const app = await vm.createInstance({ preset: 'vite-react-ts' });
await app.fs.writeFile('/home/user/app/src/App.tsx', appSource);

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