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

yesman

v1.0.8

Published

Json Mocking Server

Readme

YesMan

Diff based a mocking server built on express.js. It is designed for use with RESTful json APIs.

Overview

Each mocked service has a json template file which defines the structure of the response. Diffs or deltas are then applied to the template to produce the desired response. Both the template and the diffs are pure json.

Install

npm install -g yesman

Create a yesman app

yesman init

Start the yesman server

yesman start <app-path>

Help

yesman help

Services / URLs

All available urls are defined in the services.json file. Each url points to a folder which contains the template, config and diffs for that service:

{
	"services" : {
		  "/customer"             : "<customer-dir>"
		, "/product"              : "<product-dir>"
		, "/currencies"           : "<currencies-dir>"
	}
}

Forwards

Services can also be configured to forward to an external url in services.json:

{
	"forwards" : {
		  "/countries" : "<external-url>"
	}
}

Service Folder

Each service has it's own folder containing templates, config and diffs for that service:

customer
    customer-config.json
    customer-template.json
    customer-diff-john-smith.json
    customer-diff-mary-jones.json

Template

A template is pure json and is named -config.json. A simple service can function with just a template file and no config file or diff files (see the currencies service). In this case, the template itself is returned unmodified.

For more complex services, multiple diffs can be applied to the template to produce the desired output. See json-cascade for more on how templates work.

Config

Services are configured in the <servicedir>/<servicename>-config.json file. The available configuration values are:

  • verbs - a list of HTTP request methods for this service eg ["GET", "POST"]
  • template - path to the template file relative to the templates folder eg /customer.json
  • reqParser - the name of a function in req-parsers.js that will parse the request body and produce a diff to be applied to the template eg the mirror function returns the request body itself.
  • mockGenerator - the name of a function in dummy-data-generator.js that will dynamically generate a diff eg timestamps, random number generators etc
  • diff - path to a custom diff file.
  • states - list of available states. Each state may override the service level config options: template, reqParser, mockGenerator, diff

Any values that are not set explicitly will be defaulted based on the file default-service-config.json.

States / Diffs

Each service can be put into various states to mimic the behaviour of a stateful application (eg a database). State information is stored as a diff in .json file.

Scenarios

A scenario is a list of services and their current states. This allows us to define the behaviour for a particular sequence of service calls. See scenarios.json. The scenario under test is set in config.json. Changing the scenario in config.json does not require a restart.

Use with Grunt

Yesman can be started via Grunt using the grunt-express-server plugin. It can also be restarted automatically as your code changes using the grunt-contrib-watch plugin. For an example, see Gruntfile.js

foo

Yesman combines data from 4 sources to build a mock json response.

  • Template - Defines the structure of the response and some default values.
  • HttpRequest - Values can be picked from the request and echoed back in the response.
  • Generator - Values can be generated dynamically eg timestamps
  • State - Each service can be put into a particular state. For example, for a customer lookup service, the state could be set to: CUSTOMER_FOUND, CUSTOMER_NOT_FOUND, UNAUTHORIZED, SERVER_ERROR