cd /news/ai-tools/run-claude-code-on-a-vps-and-keep-it… · home › topics › ai-tools › article
[ARTICLE · art-177741] src=dev.to ↗ pub= topic=ai-tools verified=true sentiment=↑ positive

Run Claude Code on a VPS and keep it running after you close the laptop

A developer built SpaceApp, an MIT-licensed Docker-based web app that runs AI coding CLIs such as Claude Code, Codex, OpenCode and Gemini CLI in persistent server-side 'rooms' that keep working after the laptop or SSH session closes. The tool, installed via npx, listens on 127.0.0.1:4911 and is reached through an SSH tunnel or a self-managed TLS reverse proxy, with each CLI running on the user's own account. The author notes plain tmux over SSH is sufficient for a single agent, while SpaceApp targets multiple agents and projects.

key takeaway

SpaceApp runs Claude Code and other coding CLIs in persistent server-side rooms on 127.0.0.1:4911, so tasks survive laptop sleep and SSH drops, but remote phone access requires a self-managed TLS reverse proxy and the app should never be bound directly to the public internet.

by read2 min views18 publishedNov 28, 2026

Short answer: install Claude Code on a Linux server and run it there, not on your laptop. Then it keeps working when the laptop sleeps. You can do this with plain tmux over SSH (below), or with SpaceApp, which puts Claude Code and other CLIs in rooms you open from a browser.

What is SpaceApp? SpaceApp is an MIT-licensed web app you run with Docker on your own machine or server. It replaces a wall of terminal windows with rooms: each room holds panes, and each pane is an AI coding CLI (Claude Code, Codex, OpenCode, Gemini CLI and others), a copilot, a browser or a tool. The rooms live on the server, so the CLIs keep running when you close the browser tab or the laptop, and you open the same rooms from any browser. Every CLI runs on your own account. Install: npx --yes run-spaceapp@latest install (Linux, macOS, Windows 11).

small profile).

ssh you@your-server
tmux new -s claude        # a session that outlives the SSH connection
claude                    # sign in on first run, then give it a task
tmux attach -t claude     # later, from any machine with SSH

This works, and it is enough for one agent. It gets harder with several agents and projects, because you open each pane to see which one is waiting for you.

ssh you@your-server
npx --yes run-spaceapp@latest install --no-open   # installs Docker if missing, starts the stack, prints a 15-minute setup token

SpaceApp listens on 127.0.0.1:4911 on the server, which is the supported setup. From your laptop, open an SSH tunnel and use your browser:

ssh -N -L 4911:127.0.0.1:4911 you@your-server

Add Claude Code with npx --yes run-spaceapp@latest provider install claude. Let agents work in a folder with npx --yes run-spaceapp@latest workspace add <path>. Open a Claude Code pane in a room and give it a task. When you close the tunnel or the laptop, the room keeps running on the server. Reopen the tunnel to come back.

To reach it from a phone without a tunnel, you need a reverse proxy with TLS. That proxy, access control and the firewall are then your responsibility (operations guide). Never bind SpaceApp directly to the public internet.

--read-only for reference repos.npx --yes run-spaceapp@latest backup. Does Claude Code keep running if my SSH connection drops? With tmux or SpaceApp, yes. In a plain SSH shell, no.

Can I run Codex or Gemini CLI next to it? Yes. SpaceApp runs Claude Code, Codex, OpenCode, Gemini CLI and others in panes side by side, each on your own account.

Which VPS? Any Linux server with enough CPU and RAM for the profile you choose.

Try the demo, no sign-up first.

I build SpaceApp. The code is on GitHub and the project site is spaceapp.dev.

── more in #ai-tools 4 stories · sorted by recency
── more on @spaceapp 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/run-claude-code-on-a…] indexed:0 read:2min 2026-11-28 · —