Show HN: A Unix environment in a single HTML file (420 KB)
Source: Hacker News
Overview
A Unix environment in one HTML file.
- Shell, filesystem, git, npm, vi, and 200+ commands.
- ~420 KB gzipped. No server. Runs in your browser right now.
user@shiro:~$ npm init -y
Wrote to /home/user/package.json
user@shiro:~$ npm install left-pad
added 1 package
user@shiro:~$ echo 'const lp = require("left-pad"); console.log(lp("hello HN", 30, "."))' > app.js
user@shiro:~$ node app.js
......................hello HN
user@shiro:~$ git init && git add . && git commit -m "shipped from a browser tab"
Initialized empty Git repository in /home/user
[main (root-commit) a1b2c3d] shipped from a browser tab
3 files changed, 17 insertions(+)
user@shiro:~$ ▮
A static HTML file that boots into a Unix shell. The filesystem is IndexedDB. Commands are JavaScript. Files survive page reloads. Everything runs client‑side — the page works offline with no server at all.
Build and interact with apps
Write a counter, serve it, click buttons from the shell, upgrade to a grapher, commit with git.
Interact → counter → serve → page commands → upgrade → commit
Serve an app, use page to click and read DOM elements, then commit.
Real git, no server
init, add, commit, diff — all running client‑side via isomorphic‑git.
Snapshot as a GIF
Capture the entire filesystem into a GIF. Drag it to another instance to restore.
Seed GIF → snapshot → drag → restore
source → target (illustrative)
How it works
Filesystem
IndexedDB with a POSIX‑like API: stat, readdir, readFile, writeFile, mkdir, symlink, chmod, glob. Files persist across reloads.
Shell
Supports pipes, redirects, $variables, &&, ||, quoting, heredocs—enough POSIX features for real scripting.
Packages
Real npm tarballs from the registry. node runs JavaScript files. esbuild bundles TypeScript. require() resolves node_modules.
One file
Single self‑contained HTML. All JS/CSS inlined by the build. ~420 KB gzipped. Deploy anywhere — GitHub Pages, S3, or open it locally.