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 🙏

© 2025 – Pkg Stats / Ryan Hefner

planb

v1.0.2

Published

Serve essential API data locally when the API is down

Downloads

27

Readme

planb

API developers are the worst. They break things when you're in the middle of adding a sweet feature to the client application.

You could add fixture data, but during development it's likely to go stale, and you still have to serve it.

planb makes it easy to fetch fresh API data when the API is up and serve it when it's down.

Install

$ npm install -g planb

Usage

$ cd /path/to/project

$ planb init

Project initialized

$ planb add "http://reddit.com/r/node.json"

endpoint added

$ planb add "http://reddit.com/r/node.json" -p 5001

endpoint added

$ planb fetch

Updating reddit.com/r/node.json for port 5000
Updating reddit.com/r/node.json for port 5001

$ planb list

.---------------------------------------------.
|   | 5000 | get | reddit.com/r/node.json     |
|---|-----------------------------------------|
| 0 | Wed Jun 10 2015 22:26:41 GMT-0400 (EDT) |
'---------------------------------------------'

.---------------------------------------------.
|   | 5001 | get | reddit.com/r/node.json     |
|---|-----------------------------------------|
| 0 | Wed Jun 10 2015 22:26:41 GMT-0400 (EDT) |
'---------------------------------------------'

$ planb serve

Listening on port 5000
Listening on port 5001

$ planb

  Usage: index [options] [command]


  Commands:

    init                       Initialize a project in current directory
    add [url]                  Add a new endpoint
    list                       List all endpoint versions
    fetch                      Fetch and store a new version for each endpoint
    rollback [endpoint]        Rollback the endpoint's current version
    remove [endpoint]          Remove the endpoint and all its versions
    diff [endpoint] [v1] [v2]  Diff versions. With no version numbers,
                               diffs the current version with the previous
    serve                      Serve local versions

  Options:

    -h, --help             output usage information
    -p, --port <port>      Set port. Default: 5000
    -a, --action <action>  Set action. Default: get

After planb serve, swap references to the API domain with localhost:5000. In the above example, data will be available at localhost:5000/r/node.json and localhost:5001/r/node.json.

Config

A project is initialized if a .planb.json file is found in the current directory, or a parent directory all the way up to /. Running planb init will create a .planb.json config file and a .planb.d data directory. The config created from the above example would look like:

{
  "endpoints": {
    "5000": {
      "get": [
        "reddit.com/r/node.json"
      ],
      "default": true
    },
    "5001": {
      "get": [
        "reddit.com/r/node.json"
      ]
    }
  }
}

You can add endpoints directly to the config and run planb fetch, skipping planb add .... If the data directory isn't present but the config is, planb fetch will create it.

Notes

  • Exact query strings must be used. Order matters. So, example.com/api?type=test&other=param will not be the same endpoint as example.com/api?other=param&type=test

Tests

$ npm test