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

@mocko/cli

v2.1.0

Published

Mocking made easy, proxy your API and choose which endpoints to mock

Readme

@mocko/cli

Dynamic HTTP mocking from your terminal.

Mocko CLI starts the Mocko mock server and, by default, the Control Panel. Use it to create dynamic API mocks, run versioned File Mocks, proxy real APIs, and simulate stateful flows with flags.

Mocko Control Panel

Installation

npm i -g @mocko/cli

Check the installation:

mocko --help

Quick Start

Start Mocko with the Control Panel enabled:

mocko

Open the Control Panel at http://localhost:6625. Mocked HTTP endpoints are served from http://localhost:8080.

Run File Mocks

Create ./mocks/orders.hcl:

mock "GET /orders/{id}" {
  name   = "Get order"
  labels = ["orders", "checkout"]
  format = "json"

  body = <<EOF
    {
      "id": "{{request.params.id}}",
      "status": "{{default request.query.status 'processing'}}",
      "etaMinutes": {{random 5 30}}
    }
  EOF
}

Run Mocko pointing to the folder:

mocko --watch ./mocks

Call the mock:

curl http://localhost:8080/orders/123

File Mocks are loaded into the mock server and shown in the Control Panel.

Proxy An API

Mocko can sit in front of a real API. Requests with matching mocks are handled by Mocko; everything else is proxied.

mocko --watch ./mocks --url https://api.example.com

Templates can also choose when to proxy:

mock "GET /orders/{id}" {
  format = "json"

  body = <<EOF
    {{#is request.params.id "preview"}}
      {
        "id": "preview",
        "status": "draft"
      }
    {{else}}
      {{proxy}}
    {{/is}}
  EOF
}

Flags And Tests

Flags are persisted values that mocks, the Control Panel, and automated tests can read and write. Use them to simulate multi-step flows such as balances, purchases, inventory, order status, or feature switches.

For test automation, use @mocko/sdk:

npm install @mocko/sdk

Mocko Flags

Options

Usage: mocko [options] [path to mocks folder]
Example: mocko --watch ./mocks

Options:

  -h, --help       Shows this screen
  -v, --version    Shows the current version
  -w, --watch      Watches for file changes and restarts the server
  -p, --port       Port to serve the mocks (8080)
  -u, --url        URL to proxy requests when no mock is defined
  -t, --timeout    Max time to wait for a response from the proxied URL in millis (30000)
  --no-ui          Disables the Control Panel
  -r, --redis      Enables Redis mode using the provided Redis URL
  -P, --ui-port    Overrides the Control Panel port (6625)

Validating mocks in CI

mocko validate checks every mock in a folder without starting a server and exits with a non-zero code when any of them is broken: HCL syntax errors, invalid definitions, duplicated routes, or body templates that fail to compile.

Usage: mocko validate [options] <path to mocks folder>
Example: mocko validate mocks

Options:

  -h, --help      Shows this screen
  -s, --strict    Treats warnings as errors
  -j, --json      Outputs machine-readable JSON

Documentation