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

ntropi

v1.0.1

Published

A live mock api generator that works without having any actual backend.

Downloads

263

Readme

Ntropi Logo

Table of Contents

Installation

npm install -g ntropi

Quick Start

# 1) Create config
ntropi --api users posts --delay 500 --failure-rate 10

# 2) Run server
ntropi run

By default, Ntropi starts at http://localhost:8008. If port 8008 is occupied, it automatically tries the next free port.

CLI Usage

Commands

# Generate or update config (default: ntropi-config.json)
ntropi [options]

# Run server using default config file
ntropi run

# Same as above using flag
ntropi --run

Options

| Option | Shorthand | Description | | --- | --- | --- | | --help | - | Show help output | | run | - | Run the mock server | | --run | -r | Run the mock server | | --api <values...> | -a | Endpoints to generate/update | | --delay <num> | -d | Response delay in milliseconds (integer, >= 0) | | --failure-rate <num> | -f | Failure percentage (0 to 100) | | --config <file> | -c | Config file path | | run --editor-only | - | Start only the configuration website (no mock endpoints) |

API Method Syntax

You can set endpoint methods directly in --api values:

# Default method is GET
ntropi --api users products

# Explicit method
ntropi --api users:POST orders:DELETE

# Shorthand methods
# G=GET, P=POST, U=PUT, D=DELETE, H=PATCH
ntropi --api users:G orders:P profile:U health:D patch-test:H

Configuration File

Default file: ntropi-config.json

{
  "localhost": true,
  "endpoints": [
    {
      "path": "/api/users",
      "method": "GET",
      "data": [
        { "id": 1, "name": "$name" },
        { "id": 2, "name": "$name" }
      ],
      "delay": 300,
      "failureRate": 5,
      "cacheSize": 5
    }
  ]
}

Top-Level Properties

  • endpoints (required): array of endpoint definitions.
  • localhost (optional):
    • true or omitted: bind to 127.0.0.1.
    • false: bind to 0.0.0.0 for LAN/network access.

Endpoint Properties

  • path (required): route path, must start with /.
  • method (required): one of GET, POST, PUT, DELETE, PATCH.
  • data (required): source data used for response generation.
  • delay (optional): non-negative number in milliseconds.
  • failureRate (optional): number in range 0..100.
  • cacheSize (optional): positive integer response cache size.
  • template (optional): object template that maps placeholders to data.

Template and Data Behavior

  • If template is not provided:
    • array data: one top-level item is randomly selected (token resolved if present).
    • object/string data: returned directly (after token resolution).
  • If template is provided:
    • data must be a non-empty array.
    • indexed placeholders like $1, $2 refer to array positions.
    • nested template objects/arrays are supported.

Template example:

{
  "endpoints": [
    {
      "path": "/api/profile",
      "method": "GET",
      "data": [
        ["active", "inactive"],
        { "name": "$name", "age": "$int(18-40)" }
      ],
      "template": {
        "status": "$1",
        "user": "$2"
      },
      "delay": 0,
      "failureRate": 0
    }
  ]
}

Custom Dataset Generator

We have built a powerful custom dataset generator designed to deliver instant, ready-to-use datasets tailored to your exact specifications. Simply define your parameters, set your desired values, and generate structured data on demand, no manual effort required.

Dynamic Token Reference

Supported value generators in data strings:

  • $name
  • $string(min-max) or $string(n)
  • $int(min-max) or $int(n)
  • $float(min-max,decimals)
  • $bool
  • $date(format) (or $date for ISO timestamp)
  • $uuid

Escape tokens with \\$ to keep them as literal text.

Configuration Website

When you run Ntropi, it also serves a configuration website at the server root.

ntropi run

Then open:

  • http://localhost:8008/ (or the printed port)

Editor-only mode:

ntropi run --editor-only

This starts only the configuration website and management APIs, without generating mock API endpoints.

Examples

# Basic endpoints
ntropi --api users posts comments

# With delay and failures
ntropi --api orders payments --delay 1200 --failure-rate 25

# Mixed methods
ntropi --api users:G users:POST users:PUT users:D

# Custom config file
ntropi --api products --config staging.json
ntropi run --config staging.json

Troubleshooting

Config validation error

Check that:

  • each endpoint has path, method, data
  • path starts with /
  • method is valid
  • delay >= 0 and failureRate is in 0..100

Port already in use

Ntropi automatically increments the port until it finds a free one.

Endpoint not changing after edit

Ntropi hot-reloads config file changes. If you changed endpoint path/method, the server restarts automatically. For value-only changes (like delay, failureRate, data), endpoints keep running and use new values on next request.

Authors