npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@hamedb89/localghost

v0.1.8

Published

Friendly local hostnames for app repos with .localghost, Caddy, /etc/hosts, and Vite.

Readme

@hamedb89/localghost

Buh. Friendly local hostnames for app repos.

CI GitHub Pages Publish npm npm version

Localghost is a tiny Node.js CLI for clean local app domains. Add it as a dev dependency, keep running the command your team already knows, and use http://app.localhost/ instead of remembering which port belongs to which process.

Website · Docs · npm · GitHub

Quick Start

yarn add -D @hamedb89/localghost

For Vite apps, add the plugin once:

import { defineConfig } from "vite";
import { localGhostPlugin } from "@hamedb89/localghost/vite";

export default defineConfig({
  plugins: [localGhostPlugin()]
});

Then keep using the command your repo already expects:

yarn dev

On the first interactive run, Localghost can create .localghost, explain the /etc/hosts change, write ops/local/Caddyfile, and print the browser-facing URL:

localghost
local:  http://app.localhost/
also:   http://www.app.localhost/
target: http://127.0.0.1:5173/

For non-Vite apps, wrap your raw dev command:

{
  "scripts": {
    "dev": "localghost run -- yarn dev:raw",
    "dev:raw": "next dev"
  }
}

What It Does

  • Reads .localghost from your app repo and turns hostnames into local routes.
  • Updates only a managed Localghost block in /etc/hosts during explicit setup.
  • Generates ops/local/Caddyfile for local reverse proxying.
  • Keeps HTTP as the default; HTTPS is explicit with --https, --ssl, or config.
  • Checks whether Caddy is installed, but never installs Homebrew packages for you.
  • Gives Vite explicit server.allowedHosts entries without using allowedHosts: true.
  • Exposes CLI, config, state, and route output for scripts and agent workflows.

Common Commands

localghost init --write-scripts
localghost doctor
localghost setup
localghost status --ready
localghost dev
localghost run -- vite
localghost routes
localghost ps
localghost reset
localghost teardown
localghost update

Prefer .localhost names. .local is supported, but Localghost warns because .local can collide with mDNS/Bonjour.

Configuration

Most apps only need a .localghost file when they want explicit hostnames or multiple services:

# Format: <host> <port>
app.localhost 5173
www.app.localhost 5173
api.app.localhost 8787

Most repos do not need localghost.config.mjs. Add it only for decisions like HTTPS, dynamic-port behavior, www. aliases, custom config files, or ghostTunnel preview domains.

Trust

  • CI runs typecheck, build, site build, and npm package dry-run on Node 20 and 22.
  • GitHub Pages is deployed by Actions from the checked-in site/, docs/, and assets/ sources.
  • Preview the exact Pages artifact locally with npm run site:serve, then open http://127.0.0.1:4173/.
  • npm publish is guarded by prepublishOnly and the release workflow publishes with npm provenance.
  • Runtime dependencies are intentionally small: commander and execa. Vite is an optional peer dependency.
  • No postinstall scripts, hidden Homebrew installs, surprise browser tabs, or broad hosts-file rewrites.
  • Update checks are best-effort, cached for 24 hours, and can be disabled with LOCALGHOST_NO_UPDATE_CHECK=1 or --no-update-check.

Docs

The full docs are served on GitHub Pages:

API

import {
  getConfigFileCandidates,
  initLocalghost,
  readDevHosts,
  readLocalghostState,
  removeSystemHosts,
  renderCaddyfile,
  renderHostsBlock,
  runDoctor,
  updateSystemHosts
} from "@hamedb89/localghost";

import { localGhostPlugin } from "@hamedb89/localghost/vite";

License

MIT