Mininet is great for learning network topologies and experimenting with software defined network (SDN) prototypes. This project is a React SPA that works like a small IDE: a file explorer (with a persistent virtual file system storing files locally on your machine), a code editor, and an interactive terminal Linux, Mininet, and Open vSwitch run locally in a v86 emulation browser worker, so you can get started immediately with no installation required. I hope this can be a helpful resource and reduces the barrier for people to learn about networks and SDN!
Requires Node.js 22.12+ and pnpm (the version pinned in package.json).
pnpm install --frozen-lockfile
pnpm devThe package scripts are also available as just recipes, alongside git and worktree helpers. Run just to list them, for eg. just setup, just web dev, just check or just worktree add <branch>.
Vite serves the app at http://127.0.0.1:5173. Click Boot to start the guest. The guest image is not in Git: booting locally needs a local build from pnpm build:guest (Docker with linux/386; see Rebuilding the Linux guest). Everything else runs without Docker.
This project is continuously deployed to Cloudflare Workers from main. wrangler.jsonc configures a Worker named mininet-web that serves the app as static assets. It has no server-side entrypoint, API, bindings, or secrets.
The guest image lives in the public R2 bucket mininet-guest, served at https://storage.mininet.mingjun.dev/<key>/…, where the key is a SHA-256 of the guest build inputs.
# Inspect packaging locally; this does not deploy.
pnpm deploy:check
# Serve the production build in the local Workers runtime.
pnpm preview
# Open http://127.0.0.1:8787
# When ready, authenticate and deploy manually.
pnpm exec wrangler login
pnpm run deployWrangler's custom build runs pnpm build before previewing or deploying. The build typechecks the app and browser worker, bundles the React SPA, copies the VM files, and verifies guest-image hashes and asset sizes. dist/ is generated and ignored by Git.
The guest is split into chunks below the per-file static-asset limit. All emulator and guest URLs are same-origin under /vm/; Vite's hashed application bundles are under /assets/. Use HTTPS outside localhost because image verification uses Web Crypto. No cross-origin isolation headers are required.
src/
App.tsx Terminal session, VM hook, and the workspace shell
workspace/Workspace.tsx Dockview layout, open files, and layout persistence
workspace/panels.tsx Explorer, terminal, welcome and file panels; tabs
explorer/Explorer.tsx File tree (headless-tree): select, rename, drag to move
editor/ Monaco loading, the editor view, and open documents
editor/intellisense/ Opt-in Python language server (basedpyright) and its Monaco providers
components/Terminal.tsx xterm.js session, mounting, input, and resize
components/TopBar.tsx Status, reboot, View menu, and storage warnings
hooks/useVirtualMachine.ts Worker lifecycle and readiness
vm/emulator.worker.ts Typed v86 startup, serial I/O, and file requests
vm/9p/ 9P2000.L server for /root/playground (OPFS or memory)
vm/fs-protocol.ts Host file operations served by the worker
vm/fs-client.ts Main-thread client for those operations
vm/messages.ts Typed worker message protocol
public/vm/ Kernel, initramfs chunks, emulator, BIOS, notices
public/pyright/ Language server worker (vendored)
guest/ Linux image build and Mininet topology source
scripts/ Guest key and packaging, R2 upload, asset and headless VM verification
wrangler.jsonc Workers deployment configuration
The network starts in OVS standalone learning mode; no SDN controller is bundled. The shell starts in /root/playground (~/playground); files there are saved in the browser; the rest of the guest filesystem is not persisted.
The worker serves /root/playground to the guest over 9P and to the page through the same server, so the Explorer and editor see what the shell sees, and the worker reports the guest's changes back to them. When OPFS is locked by another tab or unavailable, the same folder is served from memory instead: the Explorer and editor keep working, and the files last until the reload. The pane layout is saved in localStorage.
IntelliSense is off by default. Turning it on (the switch in the top bar while a file is open, or Settings) starts basedpyright in web workers the first time a Python file is open, and gives completions, hovers, signature help, semantic colouring and error checking, including for the Mininet API. Nothing is sent anywhere: the server runs in the browser, reading the playground's Python files and public/pyright/mininet.json, the Mininet source exported from the guest image by pnpm build:guest.
pnpm verify
pnpm test:vm
pnpm deploy:checkpnpm verify typechecks, lints, runs the unit tests, checks formatting, and builds. pnpm verify:fast skips the build. CI runs pnpm verify and test:vm.
Only needed when changing software inside the guest or guest/lab.py. Requires Docker with linux/386 support.
pnpm build:guest
pnpm test:vm
pnpm buildguest/Dockerfile creates an Alpine x86 environment with Mininet 2.3.0, Python, OVS, and networking utilities. It compiles mnexec and includes the namespace, veth, OVS, and link-shaping kernel modules. scripts/build-guest.sh writes the kernel, the chunked initramfs, guest.json, the Mininet source for the editor (mininet.json), and records of the package versions (packages.txt) and kernel configuration (kernel.config) to public/vm/guest/<key>/. None of it is committed. Every file directly in guest/ must be listed in GUEST_INPUTS in scripts/guest-key.mjs, which refuses to compute a key otherwise.
Builds are not reproducible: Alpine's repository can supply newer patch versions, and file timestamps differ. The key identifies the inputs, and R2 keeps the first build that CI tested for each key; the chunks it serves are SHA-256 verified in the browser.
The download is approximately 39 MiB. The VM uses 512 MiB of configured guest RAM, plus emulator and browser overhead. With IntelliSense on, the language server adds a download of about 3 MiB compressed (18 MiB uncompressed) and roughly 500 MiB of memory. All Mininet hosts share one guest kernel. Performance and packet timings are influenced by CPU emulation and browser scheduling.
The application source in this repository is released under the MIT License.
These components are distributed with the app and stay under their own licenses:
- v86, 0.5.471 — BSD-2-Clause;
public/vm/v86.LICENSE. - Mininet 2.3.0 — BSD; license inside the guest at
/usr/share/licenses/mininet/LICENSEand in the guest'smininet.json. - xterm.js — MIT; notices in
public/vm/. - Monaco Editor — MIT.
- Dockview — MIT.
- Headless Tree — MIT.
- basedpyright, browser build 1.40.1 — MIT;
public/pyright/basedpyright.LICENSE. It bundles typeshed (Apache-2.0). - Alpine Linux — component-specific licenses; source recipes.
- Open vSwitch — userspace Apache-2.0; kernel datapath GPL-2.0.
- SeaBIOS — LGPLv3; source. BIOS files originate from the official v86 repository.