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

@hackmd/spm

v0.1.4

Published

Simpler Process Manager - minimal pm2-like features for better development script setup

Downloads

439

Readme

SPM — Simpler Process Manager

npm version npm downloads npm license

A minimal process manager implementing a lean subset of pm2 features, with some extensions, designed for better development script setup. Lightweight, zero daemon, and PM2-inspired ecosystem config support.

Features

  • Start / Stop / Restart — Manage multiple services from a single config
  • Multi-instance — Run multiple instances with port/env auto-increment
  • Log management — Tail, filter, flush, and rotate logs
  • JSON outputjlist for machine-readable status (CI/scripting)
  • Log rotation — Size-based rotation and retention with optional background watcher

Installation

npm install -g @hackmd/spm

Or with Bun:

bun add -g @hackmd/spm

Quick Start

  1. Create an ecosystem config file (e.g. ecosystem.config.js) in your project:
export default {
  apps: [
    {
      name: 'api',
      script: 'node',
      args: 'server.js',
      instances: 2,
      env: { PORT: '3000' },
      increment_vars: ['PORT'],
    },
    {
      name: 'worker',
      script: 'node',
      args: 'worker.js',
    },
  ],
}
  1. Run SPM:
spm start          # Start all services
spm start api      # Start specific service
spm list           # List services and PIDs
spm stop           # Stop all
spm restart api    # Restart specific service
spm logs api -t    # Tail logs

Configuration

| Option | Description | |--------|-------------| | name | Service identifier | | script | Command to run (e.g. node, bun, python) | | args | Arguments passed to the script | | instances | Number of instances (default: 1) | | env | Environment variables | | increment_vars | Env vars to increment per instance (e.g. PORT) | | increment_var | Legacy alias for increment vars (comma-separated string, e.g. PORT,WS_PORT) |

Ecosystem File Field Support

SPM supports PM2-inspired ecosystem files and deeper app objects without failing on extra fields.

  • SPM actively uses: name, script, args, instances, env, increment_vars, increment_var
  • SPM ignores unsupported fields safely so you can keep partially shared configs across tools
  • increment_vars is the preferred form; increment_var is kept as a compatibility alias in SPM

Config file is resolved from ./ecosystem.custom.config.js by default. Override with --config:

spm --config ./my-ecosystem.config.js start

PM2-Inspired Scope

SPM focuses on a small, practical subset of PM2-like workflows for development.

  • No daemon model in SPM: processes are started detached and tracked with pid files under ~/.spm2/pids/
  • No PM2-style metadata store in SPM: runtime state comes from pid files plus OS process checks
  • increment_vars is supported directly; increment_var is also accepted and split by comma
  • Additional ecosystem fields can exist in app objects, but SPM only interprets its documented fields

Example for split increment vars:

export default {
  apps: [
    {
      name: 'api',
      script: 'node',
      args: 'server.js',
      instances: 2,
      env: { PORT: '3000', WS_PORT: '4000' },
      increment_var: 'PORT,WS_PORT',
    },
  ],
}

Commands

| Command | Description | |---------|-------------| | spm start [service] | Start all or a specific service | | spm stop [service] | Stop processes (alias: kill) | | spm restart [service] | Restart processes | | spm list | List services and running PIDs | | spm jlist | JSON output of service status | | spm logs [service] | View logs (-t tail, -n lines, -f filter) | | spm flush [service] | Clear log files | | spm rotate start | Start log rotation watcher | | spm rotate stop | Stop rotation watcher |

Log Rotation

Logs are stored in ~/.spm2/logs/. Rotation:

  • Rotates when a log exceeds 10MB
  • Removes logs older than 3 days
  • Run spm rotate start for a background watcher

Shell Integration

Completions require jq. App selector also requires fzf.

Bash

Completions — Source the script (requires bash-completion; on macOS: brew install bash-completion@2):

# After npm install -g @hackmd/spm:
source $(npm root -g)/@hackmd/spm/completions/bash/spm.bash
# Or add to ~/.bashrc:
# source /path/to/spm/completions/bash/spm.bash

App selector — Source the script:

source $(npm root -g)/@hackmd/spm/completions/bash/spm_app_selector.sh
# Then:
spm_app_selector start
spm_app_selector --appName=api restart

Zsh

Completions — Add the completion dir to fpath and ensure compinit runs:

# After npm install -g @hackmd/spm:
fpath=($(npm root -g)/@hackmd/spm/completions/zsh $fpath)
compinit
# Or copy to a dir in $fpath:
mkdir -p ~/.zsh/completions
cp $(npm root -g)/@hackmd/spm/completions/zsh/_spm ~/.zsh/completions/
# Add to ~/.zshrc: fpath=(~/.zsh/completions $fpath)

App selector — Source the script:

source $(npm root -g)/@hackmd/spm/completions/zsh/spm_app_selector.zsh
spm_app_selector start

Fish

Completions — Copy to your Fish config:

mkdir -p ~/.config/fish/completions
cp $(npm root -g)/@hackmd/spm/completions/fish/spm.fish ~/.config/fish/completions/

App selector — Copy the function:

mkdir -p ~/.config/fish/functions
cp $(npm root -g)/@hackmd/spm/completions/fish/functions/spm_app_selector.fish ~/.config/fish/functions/

Usage:

spm_app_selector start
spm_app_selector --appName=api restart
spm_app_selector --config=ecosystem.config.js logs

License

MIT