Registry / web-framework / servor

servor

JSON →
library4.0.2jsnpmunverified

Servor is a compact, dependency-free development server designed for modern web application development, particularly single-page applications. Currently at version 4.0.2, it provides features like live reloading, HTTPS/HTTP2 support with self-signed certificates, gzip compression, and frontend routing redirection. It aims for minimal code and relies only on native Node.js and browser APIs, differentiating it from larger alternatives by its zero-dependency philosophy. Releases are generally stable, with major version updates introducing significant architectural changes, such as the shift to native ESM in v4.

npm install servor
INSTALL
IMPORT
SIG · SERVOR
S
servor
web-frameworkjavascriptv4.0.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Servor
import { Servor } from 'servor';
const Servor = require('servor');
Since v4, Servor is a native ESM package. The main function is a named export 'Servor'.
Programmatic CJS
const { Servor } = await import('servor');
const Servor = require('servor').Servor;
For CommonJS projects, dynamic import is required to load the ESM package and access the named export.
CLI Usage
npx servor . index.html 8080 --reload
The primary way to use Servor is via its command-line interface, often invoked with npx or an npm script.

This command demonstrates how to clone a GitHub repository, start a Servor instance, open it in a browser and editor, and enable live reloading for development.

npx servor gh:lukejacksonn/perflink --browse --editor --reload # Or, for a local project: # npm install servor --save-dev # then add to package.json scripts: // { // "scripts": { // "start": "servor www index.html 8080 --reload --browse" // } // } # npm start
servor --version
Debug
Known issues
breakingServor transitioned to native ES Modules (ESM) in version 4.0.0. This means CommonJS `require()` statements will no longer work directly.
fix
Update imports to use ESM syntax `import { Servor } from 'servor';` for ESM projects. For CJS projects, use dynamic imports like `const { Servor } = await import('servor');`.
affects: >=4.0.0
gotchaUsing the `--secure` flag for HTTPS requires `openssl` to be installed on your system to generate self-signed certificates.
fix
Ensure `openssl` is available in your system's PATH. For macOS, additional steps might be required (`sudo security add-trusted-cert`) to trust the generated root certificate in your browser.
affects: >=3.2.0
gotchaWhen using `--secure` with HTTPS, browsers will initially warn about an untrusted connection because the certificates are self-signed. You will need to manually accept the risk or add the generated root certificate to your system's trusted store.
fix
Follow the instructions in the `servor` documentation to add `servor.crt` to your system's trusted certificate store. This typically involves `sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain servor.crt` on macOS or similar steps for Linux/Windows.
affects: >=3.2.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM: require() of ES Module ...servor/index.js from ... not supported.
Attempting to use `require('servor')` in a CommonJS environment after upgrading to Servor v4, which is an ESM package.
fix
Change `const Servor = require('servor');` to `const { Servor } = await import('servor');` in your CJS code.
listen EADDRINUSE: address already in use :::8080
The default port 8080 (or your specified port) is already being used by another process.
fix
Specify an alternative port, e.g., `npx servor . index.html 3000`, or find and terminate the process currently using the port.
NET::ERR_CERT_AUTHORITY_INVALID in browser
The browser does not trust the self-signed HTTPS certificate generated by Servor with the `--secure` flag.
fix
Manually accept the security warning in your browser, or follow the `servor` documentation to add the generated `servor.crt` to your operating system's trusted certificate store.
Upgrade
Version history
4.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
OpenAI (training)
1
Resources
servor — npm install servor · libregistry