Introduction to jiki

jiki (じき) is a lightweight, browser-based Node.js runtime. It lets you write files, install npm packages, run shell commands, and start dev servers, all in the browser without a backend.

What can you build with jiki?

  • Interactive coding tutorials with real code execution and validation
  • Online playgrounds for React, Vue, Svelte, or any npm package
  • Documentation with runnable code snippets
  • Browser-based IDEs with editor, terminal, and preview
  • AI coding assistants that can read/write files and run code in a safe sandbox
  • Testing sandboxes that run Jest or Vitest in the browser

Core capabilities

jiki gives you a Node.js-like environment in the browser with a rich set of features:

FeatureDescription
Virtual filesystemIn-memory FS with directories, symlinks, file watching, and persistence
Package managerInstall packages from npm with full dependency resolution and caching
ShellPipes, logical operators, recursive globs, tab completion, and background jobs
TranspilerTypeScript and JSX via esbuild-wasm with source maps
Dev serverVite, Next.js, SvelteKit, and Remix with HMR
Plugin system6 hook types for extensibility
SandboxingResource limits for memory, files, network, and paths
SnapshotsSerialize and restore the entire container state

How it works

jiki runs entirely in the browser. It uses esbuild-wasm for TypeScript/JSX transpilation, Service Workers to intercept fetch requests and route them to virtual HTTP servers, and Web Workers for isolated code execution. A custom module resolver implements the Node.js resolution algorithm so require() and import work as expected.

import { boot } from "@run0/jiki";

const container = boot();
container.writeFile("/hello.js", 'console.log("Hello!")');
const result = await container.run("node hello.js");
console.log(result.stdout); // "Hello!\n"

Next steps