Skip to content

How-to guides

How to open VS Code in the browser

Run code-server, the open-source build of VS Code for the web, on a machine and open its port in your browser.

Updated · Facts checked · By Runtime Cloud

2 min read

Read as Markdown

There are three ways to get VS Code in a browser tab, and they differ in where your code runs:

Option Where the code runs Terminal and extensions
vscode.dev Nowhere: files only No terminal; web extensions only
code-server on your own server The server you run it on Full terminal and extensions
A hosted dev environment A machine made for you Full terminal and extensions

vscode.dev edits files in the browser, but it has no machine to run a build, a test or a server. For that, the editor's server side has to run on a real machine, which is what code-server does.

On Runtime, a dev environment runs code-server on port 8080 over /workspace, on a Linux machine of its own. A private HTTPS preview opens it in your browser, and the editor's terminal runs on that machine. Nothing is installed on your computer (Dev environments).

Run code-server on your own machine

Terminalcurl -fsSL https://code-server.dev/install.sh | shcode-server --bind-addr 127.0.0.1:8080 /path/to/project

code-server writes a password to ~/.config/code-server/config.yaml. Keep it bound to 127.0.0.1 and reach it through an SSH tunnel or a proxy with TLS. Anyone who reaches it can run commands as its user.

Open it on Runtime

This creates a dev environment, shares port 8080 with a private preview, and prints a link that opens VS Code on /workspace:

TerminalAPI=https://api.withruntime.comAUTH="Authorization: Bearer $RUNTIME_API_KEY"JSON="Content-Type: application/json"id=$(curl -sf -X POST "$API/v2/workspaces" -H "$AUTH" -H "$JSON" -d '{}' | jq -r .id)preview=$(curl -sf -X POST "$API/v2/sandboxes/${id}/previews" -H "$AUTH" -H "$JSON" \  -d '{"port": 8080}')echo "$(echo "$preview" | jq -r .url)?folder=/workspace&runtime_preview_token=$(echo "$preview" | jq -r .token)"

The folder query picks the folder VS Code opens. To open a project you cloned, point it there: ?folder=/workspace/express.

The preview is private. The link carries a token, and without it the address answers 401. The token lasts up to a day by default; ask for a shorter or longer one with ttlSeconds when you create the preview, and rotate it to cut off every link given out so far (rotate a preview token).

Treat the link like a password. Anyone holding it can use the editor's terminal on the machine.

Show it inside your own app

To put the editor in an iframe in your own product, an online IDE or a course platform, list your site in embedOrigins when you create the preview. Sites not on the list cannot frame it (previews).

Terminalcurl -sf -X POST "$API/v2/sandboxes/${id}/previews" -H "$AUTH" -H "$JSON" \  -d '{"port": 8080, "embedOrigins": ["https://app.example.com"]}' | jq -r .url

Sources

Facts on this page were checked on 17 November 2026.

Cut your cloud billby 66%.

7 days of Pro for $0, and no card to sign up. Billed by the second after.

Start your free trial