Repository navigation
Runtime APIs
CodeLab executes JavaScript, TypeScript, C++20, and Python 3.12 entirely inside isolated browser Web Workers. User code interacts with an in-memory POSIX filesystem and virtual loopback network stack without needing any remote execution server.
All 50 standard Node.js built-in modules are implemented in pure JavaScript and available through both CommonJS and ES module imports:
| Area | Supported Capabilities |
|---|---|
| Filesystem & Streams | Synchronous, callback, promise, and streaming file operations backed directly by the virtual workspace and temporary directories |
| HTTP & Loopback Networking | In-memory HTTP, HTTPS, HTTP/2, TCP, TLS, and UDP servers and clients bound to the virtual port table and reachable from the terminal or Web Preview |
| Cryptography & Compression | Hashing, HMACs, random UUIDs and byte buffers, key derivation, and Gzip or Deflate compression utilities |
| Testing & Assertions | Structured test suites, nested subtests, lifecycle hooks, strict assertions, and per-test execution timing |
| Workers, VM & WASI | Sandboxed VM contexts, worker threads, process globals, timers, and a full WASI Preview 1 host wired to the virtual filesystem |
import http from 'node:http';
import fs from 'node:fs/promises';
await fs.writeFile('/workspace/hello.txt', 'Hello from Node v22 in the browser!');
http.createServer(async (_req, res) => {
const body = await fs.readFile('/workspace/hello.txt', 'utf8');
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end(body);
}).listen(8080);CodeLab includes native compatibility for core Bun APIs alongside Node.js:
- HTTP Servers: Start high-level Fetch-based servers that register automatically in the Ports and Web Preview tabs.
- File I/O: Read and write virtual workspace files using standard Web Blob and Response interfaces.
- Embedded SQLite: Run relational queries, transactions, and aggregates in memory or persisted inside the virtual filesystem.
- Test Runner: Write Jest-compatible test suites with matchers, lifecycle hooks, and mocks.
- Utilities: Hash values, verify passwords, sleep asynchronously, and spawn subprocesses.
import { Database } from 'bun:sqlite';
const db = new Database(':memory:');
db.run('CREATE TABLE items (id INTEGER PRIMARY KEY, name TEXT)');
db.run('INSERT INTO items (name) VALUES (?)', ['Token Bucket']);
console.log(db.query('SELECT * FROM items').all());When the C++ extension is enabled, CodeLab downloads a WebAssembly Clang/LLVM compiler, linker, and WASI standard library on demand (~35 MB) and caches it in IndexedDB for offline reuse:
- Supports C++17, C++20, and C++23 standards with configurable optimization levels.
- Pre-mounts competitive programming headers, linked list and binary tree builders, and a lightweight unit test header wired into the Test Suite drawer.
- Maps compiler errors directly to inline editor squiggles and the Problems panel.
When the Python extension is enabled, CodeLab loads CPython 3.12 in WebAssembly via Pyodide and caches the runtime in IndexedDB:
- Synchronizes files bidirectionally with the virtual workspace so scripts can read and write project files normally.
- Includes built-in data structure helpers (linked lists, trees, heaps) and a structured test harness alongside pytest support.
- Maps Python tracebacks directly to inline editor error markers.
Install real open-source packages and their transitive dependencies from jsDelivr directly into the virtual workspace from the integrated terminal:
npm install zod
pnpm add nanoid
bun add honoCodeLab v0.8.0 · GitHub Repository · Live Cloud IDE · MIT © Ved Gupta
Getting Started
Workbench & Runtimes
- Workbench Configuration
- Runtime APIs
- POSIX Shell & Coreutils
- Real Linux Terminal
- HTTP Servers & Networking
- Headless Runtime
Extensibility & Architecture