Runtime
WebJs runs on Node 24+ or Bun. The same app source runs on either; the framework picks a runtime-neutral path internally and only the listener shell, the type stripper, and a few built-ins differ. Deno is a planned target (the listener seam is already runtime-neutral), not yet supported. This page is the single reference for the per-runtime commands and differences; other pages link here rather than repeat them.
Related reading:
- Getting Started for scaffolding an app.
- No-Build Model for how source is served.
- Deployment for shipping a container.
Node vs Bun at a glance
| Area | Node 24+ | Bun | Deno |
|---|---|---|---|
| Install | npm install | bun install (required, like Node) | planned |
| Run | npm run dev / npm run start | bun run dev / bun run start | planned |
| Listener | node:http shell | native Bun.serve (about 1.9x req/s on the listening path) | planned |
| TypeScript stripping | built-in module.stripTypeScriptTypes | amaro | planned |
| SQLite driver | built-in node:sqlite | built-in bun:sqlite | planned |
| Hot reload | in place, in one long-lived process | in place, in one long-lived process | planned |
| WebSocket | the ws library | native Bun.serve (bridged to the same API) | planned |
| 103 Early Hints | yes | no (Bun.serve has no informational-response API) | planned |
| Dev edit to a page / layout | refreshes in place, no reload | refreshes in place, no reload | planned |
The in-place dev refresh needs the server process to survive the edit, and on both runtimes it does. A page or layout never hydrates, so a freshly rendered page is the complete truth for it and the client router can swap it in without a reload, keeping your scroll position and the hydrated state of components outside the changed region. The server classifies the changed file and puts the verdict on the live-reload event, so it needs a process that is still alive to do the classifying.
The dev server stays ONE process for the whole session on both runtimes. On Node, a module resolve hook gives an edited module and every module that imports it a new URL, so the next request evaluates exactly that chain again (a db/ schema, a route.ts, middleware and *.server.ts files included) while every other module keeps its instance and its state: sessions in the memory store, cache() entries, an open WebSocket. On Bun the same holds: the dev server loads app modules fresh from disk (an editor's atomic save included) and points every import of an edited module, or of a module above one, at a new versioned path, so Bun evaluates the same chain again and an untouched module keeps its state there too. Only an edit it cannot place (a new or deleted file, say) asks bun --hot to re-read every app module, and the first server keeps running through that, so nothing starts twice and memory stays flat however many edits you make. In the browser, a served module that imports a changed module asks for it at a new versioned URL, so the tab reaches the edited code while every untouched module keeps its instance.
Only a file that a running process reads once restarts the server: .env, package.json, a lockfile, instrumentation.* and env.*. The restarted server reads the edited .env (on Bun too), and the tab reloads once.
What each dev edit does
Each saved file gets the lightest update that is still correct, and a burst of edits takes the strongest one any of them needs. Every update logs one line in the browser console, so you can always tell which one ran.
| Edit | What the tab does | Console |
|---|---|---|
| a page file | re-renders the page on the server and morphs it in place | [webjs] page updated in place (<file>) |
a layout, or a server-only module (lib/, modules/, db/, a *.server.ts file, route.ts, middleware) | re-renders the whole body in place | [webjs] layout updated in place (<file>) |
| a component, or a browser module only components import | hot-swaps the component class, keeping its state (see Components) | [webjs] hot-swapped <my-tag> (<file>) |
a .css file outside the module graph (a public/ stylesheet, a Tailwind input) | swaps the stylesheets in place, no re-render | [webjs] stylesheets refreshed (<file>) |
an env file (.env, .env.local, .env.development, .env.development.local), package.json, a lockfile, instrumentation.*, env.* | the server restarts and the tab reloads once | [webjs] full reload: server-restarted |
anything else: a new or deleted file, another public/ asset, a component edit the hot swap refuses | a full reload | [webjs] full reload: <reason> (<file>) |
The full-reload line is printed by the page that loads after the reload, so it survives the reload it explains, and its reason names the rule that forced it. When an edit breaks a page render, the error overlay goes up over the last good page instead of replacing it, and the edit that fixes it applies in place.
A rebuild that fails part way still discards the previous analysis, so the next request analyses the app afresh instead of serving the build from before the edit. The resolved vendor importmap is kept across edits and resolved again only after an edit to the app's package.json, so an unpinned app does not refetch its CDN modules on every save.
The supervisor is part of webjs dev itself (it replaced node --watch), and it is built so the preview does not stay down. A file in a watched directory that the dev server cannot read or watch (for example the temporary file sed -i creates when another user runs it, or a file deleted while it was being watched) logs one file watcher skipped warning, and the server keeps serving and reloading. Editor temporary and swap files are ignored, and a temporary file renamed over a source file counts as an edit to that file. If the server process crashes, the supervisor starts it again on the next file change, or by itself after a short wait (0.5s, then up to 10s for repeated crashes), and an open tab waits for it however long that takes, logging [webjs] waiting for the dev server... once, before it reloads. On both runtimes the supervisor restarts the server only for the restart files above.
Either way the .ts stripping is position-preserving with no sourcemap, and the bytes the browser fetches are identical. The 103 Early Hints gap only costs a small first-load latency edge where your edge forwards 103, never correctness (the modulepreload hints still ship in the document head).
Node (the default)
Scaffold with webjs create my-app (Node is the default runtime). Then:
npm install
npm run dev # or: npm run start Node 24+ is required: the built-in TypeScript stripper (module.stripTypeScriptTypes, stable from Node 24) and recursive fs.watch need it. The CLI's assertNodeVersion() preflight enforces the floor.
Bun
Scaffold with webjs create my-app --runtime bun, or bun create webjs my-app (the runtime is auto-detected from the invoking package manager). Then:
bun install
bun run dev # or: bun run start A Bun app installs with bun install (like Node), then runs on Bun: its dev / start / db scripts force bun --bun, which overrides the webjs bin's Node shebang so the server runs on Bun, where it selects the native Bun.serve listener and strips types via amaro. The dependencies resolve from node_modules, the same as Node.
The install also gives editor type intelligence (the editor reads the .d.ts files in node_modules).
Install model and reproducibility
A Bun app commits a bun.lock (the Bun analog of package-lock.json) for reproducible, offline installs. The scaffold's Bun Dockerfile runs bun install and serves on Bun via CMD ["bun", "--bun", "run", "start"].
Future runtimes
The server's listener selection is a runtime-neutral seam: startServer chooses the Bun.serve shell on Bun and the node:http shell on Node through the same seam, which is designed to also host a Deno.serve or an embedded adapter later. When Deno support lands it will appear here. Edge runtimes with no filesystem are a separate, later target.