Skip to content
Ved Gupta edited this page Dec 4, 2026 · 18 revisions

CodeLab Documentation

CodeLab is a modular, browser-native IDE workbench, Web Worker execution runtime, POSIX shell, and lightweight SQL playground. Everything runs directly in the client browser with zero backend servers, zero containers, and no cross-origin isolation headers required.


Core Capabilities

  • Modular Layered Core: Built on a strict four-layer TypeScript architecture with a VS Code compact workbench layout (no top navbar: menus open from the ☰ Activity Bar button, run and mode actions sit beside the editor tabs), Zen / Focus Mode, drag-and-drop OS file upload into Explorer, Cursor Light (default), Dark and High-Contrast themes that defer to host --ds-* design tokens, cross-file TypeScript intelligence, Monaco side-by-side Git diff viewer, customizable workspace settings, keybindings, and lazy-loaded plugins.
  • Real Linux Terminal (new in 0.8): An opt-in extension boots a real Linux kernel in WebAssembly with an Alpine userland, so terminals become real ptys and sh guided steps are graded by shell scripts.
  • Lightweight SQL Playground: Includes a standalone, zero-dependency PostgreSQL 18 and SQLite 3 editor (~16.5 KB gzipped) supporting inline lesson blocks, split-pane query studios, formatting, table-alias autocomplete, inline error underlines, and accessible keyboard navigation.
  • Multi-Language Browser Runtimes: Runs JavaScript, JSX, Node.js v22, and Bun v1.1 out of the box, with opt-in WebAssembly extensions for TypeScript, C++20 (Clang/LLVM), and Python 3.12 (Pyodide) cached locally in IndexedDB.
  • POSIX Shell, Terminal & Git: Features an @xterm/xterm PTY terminal with side-by-side split panes, collapsible bottom drawer, real isomorphic-git source control, pipelines, background servers, package installation, HTTP load testing, and 73 standard UNIX utilities.
  • Guided Labs and Headless Grading: Supports step-by-step coding and SQL challenges with progressive hints, side-by-side solution diffs, and a zero-UI headless worker runner for automated grading.

Documentation Guides

Guide What You Will Learn
Quick Start Installing the package, mounting the IDE or SQL editor, and loading from a CDN
SQL Playground & Inline Editor Inline blocks, split-pane playgrounds, PostgreSQL and SQLite dialects, and autocomplete
Integration Guide Embedding CodeLab inside React, Next.js App Router, and Vite applications
Workbench Configuration Mount options, workspace settings, instance methods, and keyboard shortcuts
Runtime APIs Node.js built-in modules, Bun APIs, C++20 WebAssembly, and Python 3.12 WebAssembly
POSIX Shell & Coreutils Shell syntax, background jobs, repository cloning, and the 73 built-in UNIX commands
Real Linux Terminal Booting Linux in the browser, authoring sh labs with setup / check, hosting the image, and CSP
HTTP Servers & Networking Running virtual loopback servers, inspecting ports and network waterfalls, and Web Preview
Headless Runtime Executing scripts and unit test suites programmatically without rendering any UI
Authoring Guided Labs Designing multi-step interactive coding and SQL challenges with automated verification
Plugin System Registering declarative plugins, custom panels, language packs, and lifecycle hooks
Architecture & Monorepo Workspace package layers, dependency injection, virtual filesystem backends, and size budgets

System Overview

┌───────────────────────────────────────────────────────────────────┐
│                        Browser Main Thread                        │
│                                                                   │
│  ┌──────────────────────────────┐  ┌───────────────────────────┐  │
│  │      CodeLab Workbench       │  │     SQL Editor Pack       │  │
│  │  • Editor & Diff Viewer      │  │  • Inline & Playground    │  │
│  │  • File Tree & Search        │  │  • PostgreSQL & SQLite    │  │
│  │  • Multi-Tab Terminal        │  │  • Formatter & Completion │  │
│  │  • Settings, Themes, Plugins │  │  • ~16.5 KB Gzipped       │  │
│  └──────────────┬───────────────┘  └───────────────────────────┘  │
│                 │ Worker Messaging & Preview Service Worker       │
│                 ▼                                                 │
│  ┌─────────────────────────────────────────────────────────────┐  │
│  │                Isolated Web Worker Sandbox                  │  │
│  │  • POSIX Shell & 73 UNIX Coreutils                          │  │
│  │  • Virtual Filesystem (Memory, IndexedDB, OPFS)             │  │
│  │  • Node.js v22 (50 Built-ins) & Bun v1.1 Runtime            │  │
│  │  • C++20 Clang/LLVM WASI & Python 3.12 Pyodide WASI         │  │
│  │  • Loopback HTTP/TCP Port Table & Web Preview Server        │  │
│  └─────────────────────────────────────────────────────────────┘  │
└───────────────────────────────────────────────────────────────────┘

Clone this wiki locally