🎩 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.2.0
Version published
Weekly downloads
23
27.78%
Maintainers
1
Weekly downloads
 
Created
Source

LiveLocalhost

GitHub | npm | sponsor | BlueSky | craigbuckler.com

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

Browser live reloading is available when:

  • the application has permission to watch files, and
  • --reloadservice is a URL path starting /

By default, the Server Sent Events service path for live reloading is /livelocalhost.service and a client-side script at /livelocalhost.service.js is injected into all HTML files. You need only change --reloadservice if that path is already in use or you want to disable live reloading.

Live reloading is disabled when you set any value that does not start with /.

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.2.0, 7 June 2025

  • disable live reloading when --reloadservice does not start with /
  • disable live reloading when the app does not have permission to watch files
  • help and README updates

1.1.1, 5 June 2025

  • minor logging updates

1.1.0, 3 June 2025

  • new accessLog option
  • uses ConCol for prettier console logging
  • improved CLI argument parsing, 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 07 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