Coding

PM2 Process Manager

Try it

Manage Node.js applications with PM2 process manager. Use for deploying, monitoring, and auto-restarting Node apps in production. Covers starting apps, viewing logs, setting up auto-start on boot, and managing multiple processes.

What it does

Production process manager for Node.js with built-in load balancer.

The skill document

PM2 Process Manager

Production process manager for Node.js with built-in load balancer.

Install

npm install -g pm2

Quick Start

# Start an app
pm2 start app.js
pm2 start npm --name "my-app" -- start
pm2 start "npm run start" --name my-app

# With specific port/env
pm2 start npm --name "my-app" -- start -- --port 3000
PORT=3000 pm2 start npm --name "my-app" -- start

Common Commands

# List processes
pm2 list
pm2 ls

# Logs
pm2 logs              # All logs
pm2 logs my-app       # Specific app
pm2 logs --lines 100  # Last 100 lines

# Control
pm2 restart my-app
pm2 stop my-app
pm2 delete my-app
pm2 reload my-app     # Zero-downtime reload

# Info
pm2 show my-app
pm2 monit             # Real-time monitor

Auto-Start on Boot

# Save current process list
pm2 save

# Generate startup script (run the output command with sudo)
pm2 startup

# Example output - run this:
# sudo env PATH=$PATH:/opt/homebrew/bin pm2 startup launchd -u username --hp /Users/username

Next.js / Production Builds

# Build first
npm run build

# Start production server
pm2 start npm --name "my-app" -- start

# Or with ecosystem file
pm2 start ecosystem.config.js

Ecosystem File (ecosystem.config.js)

module.exports = {
  apps: [{
    name: 'my-app',
    script: 'npm',
    args: 'start',
    cwd: '/path/to/app',
    env: {
      NODE_ENV: 'production',
      PORT: 3000
    }
  }]
}

Useful Flags

FlagDescription
--nameProcess name
--watchRestart on file changes
-i maxCluster mode (all CPUs)
--max-memory-restart 200MAuto-restart on memory limit
--cron "0 * * * *"Scheduled restart

Cleanup

pm2 delete all        # Remove all processes
pm2 kill              # Kill PM2 daemon
pm2 unstartup         # Remove startup script

Related skills

Find why your productivity system keeps failing, then apply the smallest fix — capacity math, bottleneck routing, durable local notes.

by Iván854 installs69 stars

figma-use

Official

Execute JavaScript inside Figma files via the Plugin API to read, create, and mutate design nodes.

by OpenAI27.5k stars

Build, refine, and benchmark agent skills through an iterative loop of drafting, testing, and evaluating.

by Anthropic177.3k stars

cli-creator

Official

Build a durable CLI Codex can call by command name from any repo, with a companion skill included.

by OpenAI27.5k stars

aspnet-core

Official

Follow Microsoft's current guidance for choosing ASP.NET Core app models, structuring Program.cs, and building features the official way.

by OpenAI27.5k stars

More from asteinberger

Browse all skills

Control Docker containers and stacks via Portainer API. List containers, start/stop/restart, view logs, and redeploy stacks from git.

by asteinberger153 installs3 stars

Control whole-house music scenes combining Spotify playback with Airfoil speaker routing. Quick presets for morning, party, chill modes.

by Andy Steinberger98 installs1 stars

Control AirPlay speakers via Airfoil from the command line. Connect, disconnect, set volume, and manage multi-room audio with simple CLI commands.

by asteinberger107 installs