Skip to content

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.

Areaghostty-web 0.4.0ghostty-webgpu
Lifecycleawait init(), then new Terminal()await Terminal.create(options), then await terminal.open(host)
Input callbacksonData(str => ...) string callbacksonData(({ bytes, origin }) => ...) raw Uint8Array bytes
RenderingSingle Canvas 2D rendererCanvas-first startup handing off to WebGPU or WebGL2, with Canvas 2D and DOM fallbacks
Container fittingExternal fit addonAutomatic synchronous fit during open() plus ResizeObserver
StylingFlat font and theme stringsStructured appearance.font and appearance.theme (RGB objects + 256-entry palette)
ThreadingMain thread onlyMain entry (ghostty-webgpu) and worker entry (ghostty-webgpu/worker) + TerminalWorkerPool

For a full method-by-method table, see Migrating from xterm.js.

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.

  • On the main entry, await document.fonts.load(...) before calling open() so the synchronous initial fit measures your actual font (see Fonts & grid sizing).
  • On ghostty-webgpu/worker, pass font URLs or raw Uint8Array bytes in the fonts creation option because workers do not share the page’s document.fonts registry.