Skip to content
VaelJS Blog

Interactive Playground

vaeljs.com/playground is live at /playground/, letting developers write, strip, run, and test erasable TypeScript and 22 vael:* standard library modules directly in the browser from curated presets and shareable #code= snippets.

Shipped Architecture: Track A (100% Client-Side Wasm)

Section titled “Shipped Architecture: Track A (100% Client-Side Wasm)”

Track A compiles vaeljs-lite-core (vael-lite, QuickJS-NG) to wasm32-unknown-unknown and executes 100% client-side inside a Dedicated Web Worker.

vaeljs.com remains purely static on Cloudflare’s $0/mo Free tier (Workers Static Assets):

  • $0 compute cost: Static Wasm (4.9 MiB raw / 1.67 MiB gzipped) and ES module assets are served from edge cache with unlimited free requests; every user script executes on the visitor’s own CPU.
  • Dedicated Web Worker isolation: worker.js initializes the Wasm module off the UI thread, enforces a 5,000 ms wall-clock watchdog (worker.terminate() on timeout), and automatically terminates and respawns on any Wasm trap or host exception.
  • Strict Content Security Policy: /playground/ ships with default-src 'none'; script-src 'self' 'wasm-unsafe-eval'; worker-src 'self', zero inline <script> tags, zero eval / blob: URLs, and a DOM-only ANSI renderer (textContent, never innerHTML).
  • Shared TypeScript pipeline: Uses the exact deno_ast erasable TypeScript stripping and module resolution pipeline from vaeljs-lite-core.

Track A Virtual Module & Filesystem Surface (22 Modules)

Section titled “Track A Virtual Module & Filesystem Surface (22 Modules)”

Inside /playground/:

  • 22 enabled Wasm modules: vael:ansi, vael:assert, vael:chars, vael:console, vael:crypto (pure-Rust crypto + getrandom backed by Web Crypto CSPRNG), vael:fmt, vael:fmt/bytes, vael:fmt/duration, vael:fmt/inspect, vael:fmt/printf, vael:fmt/strip-ansi-code, vael:fs, vael:os, vael:os/dirs, vael:path, vael:slices, vael:strings, vael:template, vael:test, vael:uuid, vael:uuid/v4, and vael:uuid/v7.
  • Virtual in-memory FS (vael:fs): Backed by a bounded per-run memory VFS prefilled from the multi-file editor tabs, returning created, modified, and binary files to the Virtual Files inspector without host disk access.
  • Explicitly unavailable in browser Wasm: Host networking, databases, subprocesses, and V8-only modules (vael:http, vael:db, vael:exec, vael:fetch, vael:ssh, vael:cron, vael:age, node:*) require native vjs or vjs-lite.
Browser Tab (/playground/)
├── Multi-File Editor + Shareable #code=<base64url> State
├── Dedicated Web Worker (/playground/worker.js) -> 5s Watchdog + Auto-Respawn
│ └── vael-lite (QuickJS-NG · wasm32-unknown-unknown, 4.9 MiB / 1.67 MiB gz)
│ ├── deno_ast erasable TS stripping
│ ├── In-memory VFS (vael:fs)
│ └── 22 pure-Rust vael:* modules (vael:template, vael:crypto, vael:test, ...)
└── Safe ANSI-to-DOM stdout/stderr · TestReport Cards · Virtual Files Inspector

Optional Future Upgrade: Track B (Cloudflare Containers / Sandbox)

Section titled “Optional Future Upgrade: Track B (Cloudflare Containers / Sandbox)”

If full server-side vjs (V8) execution is ever desired later — specifically for live vael:http (ServeMux + router.fetch()), vael:db (SQLite), vael:cron, vael:age, or npm: CAS testing — wrangler.jsonc can add a Worker entrypoint ("main": "src/worker.ts") routing /playground/api/* to Cloudflare Containers / Sandbox.

Track B is not needed for launch: it requires a paid Workers/Containers plan and strict per-session CPU, memory, and egress quotas, whereas Track A delivers interactive vael:* + vael:test execution at $0/mo.