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

lazyserve

v1.0.3

Published

Wake your local server on demand via ngrok — sleep when idle, wake on request

Readme

LazyServe

Wake your local server on demand — sleep on idle, wake on request.

LazyServe sits between ngrok and your local server. When a request hits your public URL, it wakes your server, proxies the request, and then puts it back to sleep after a period of inactivity.

Internet → ngrok → LazyServe proxy → (wakes) → Your Server
                                   ← (sleeps after idle) ←

How it works

  1. Placeholder proxy always listens on a port (tiny, near-zero CPU)
  2. ngrok points to the placeholder — your public URL is always alive
  3. When a request arrives and your server is sleeping → LazyServe starts it, waits until ready, then forwards the request
  4. When no requests arrive for N minutes → LazyServe kills your server
  5. Next request → cold start again (~2–5 seconds)

Install

# Clone and install
git clone https://github.com/you/lazyserve
cd lazyserve
npm install
npm run build
npm link   # makes `lazyserve` available globally

Or run directly:

npx ts-node src/cli.ts "npm start" --port 3000

Usage

lazyserve "<command>" --port <port> [options]

Examples

# Node.js app
lazyserve "npm start" --port 3000

# Python Flask
lazyserve "python app.py" --port 5000 --idle 10

# Custom idle timeout (5 minutes)
lazyserve "node server.js" --port 3000 --idle 5

# With ngrok auth token and custom domain
lazyserve "npm start" --port 3000 --authtoken your_token --domain myapp.ngrok.io

# Specific ngrok region
lazyserve "npm start" --port 3000 --region eu

Options

| Option | Default | Description | |--------|---------|-------------| | --port | 3000 | Port your real server runs on | | --proxy-port | port + 1000 | Port for the placeholder proxy | | --idle | 15 | Minutes of inactivity before sleeping | | --authtoken | env | ngrok auth token (NGROK_AUTHTOKEN env also works) | | --domain | — | Custom ngrok domain (paid plans) | | --region | auto | ngrok region: us, eu, ap, au, sa, jp, in | | --health-path | / | Path to health-check your server's readiness | | --silent | false | Suppress output |


Environment Variables

NGROK_AUTHTOKEN=your_token_here lazyserve "npm start" --port 3000

Port layout

:3000  ← your real server (starts/stops)
:4000  ← placeholder proxy (always running) ← ngrok points here

The proxy port defaults to realPort + 1000. You can override with --proxy-port.


Cold start

When your server is sleeping and a request arrives, the caller experiences a delay (typically 2–5 seconds) while the server boots. After that, all subsequent requests are forwarded instantly.

To minimize cold start time:

  • Keep your server startup fast
  • Use --health-path to point to a lightweight endpoint so LazyServe knows when it's ready

Programmatic usage

import { lazyServe } from "lazyserve";

await lazyServe({
  command: "npm start",
  port: 3000,
  idleTimeoutMinutes: 15,
  authtoken: process.env.NGROK_AUTHTOKEN,
  healthCheckPath: "/health",
});

Architecture

┌─────────────────────────────────────────────────────┐
│                    LazyServe                        │
│                                                     │
│  ┌──────────┐    ┌───────────────┐    ┌──────────┐  │
│  │  ngrok   │───▶│  Placeholder  │───▶│  Server  │  │
│  │  tunnel  │    │  Proxy        │    │ Manager  │  │
│  └──────────┘    │  (Fastify)    │    └──────────┘  │
│                  │               │         │         │
│                  │  - intercept  │    spawn/kill     │
│                  │  - wake       │    child_process  │
│                  │  - proxy      │         │         │
│                  └───────────────┘    ┌──────────┐  │
│                                       │  Your    │  │
│                                       │  Server  │  │
│                                       └──────────┘  │
└─────────────────────────────────────────────────────┘

License

MIT