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

nserve-cli

v1.1.1

Published

A simple CLI tool to serve static files with PM2 background support

Readme

nserve-cli

A command-line tool for serving static files with PM2 background persistence. This tool makes it easy to serve multiple static sites and manage them with simple commands.

Features

  • Serve static websites with Express
  • Run servers in the background using PM2
  • Support for multiple static servers on different ports
  • SPA mode with fallback to index.html for client-side routing
  • Easy management with simple CLI commands
  • Auto-restart on system reboot (with PM2)

Installation

# Install globally
npm install -g nserve-cli

Usage

The CLI tool can be used with the following commands:

nserve [options]           # Start a new static server
nserve list                # List all running servers
nserve start <name|all>    # Start stopped servers
nserve stop <name|all>     # Stop running servers
nserve restart <name|all>  # Restart servers
nserve delete <name|all>   # Delete servers
nserve save                # Save the current process list

Options

When starting a new server, you can specify the following options:

  • -d, --dir <path> - Directory to serve (defaults to current directory)
  • -p, --port <number> - Server port (defaults to 3000)
  • -n, --name <string> - Process name (defaults to a generated name)

Command Details

Starting a new server

To start a new static server:

nserve --dir ./build --port 3001 --name my-website

This will start a static file server in the background using PM2.

Listing all servers

nserve list

Shows a table with all running static servers, including:

  • Name
  • Status (online/stopped)
  • Port
  • Directory being served
  • Uptime
  • Number of restarts

Starting a server

nserve start my-website  # Start a specific server
nserve start all         # Start all stopped servers

Starts a stopped server or all stopped servers.

Stopping a server

nserve stop my-website   # Stop a specific server
nserve stop all          # Stop all running servers

Stops a server or all running servers without removing them from PM2.

Restarting a server

nserve restart my-website   # Restart a specific server
nserve restart all          # Restart all servers

Restarts one or all servers.

Deleting a server

nserve delete my-website   # Delete a specific server
nserve delete all          # Delete all servers

Completely removes a server or all servers from PM2.

Saving the process list

nserve save

Saves the current process list so that it can be restored when PM2 restarts.

Configuring autostart

nserve autostart

Configures PM2 to start on system boot, ensuring your servers restart automatically. You may need to run the provided sudo command to complete the setup.

Examples

Serving a React build folder

# From the project directory
npm run build
nserve --dir ./build --port 3000 --name my-react-app

Serving multiple websites

# Start multiple websites on different ports
nserve --dir ./site1 --port 3001 --name site1
nserve --dir ./site2 --port 3002 --name site2

# List all running websites
nserve list

# Stop all websites
nserve stop all

# Start all websites again
nserve start all

Auto-starting on system boot

# Save current process list
nserve save

# Configure PM2 to start on boot
nserve autostart
# Follow the instructions to run the sudo command

License

ISC