Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

ghostty-web

> 编程语言
Open source

Ghostty for the web with xterm.js API compatibility

2.7K stars0 likes1 views
WebsiteGitHub

About

Ghostty for the web with xterm.js API compatibility

ghostty-web

Ghostty for the web with xterm.js API compatibility — giving you a proper VT100 implementation in the browser.

  • Migrate from xterm by changing your import: @xterm/xterm → ghostty-web
  • WASM-compiled parser from Ghostty—the same code that runs the native app
  • Zero runtime dependencies, ~400KB WASM bundle

Originally created for Mux (a desktop app for isolated, parallel agentic development), but designed to be used anywhere.

Try It

  • Live Demo on an ephemeral VM (thank you to Greg from disco.cloud for hosting).

  • On your computer:

    bash
    npx @ghostty-web/demo@next

    This starts a loopback-only HTTP server with a real shell on http://127.0.0.1:8080. The demo protects /ws with a per-run same-origin token and rejects cross-origin WebSocket handshakes. Works best on Linux and macOS.

    To intentionally bind somewhere else, set HOST=<host>. If you serve the demo through extra hostnames or a wildcard bind such as HOST=0.0.0.0, also set GHOSTTY_ALLOWED_HOSTS=host1,host2. Avoid remote exposure unless you understand the risk: the demo starts a real local shell.

Comparison with xterm.js

xterm.js is everywhere—VS Code, Hyper, countless web terminals. But it has fundamental issues:

Issue xterm.js ghostty-web
Complex scripts (Devanagari, Arabic) Rendering issues ✓ Proper grapheme handling
XTPUSHSGR/XTPOPSGR Not supported ✓ Full support

xterm.js reimplements terminal emulation in JavaScript. Every escape sequence, every edge case, every Unicode quirk—all hand-coded. Ghostty's emulator is the same battle-tested code that runs the native Ghostty app.

Installation

bash
npm install ghostty-web

Usage

ghostty-web aims to be API-compatible with the xterm.js API.

javascript
import { init, Terminal } from 'ghostty-web';

await init();

const term = new Terminal({
  fontSize: 14,
  theme: {
    background: '#1a1b26',
    foreground: '#a9b1d6',
  },
});

term.open(document.getElementById('terminal'));
term.onData((data) => websocket.send(data));
websocket.onmessage = (e) => term.write(e.data);

For a comprehensive client <-> server example, refer to the demo.

Development

ghostty-web builds from Ghostty's source with a patch to expose additional functionality.

Requires Zig and Bun.

bash
bun run build

Mitchell Hashimoto (author of Ghostty) has been working on libghostty which makes this all possible. The patches are very minimal thanks to the work the Ghostty team has done, and we expect them to get smaller.

This library will eventually consume a native Ghostty WASM distribution once available, and will continue to provide an xterm.js compatible API.

At Coder we're big fans of Ghostty, so kudos to that team for all the amazing work.

License

MIT

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptbrowserghosttylibraryterminal

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言