{"slug": "run-claude-code-on-a-vps-and-keep-it-running-after-you-close-the-laptop", "title": "Run Claude Code on a VPS and keep it running after you close the laptop", "summary": "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.", "body_md": "**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.\n\n**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).\n\n`small` profile).\n\n```\nssh you@your-server\ntmux new -s claude        # a session that outlives the SSH connection\nclaude                    # sign in on first run, then give it a task\n# Ctrl-b d detaches; the task keeps running\ntmux attach -t claude     # later, from any machine with SSH\n```\n\nThis 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.\n\n```\nssh you@your-server\nnpx --yes run-spaceapp@latest install --no-open   # installs Docker if missing, starts the stack, prints a 15-minute setup token\n```\n\nSpaceApp 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:\n\n```\nssh -N -L 4911:127.0.0.1:4911 you@your-server\n# then open http://127.0.0.1:4911, paste the setup token, create the owner account\n```\n\nAdd 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.\n\nTo 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](https://github.com/oll4com/spaceapp/blob/main/docs/operations.md?utm_source=devto&utm_campaign=mktpostYjFV2B1_vYRF)). Never bind SpaceApp directly to the public internet.\n\n`--read-only` for reference repos.`npx --yes run-spaceapp@latest backup`.\n**Does Claude Code keep running if my SSH connection drops?** With tmux or SpaceApp, yes. In a plain SSH shell, no.\n\n**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.\n\n**Which VPS?** Any Linux server with enough CPU and RAM for the profile you choose.\n\nTry the [demo, no sign-up](https://spaceapp.dev/spaceappmock/?utm_source=devto&utm_campaign=mktpostYjFV2B1_vYRF) first.\n\nI build SpaceApp. The code is on [GitHub](https://github.com/oll4com/spaceapp?utm_source=devto&utm_campaign=mktpostYjFV2B1_vYRF) and the project site is [spaceapp.dev](https://spaceapp.dev/?utm_source=devto&utm_campaign=mktpostYjFV2B1_vYRF).", "url": "https://wpnews.pro/news/run-claude-code-on-a-vps-and-keep-it-running-after-you-close-the-laptop", "canonical_source": "https://dev.to/space_app_fc7f6872808dc84/run-claude-code-on-a-vps-and-keep-it-running-after-you-close-the-laptop-12k6", "published_at": "2026-11-28 13:09:15+00:00", "updated_at": "2026-11-28 13:13:43.970038+00:00", "lang": "en", "topics": ["ai-tools", "ai-agents", "developer-tools", "ai-products"], "entities": ["SpaceApp", "Claude Code", "Codex", "OpenCode", "Gemini CLI", "Docker", "GitHub"], "also_reported_by": [], "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.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/run-claude-code-on-a-vps-and-keep-it-running-after-you-close-the-laptop", "markdown": "https://wpnews.pro/news/run-claude-code-on-a-vps-and-keep-it-running-after-you-close-the-laptop.md", "text": "https://wpnews.pro/news/run-claude-code-on-a-vps-and-keep-it-running-after-you-close-the-laptop.txt", "jsonld": "https://wpnews.pro/news/run-claude-code-on-a-vps-and-keep-it-running-after-you-close-the-laptop.jsonld"}}