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

@lowdep/http-mock

v1.0.0

Published

Local HTTP mock server from a JSON routes file — like json-server but zero dependencies

Readme

http-mock

Zero dependencies Node License: MIT Platform

Local HTTP mock server from a mocks.json definition. Define your API routes once, mock responses with status codes, delays, headers, and path param interpolation. Zero dependencies.

Like json-server but with no dependencies and full control over responses.


Install

npm install -g http-mock

Or without installing:

npx http-mock

Quick Start

http-mock init    # Create a starter mocks.json
http-mock         # Start the server

Example Output

http-mock  mocks.json
  Server running at http://localhost:3000
  7 route(s) loaded · CORS enabled

  GET     /health           → 200
  GET     /users            → 200
  GET     /users/:id        → 200
  POST    /users            → 201 +200ms
  DELETE  /users/:id        → 204
  GET     /error            → 500
  GET     /slow             → 200 +1500ms

  6:20:13 pm  GET     /users        200  4ms
  6:20:14 pm  GET     /users/42     200  2ms
  6:20:15 pm  POST    /users        201  203ms +200ms delay
  6:20:16 pm  GET     /missing      404  1ms

mocks.json Format

{
  "port": 3000,
  "delay": 0,
  "routes": [
    {
      "method": "GET",
      "path": "/health",
      "status": 200,
      "body": { "status": "ok", "time": "{{now}}" }
    },
    {
      "method": "GET",
      "path": "/users/:id",
      "status": 200,
      "body": { "id": "{{params.id}}", "name": "User {{params.id}}" }
    },
    {
      "method": "POST",
      "path": "/users",
      "status": 201,
      "body": { "id": "123", "created": true },
      "delay": 500
    },
    {
      "method": "DELETE",
      "path": "/users/:id",
      "status": 204,
      "body": null
    }
  ]
}

Route Fields

| Field | Type | Description | |---|---|---| | method | string | HTTP method: GET, POST, PUT, PATCH, DELETE, * | | path | string | URL path. :param captures path segments | | status | number | Response status code (default: 200) | | body | any | Response body. null = no body | | headers | object | Extra response headers | | delay | number | Delay in milliseconds before responding |


Template Variables

Use {{...}} in body strings:

| Variable | Value | |---|---| | {{params.id}} | Path param :id | | {{query.name}} | Query string ?name=... | | {{now}} | Current ISO timestamp | | {{body.email}} | Field from the request body |


Options

http-mock                  # Use ./mocks.json
http-mock api.json         # Use a specific file
http-mock --port 4000      # Override port
http-mock --watch          # Reload on config file change
http-mock --cors           # Enable CORS headers

License

MIT


Keywords

mock server · mock api · json-server alternative · mockoon alternative · fake api · rest mock · stub server · local api · zero dependencies · cli


Built to solve, shared to help — Rushabh Shah 🛠️✨

One of 40+ zero-dependency developer CLI tools — no node_modules, ever.