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

@ridakaddir/mockr

v0.1.0-beta.22

Published

A fast CLI tool to mock, stub, and proxy HTTP and gRPC APIs

Readme

mockr

A fast, zero-dependency-on-your-app CLI tool to mock, stub, and proxy HTTP and gRPC APIs — written in Go.

Point your frontend at mockr instead of the real API. Mock only the endpoints you're building. Forward everything else to the real backend. Switch between response scenarios by editing a config file — changes apply instantly.

Install

npm install -D @ridakaddir/mockr

Or use it directly with npx:

npx @ridakaddir/mockr --init

Once installed, the mockr command is available in your project:

npx mockr --init

Quick Start

1. Scaffold a starter config

npx mockr --init

This creates a mockr.toml config file and a stubs/ directory with an example JSON response.

2. Start the mock server

npx mockr

The server starts at http://localhost:4000 by default.

3. Point your frontend at it

Update your API base URL to http://localhost:4000 during development:

// .env.development
VITE_API_URL=http://localhost:4000

// or in your fetch calls
const response = await fetch("http://localhost:4000/api/users");

4. Add to your npm scripts

{
  "scripts": {
    "mock": "mockr --config ./mocks --target https://api.example.com",
    "dev": "concurrently 'npm run mock' 'vite'"
  }
}

Usage

# Start with default config (mockr.toml in current directory)
npx mockr

# Start with a target upstream API
npx mockr --target https://api.example.com

# Start on a custom port
npx mockr --port 3001

# Use a config directory (loads and merges all config files)
npx mockr --config ./mocks

# Strip an API prefix before matching routes
npx mockr --api-prefix /api

# Record responses from a real API
npx mockr --target https://api.example.com --record

# Generate config from an OpenAPI spec
npx mockr generate --spec ./openapi.yaml

# Generate config from a .proto file
npx mockr generate --proto ./service.proto

Features

  • Route-based mocking — define routes with named response cases
  • Condition routing — route based on request body, query params, headers, or path parameters
  • Dynamic file resolution — serve different stubs based on request data
  • Reverse proxy fallthrough — unmatched routes forward to the real API
  • Hot reload — edit config files and changes apply instantly
  • Record mode — proxy a real API and save responses as stub files
  • Response templating{{uuid}}, {{now}}, {{timestamp}} in responses
  • OpenAPI generation — generate mockr config from any OpenAPI 3 spec
  • gRPC support — mock and proxy gRPC services from .proto files
  • Multi-format config — TOML, YAML, or JSON

Config Example

[[routes]]
method = "GET"
path   = "/api/users"
fallback = "success"

  [routes.cases.success]
  status = 200
  file   = "stubs/users.json"

  [routes.cases.empty]
  status = 200
  body   = "[]"

  [routes.cases.error]
  status = 500
  body   = '{"error": "Internal server error"}'

Supported Platforms

| OS | Architecture | Package | | ------- | ------------ | --------------------- | | macOS | ARM64 | @ridakaddir/mockr-darwin-arm64 | | macOS | x64 | @ridakaddir/mockr-darwin-x64 | | Linux | x64 | @ridakaddir/mockr-linux-x64 | | Linux | ARM64 | @ridakaddir/mockr-linux-arm64 | | Windows | x64 | @ridakaddir/mockr-win32-x64 | | Windows | ARM64 | @ridakaddir/mockr-win32-arm64 |

The correct binary for your platform is installed automatically via optionalDependencies.

Documentation

For complete documentation, examples, and configuration reference, visit the main repository.

License

MIT