gitmyhub

wterm

TypeScript ★ 3.3k updated 1mo ago

A terminal emulator for the web

wterm (pronounced "dub-term") is a terminal emulator — the black screen where you type commands — that runs inside a web browser rather than as a standalone desktop application. Instead of drawing pixels like most web-based terminals do, it renders directly to the browser's DOM (the standard structure web pages use), which means you get native text selection, copy/paste, browser search, and accessibility features for free without any custom workarounds.

Performance is kept close to native by writing the core logic in Zig (a low-level systems programming language) and compiling it to WASM (WebAssembly — a format that lets compiled code run in the browser at near-native speed). The resulting core is only about 12 KB. There is also an optional full-featured backend called libghostty for apps that need complete terminal compatibility, at the cost of a larger file size.

The project is structured as several packages: a headless core, a plain-JavaScript DOM renderer, and components for React and Vue (popular web UI frameworks) so developers can drop a terminal into any web app. There is even a package for running a Bash shell directly in the browser, and one for rendering Markdown inside the terminal.

This is useful for developers who want to embed a real terminal in a web application — for example, a cloud coding environment, a remote server management panel, or a browser-based IDE. It supports connecting to a real server via WebSocket (a persistent two-way connection) and handles features like scrollback history, 24-bit color, and apps like Vim that use alternate screen modes.