Migrating from ghostty-web
Both ghostty-web and ghostty-webgpu compile Ghostty’s libghostty-vt to WebAssembly. The difference is everything around the core: ghostty-webgpu replaces the xterm.js compatibility wrapper with a byte-native API, adds a Zig frame builder (bridge.wasm) driving WebGPU and WebGL2 alongside Canvas 2D and DOM, and supports running the entire terminal inside a Web Worker.
What changes
Section titled “What changes”| Area | ghostty-web 0.4.0 | ghostty-webgpu |
|---|---|---|
| Lifecycle | await init(), then new Terminal() | await Terminal.create(options), then await terminal.open(host) |
| Input callbacks | onData(str => ...) string callbacks | onData(({ bytes, origin }) => ...) raw Uint8Array bytes |
| Rendering | Single Canvas 2D renderer | Canvas-first startup handing off to WebGPU or WebGL2, with Canvas 2D and DOM fallbacks |
| Container fitting | External fit addon | Automatic synchronous fit during open() plus ResizeObserver |
| Styling | Flat font and theme strings | Structured appearance.font and appearance.theme (RGB objects + 256-entry palette) |
| Threading | Main thread only | Main entry (ghostty-webgpu) and worker entry (ghostty-webgpu/worker) + TerminalWorkerPool |
For a full method-by-method table, see Migrating from xterm.js.
Keep PTY traffic in bytes
Section titled “Keep PTY traffic in bytes”Remove TextDecoder / TextEncoder wrappers from your WebSocket hot path. Set socket.binaryType = 'arraybuffer', pass new Uint8Array(event.data) straight into terminal.write(), and forward event.bytes from terminal.onData directly back to the socket. libghostty-vt decodes split UTF-8 sequences incrementally across chunks. See Wire a PTY for the full client.
Preload fonts cleanly
Section titled “Preload fonts cleanly”- On the main entry, await
document.fonts.load(...)before callingopen()so the synchronous initial fit measures your actual font (see Fonts & grid sizing). - On
ghostty-webgpu/worker, pass font URLs or rawUint8Arraybytes in thefontscreation option because workers do not share the page’sdocument.fontsregistry.