🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

livelocalhost

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

livelocalhost

localhost development server with live reloading

Source
npmnpm
Version
1.1.1
Version published
Weekly downloads
23
27.78%
Maintainers
1
Weekly downloads
 
Created
Source

LiveLocalhost

A simple localhost development server with hot reloading. Serves any local directory, watches for file changes, and triggers live browser reloading.

Command line usage

Run LiveLocalhost from the command line:

npx livelocalhost

You can also install it globally:

npm install livelocalhost -g

and serve static files using:

llh

or

livelocalhost

Once started, you can access http://localhost:8000/ in your browser.

Options

Options can can be set with --name=value, or --name value format.

parameterdescription
-e, --env <file>load defaults from an .env file
-p, --serveport <port>HTTP port (default 8000)
-d, --servedir <dir>directory to serve (./)
-r, --reloadservice <path>path to reload service (/livelocalhost.service)
-j, --hotloadJSenable hot reloading of JavaScript files (false)
-w, --watchDebounce <ms>debounce time for file changes (default 600)
-l, --accessLogshow server access log (false)
-v, --versionshow application version
-?, --helpshow CLI help
-E, --helpenvshow .env/environment variable help
-A, --helpapishow Node.js API help

The reloadservice need only be changed if you want to disable or change the Server Sent Events handler path. By default, the path is /livelocalhost.service. A client-side script at /livelocalhost.service.js is injected into HTML files to trigger reloading.

Hot reloading of client-side JavaScript is disabled unless you enable --hotloadJS. This refreshes the whole page when any JavaScript file changes.

--watchDebounce sets a delay time to ensures multiple file changes do not trigger more than one live reload.

Examples:

llh --serveport 8080 --servedir=./build/ --reloadservice /reload

The first two non-dashed parameters are presumed to be the port and directory:

llh 8080 ./build/

You can also use environment variables to configure options - enter llh -E for details.

Stop the server with Ctrl | Cmd + C.

Node.js module usage

You can use livelocalhost in your Node.js projects - enter llh -A for details.

Install it into your project:

npm install livelocalhost

Optionally add --save-dev to ensure it's only loaded in development mode.

Import the module into a JavaScript file (such as index.js):

import { livelocalhost } from 'livelocalhost';

set options as necessary, e.g.

livelocalhost.serveport = 8080;
livelocalhost.servedir = './build/';
livelocalhost.reloadservice = '/reload';
livelocalhost.hotloadJS = true;
livelocalhost.watchDebounce = 2000;
livelocalhost.accessLog = true;

(If not explicitly set, the options fall back to environment variables and defaults.)

Execute the .start() method:

livelocalhost.start();

Launch your application as normal, e.g. node index.js.

Changes

1.1.0, 3 June 2025

  • new accessLog option
  • improved CLI argument parsing, logging, help, and README

1.0.3, 14 May 2025

  • now works on Windows (path issue fixed)

1.0.2, 23 April 2025

  • all CSS files are hot reloaded if one changes to ensure @import works.
  • fixed bug that reloaded all <link> elements such as sitemaps, feeds, and favicons.

1.0.1, 23 April 2025

  • package.json fix.

Keywords

http

FAQs

Package last updated on 05 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts