ViveServer
Local development server for VS Code with live reload, a free alternative to Live Server. It adds what that extension was missing:
|
Live Server 5.7.10 (documentado) |
ViveServer |
| Live reload of HTML/JS |
✅ |
✅ |
| CSS without full reload |
✅ (fullReload: false by default) |
✅ |
| Custom headers |
✅ headers |
✅ headers |
| CORS |
✅ * only |
✅ *, or an origin allowlist with credentials |
| HTTPS with cert and key |
✅ |
✅ |
| Proxy |
✅ one rule (baseUri → proxyUri) |
✅ several rules, all methods and bodies |
| SPA fallback |
✅ file for every 404 |
✅ spa: index.html for paths without extension |
| Mount folders on routes |
✅ mount |
❌ |
| Ignore files by glob |
✅ ignoreFiles |
◐ folder and file names only |
| Custom browser / command line |
✅ CustomBrowser, AdvanceCustomBrowserCmdLine |
◐ browsers found on the machine, no custom command line |
| Chrome debugger attachment |
✅ |
❌ |
| Local IP as host |
✅ useLocalIp |
❌ (set host to 0.0.0.0 and use your IP) |
| Mock routes with templates and conditions |
❌ (not in its settings) |
✅ |
| Routes written in code, with memory |
❌ |
✅ |
| Echo of forms and multipart uploads |
❌ |
✅ |
| Methods other than GET on static files |
not documented |
✅ serves the file (staticAnyMethod) |
Range requests (video and audio seeking) |
not documented |
✅ |
| Remote use (WSL, SSH, Codespaces) |
not documented |
✅ forwarded URLs; not yet tested on real remote hosts |
| Runtime dependencies |
5 (http-shutdown, ips, live-server, opn, vsls) |
0 |
The Live Server column comes from its package.json and its documentation (docs/settings.md), version 5.7.10, checked on 2026-12-01. Not documented means its documentation does not mention it; it does not mean that it is missing.
Origin and credits
ViveServer is based on the idea of Live Server by Ritwick Dey (VS Code Marketplace: ritwickdey.LiveServer). That project is no longer actively maintained, and this one aims to continue its purpose as a free tool.
To be precise about what this is:
- It is not a fork. The code was written from scratch in plain JavaScript and no code from Live Server was copied. The comparisons use the manifest and the documentation of Live Server 5.7.10, checked on 2026-12-01.
- It is an independent reimplementation with its own architecture (the server core in
src/ does not depend on VS Code) and its own features, listed below.
- Thanks to Ritwick Dey and the contributors of Live Server for the original idea and for the years of use that made this one possible.
Security
ViveServer is a development server. It is meant for your own machine. These are the protections in place:
- Host check (DNS rebinding): while the server listens on
127.0.0.1, localhost or ::1, it only answers requests whose Host is one of those. A web page from another domain cannot read your files through your browser. WebSocket connections also need an Origin of localhost. When you open the page through a forwarded URL (Codespaces, tunnels), its host is accepted automatically for that session. Add other names with viveserver.allowedHosts, or turn the check off with viveserver.checkHost: false.
- Symbolic links: a file or folder inside the served folder that links outside it is refused, so cloning a repository with a symlink to
~/.ssh does not expose it.
- Mock files: the
file field of mocks.json only reads files inside .viveserver/. Absolute paths and ../ are refused. This applies even in untrusted workspaces, because mocks.json is loaded there too.
- Errors: internal errors return a generic message. Details such as disk paths go only to the ViveServer output channel.
- Headers: every response carries
X-Content-Type-Options: nosniff and Referrer-Policy: no-referrer (turn off with securityHeaders).
- Logs: sensitive query parameters (
token, key, password, session…) are shown as [oculto] in the output channel.
- Exposing it to the network: if you set
viveserver.host to 0.0.0.0, the Host check is turned off and a warning is shown, because you chose to expose the server. There is still no authentication or HTTPS by default. Do not do this on public or shared networks.
Limitations:
- Anyone who can reach the port can read the files in the served folder. Do not serve folders with secrets.
routes.js is code: it only runs in trusted workspaces.
- With
cors: true, any website can read the responses. Use a list of origins if you send credentials.
Changes compared to Live Server
Features that ViveServer adds
- Methods other than GET on static files are answered with the file (
staticAnyMethod).
- Mock routes in
.viveserver/mocks.json, with templates ({{body.x}}, {{params.x}}, {{query.x}}, {{uuid}}, {{now}}), delays and responses from files.
- Routes written in code in
.viveserver/routes.js, with memory shared between requests (only in trusted workspaces).
- Echo endpoint at
/__viveserver/echo, with parsing of JSON, urlencoded forms and multipart uploads.
- Several proxy rules, with all methods and their bodies, and
stripPath, changeOrigin and secure options.
- Partial (
Range) requests, for seeking in video and audio. Its documentation does not mention them.
- Interface in English and Spanish, through
vscode.l10n and package.nls*.json.
- A status panel in the Activity Bar.
Features that Live Server has and ViveServer does not (yet)
mount (mounting folders on routes), useLocalIp, glob patterns in ignoreFiles, a custom browser command line, and Chrome debugger attachment.
Changed behaviour
- CORS:
cors: true answers with * and without credentials. To send cookies or sessions, list the allowed origins (cors: ["http://localhost:3000"]). The earlier behaviour of reflecting any origin with credentials was removed on purpose.
reloadOn: "save" reloads only when saving in the editor; by default any change on disk triggers a reload.
openIn can open the page in VS Code's built-in browser, and the URL goes through VS Code's port forwarding, so it should work over WSL, SSH and Codespaces (not yet tested on those hosts).
Engineering
- No runtime dependencies. The WebSocket that drives the reload is a small implementation of RFC 6455.
- 56 unit tests (
npm test) and 6 integration tests inside a real VS Code (npm run test:vscode).
Status panel
The ViveServer panel (its icon in the left Activity Bar) shows the server state: address (click to copy), port, connected browser tabs, restarts in this session and the served folder. Its title buttons open the site, reload browsers and stop the server. The Browser row lists the browsers found on your machine (plus the system default); click one to open the site with it from now on.
Usage
- Click Vive in the status bar, or
- Right-click an
.html file → Open with ViveServer (Alt+V Alt+O).
- Stop: click Port: 5500 in the status bar (
Alt+V Alt+C).
- Request log: ViveServer: Show request log.
Languages
The interface follows VS Code's display language. The base language is English, with a full Spanish translation (package.nls.es.json, bundle.l10n.es.json). Server logs and the HTML pages of the server (404, directory listing) are still in Spanish.
POST, PUT and DELETE
By default, any method on a static file returns the file. That way fetch('data.json', { method: 'POST' }) or a <form method="post"> aimed at an .html page works the same as it would with GET. To answer 405 instead, set "viveserver.staticAnyMethod": false.
There is also a built-in echo endpoint at /__viveserver/echo. It returns, as JSON, the method, headers, query and parsed body (JSON, urlencoded or multipart with file metadata).
Mock routes: .viveserver/mocks.json
{
"routes": [
{ "method": "POST", "path": "/api/login", "status": 200,
"body": { "token": "{{uuid}}", "user": "{{body.user}}" } },
{ "method": "GET", "path": "/api/users/:id", "body": { "id": "{{params.id}}" } },
{ "method": "GET,POST", "path": "/api/files/*", "file": "responses/file.json" },
{ "method": "*", "path": "/api/echo", "echo": true },
{ "method": "POST", "path": "/api/slow", "delay": 1500, "status": 202 }
]
}
Short form also works: { "POST /api/login": { "body": { "ok": true } } }.
Available templates: {{params.x}}, {{query.x}}, {{body.x}}, {{headers.x}}, {{method}}, {{path}}, {{now}}, {{timestamp}}, {{uuid}}. If a template makes up the whole value, its original type is kept (number, object…).
Changes to mocks.json apply when you save, with no restart.
Several responses per route, chosen by condition
A route can have a responses list. The first response whose when matches is sent. A response without when is the default.
{ "method": "GET", "path": "/api/perfil", "responses": [
{ "when": { "headers.authorization": "Bearer admin" }, "body": { "rol": "admin" } },
{ "when": { "query.formato": "csv" }, "format": "csv", "body": "id,nombre\n1,Ana" },
{ "status": 401, "body": { "error": "No autorizado" } }
] }
- Sources:
query.x, headers.x (case-insensitive), body.x, params.x, and method. The comparison is equality, as text.
- If nothing matches and there is no default: the server answers
404 with an explanatory message.
format sets the Content-Type: json, text, html, xml, csv, or file (send a file from .viveserver/). An object sent as text is written as JSON. A string sent as json is sent as it is, so it must already be valid JSON.
Redirects, errors, delays and failures
| Field |
Example |
What it does |
redirect |
"redirect": "/nuevo" or { "to": "/nuevo", "status": 301 } |
Sends Location. The default status is 302. |
error |
{ "status": 503, "message": "Volvemos pronto" } |
Sends that status with { "error": message }. |
delay |
1500 or [300, 1500] |
Waits a fixed time, or a random time within the range. |
fail |
0.3 |
Fails 30 % of the requests with a 500. Use 1 to always fail. |
Mistakes in mocks.json (an unknown format, a when with an unknown source, a fail above 1) are written to the ViveServer output channel, and that response is ignored. The rest of the file keeps working.
Routes in code: .viveserver/routes.js
module.exports = {
'GET /api/tasks': (ctx) => ctx.store.tasks ?? [],
'POST /api/tasks': (ctx) => {
ctx.store.tasks ??= [];
const task = { id: Date.now(), ...ctx.body };
ctx.store.tasks.push(task);
return { status: 201, body: task };
},
'DELETE /api/tasks/:id': async (ctx) => {
ctx.store.tasks = ctx.store.tasks.filter((t) => String(t.id) !== ctx.params.id);
return { status: 204 };
},
};
ctx: method, path, params, query, headers, body (already parsed), store (memory shared between requests) and raw ({ req, res } of Node, if you want to write the response yourself).
- Return plain data (sent as JSON) or
{ status, headers, body }.
- In multipart uploads,
ctx.body.files[i].data holds the file Buffer.
- It only runs in trusted workspaces.
routes.js takes priority over mocks.json.
The Create example mock routes command generates both files for you.
Proxy
"viveserver.proxy": [
{ "path": "/api", "target": "http://localhost:3000" },
{ "path": "/auth", "target": "https://staging.example.com", "stripPath": true, "secure": false }
]
Order in which a request is resolved: internal routes → routes.js → mocks.json → proxy → static files.
Settings
| Setting |
Default |
Description |
viveserver.port |
5500 |
If it is taken, the next port is tried |
viveserver.host |
127.0.0.1 |
0.0.0.0 to open it from your phone |
viveserver.root |
"" |
Subfolder to serve (public, dist…) |
viveserver.openIn |
external |
external, simpleBrowser (inside VS Code) or none |
viveserver.browser |
"" |
Browser for external: "" = system default, or chrome, chromium, edge, firefox, brave, opera, vivaldi, safari. Usually chosen from the panel |
viveserver.reloadOn |
change |
change (any change on disk) or save |
viveserver.cssHotReload |
true |
Apply CSS without reloading |
viveserver.staticAnyMethod |
true |
Static files for any method |
viveserver.cors |
false |
true (any origin, no credentials) or a list of allowed origins (with credentials) |
viveserver.spa |
false |
Fallback to index.html |
viveserver.ignore |
["node_modules", ".git"] |
Folders that do not trigger a reload |
viveserver.mocksDir |
.viveserver |
Folder for mocks.json / routes.js |
viveserver.headers |
{} |
Extra headers (e.g. COOP/COEP for SharedArrayBuffer) |
viveserver.proxy |
[] |
See above |
viveserver.https |
off |
{ "enable": true, "cert": "cert.pem", "key": "key.pem" } |
Development
npm test # server tests (pure Node, no VS Code)
npm run lint # ESLint with the project style rules (single exit, no continue, no break in loops)
npm run test:vscode # extension tests inside a real VS Code (downloads VS Code once)
npm run package # build the .vsix
Press F5 in VS Code to try the extension on the ejemplo/ folder.
The server core (src/server.js) does not depend on VS Code and can be reused as a library or CLI.
Contributions
ViveServer does not accept contributions: merge requests and forks are not used to change this repository. If you find a bug, please report it in the issues of the project.
License
MIT