---
title: "Deploy code-server"
description: "VS Code in the browser with persistent projects and secure access."
category: "Other"
url: https://railway.com/deploy/code-server-2
---

# Deploy code-server

VS Code in the browser with persistent projects and secure access.

**[Deploy code-server on Railway](https://railway.com/template/code-server-2)**

- **Creator:** Agastya Fauzan Alfath's Projects
- **Category:** Other

## Template content

### code-server

- **Image:** codercom/code-server:4.130.0
- **Start command:** `/bin/sh -c "chown coder:coder /home/coder && install -d -o coder -g coder /home/coder/project /home/coder/.config/code-server /home/coder/.local/share/code-server && exec sudo -E -H -u coder -- /usr/bin/code-server --bind-addr 0.0.0.0:8080 /home/coder/project"`
- **Health check:** /healthz
- **Public domain:** Yes

## Documentation

# Deploy and Host code-server on Railway

code-server runs VS Code in a web browser, giving you a consistent remote development environment from laptops, tablets, and other devices. It supports terminal access, Git workflows, extensions from Open VSX, persistent editor settings, and server-side builds while keeping project files on infrastructure you control.

[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/code-server-2)

**Published on the Railway marketplace:** https://railway.com/deploy/code-server-2 (`code-server-2`). See [TEMPLATE.md](./TEMPLATE.md) for the publication record and authoritative variable package.

## About Hosting code-server

Hosting code-server requires one public application container, HTTPS, mandatory password authentication, and persistent storage for projects, settings, extensions, and configuration. This template pins the official `codercom/code-server:4.130.0` image, exposes port `8080`, and mounts one Railway volume at `/home/coder`. A startup command briefly runs with Railway's documented root volume access to assign ownership, then launches code-server as the unprivileged `coder` user. Railway terminates TLS, generates a fresh password during template deployment, and checks the unauthenticated `/healthz` liveness endpoint. No external database or proxy-specific public URL variable is required for the generated Railway domain.

## Common Use Cases

- Developing from a browser on laptops, tablets, or low-powered devices
- Keeping projects, editor settings, and extensions in one persistent remote workspace
- Running builds, tests, Git commands, and terminal workflows on Railway infrastructure

## Dependencies for code-server Hosting

- One Railway persistent volume mounted at `/home/coder`
- One Railway-generated HTTPS service domain targeting port `8080`

### Deployment Dependencies

- [code-server 4.130.0 setup guide](https://github.com/coder/code-server/blob/v4.130.0/docs/guide.md)
- [code-server 4.130.0 FAQ, authentication, storage, and health documentation](https://github.com/coder/code-server/blob/v4.130.0/docs/FAQ.md)
- [Official code-server container definition](https://github.com/coder/code-server/blob/v4.130.0/ci/release-image/Dockerfile)
- [Umbrel code-server package](https://github.com/getumbrel/umbrel-apps/tree/master/code-server)
- [Railway volume permissions](https://docs.railway.com/volumes#permissions)

## Implementation Details

| Service | Image | Networking and health | Persistent storage |
| --- | --- | --- | --- |
| `code-server` | `codercom/code-server:4.130.0` | Public port `8080`; health check `/healthz`; password login required | `/home/coder`, including `/home/coder/project`, configuration, user data, and extensions |

Railway mounts volumes as root. `RAILWAY_RUN_UID=0` lets the startup command assign `/home/coder` to `coder`, create the persistent directories, and then execute `/usr/bin/code-server` through `sudo` as `coder`. `PASSWORD` is generated once with a Railway template function. Unauthenticated requests to `/` redirect to `/login`; only `/healthz` intentionally remains public for liveness checks.

## Why Deploy code-server on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying code-server on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — [Jul'26] Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/code-server-2
