I put Claude Code in a browser terminal I built in Go

· Medium ·

2 min read Original article ↗

Anup Shinde

Press enter or click to view image in full size

Claude Code, in a browser tab. The shell is real, the PTY is real; only the rendering is xterm.
  • I built a browser-based terminal in Go as an example for godom: real PTY, real shell, rendered via xterm.js in the browser.
  • Then I ran Claude Code inside it. It just worked. No tweaks, no flags, no special handling.
  • This is also accidentally a really nice way to use a remote machine over Tailscale: scan a QR code and get a terminal in your phone’s browser.

Originally published at www.anupshinde.com

If you want to try it yourself, the godom repo has the example at examples/terminal/.

The “wait, what?” moment

The terminal example in godom is one of those things I built to test the framework. The pitch is simple: spawn a real shell with a real PTY, pipe its raw I/O to a browser, and let xterm.js render it. Around 250 lines of Go and a ~60-line JS adapter.

It worked. So I did the natural next thing: I typed claude into it.

The Claude Code welcome screen rendered. Colors, cursor, and the slash-command picker all worked (the screenshot above is exactly that). From Claude Code’s perspective, the PTY is real, $TERM is xterm-256color, the shell is the user's actual shell, and the only thing different is which process is reading the PTY's output and painting pixels.