The obvious solution would be some kind of mobile app, but I didn't want to build a chat wrapper. I wanted the real Claude Code experience - the actual terminal, with all my files, my environment variables, my git repos. Just... on my phone.
So I built a WebSocket bridge. The server spawns a PTY session running Claude Code, and the frontend is just xterm.js in a mobile-responsive wrapper. Your phone connects over the tunnel, and you get a real terminal.
The interesting bits:
- Zero-config remote access: I'm using Cloudflare Tunnel (the free tier) so there's no port forwarding or firewall nonsense. Run bun start and you get a QR code with a public URL. - Session persistence: This was important. I didn't want to lose my conversation if I locked my phone or switched apps. Sessions stay alive on the server, and you can reconnect hours later. - Dev server preview: When you're building UI and Claude spins up a dev server, you can preview it right in the app. The server detects listening ports and proxies them through. - Push notifications: The service worker watches for Claude's "waiting for input" markers and pings you. So you can let Claude work in the background and get notified when it needs you.
The whole thing is ~2000 lines. Backend is Express + node-pty + ws. Frontend is vanilla JS because I didn't want to ship a framework for what's essentially a terminal wrapper.
GitHub: https://github.com/yazinsai/claude-code-remote
Would love feedback, especially from anyone who's dealt with mobile terminal UX. The virtual keyboard situation is... a work in progress.
jaksc09•1h ago
yazinsai•59m ago