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

@toolstackhq/mockit

v1.0.10

Published

REST API mocking for JavaScript and TypeScript projects

Readme

MockIt

Build Tests Docs Coverage License npm npm downloads Release Last Commit

MockIt is a REST API mocking library for JavaScript and TypeScript.

It supports three runtime patterns:

  • MockServer: run a real mock API on a local port
  • HttpInterceptor: intercept outbound HTTP in the current Node process
  • RemoteMockServer: change a running MockServer from tests or scripts

| Feature | Use case | | --- | --- | | MockServer | Run a real mock API server for frontend development, browser automation, or any other process that needs a URL to call. | | HttpInterceptor | Intercept fetch, http, https, and Axios inside the current Node process without starting a server. | | RemoteMockServer | Update a running standalone mock from Playwright, API tests, or external scripts. | | TypeScript defaults | Load reusable default mocks from a typed config file. | | OpenAPI / Swagger loading | Generate mock endpoints and sample responses from an API spec. | | Request matching | Match by method, headers, cookies, query, bearer token, and body. | | Response control | Return delays, templates, faults, sequences, and limited-use responses. | | Dashboard and admin APIs | Inspect mocks, requests, unmatched calls, and pending expectations. |

Live docs: https://toolstackhq.github.io/mockit/

Install:

npm install @toolstackhq/mockit

Choose A Runtime

Use MockServer when:

  • a browser, UI, or another process must call a real HTTP endpoint
  • you want a mock to stay running outside a test process
  • manual testers or QA automation need a stable fake backend

Use HttpInterceptor when:

  • the code under test already runs in Node
  • you want to fake outbound HTTP without starting a server
  • your Node code uses fetch, Axios, http, or https

Use RemoteMockServer when:

  • MockServer is already running
  • the test should change mock behavior without starting the server itself

Quick Start

Create a TypeScript config:

npx @toolstackhq/mockit init

In a terminal, init can either:

  • write the default starter config
  • ask a few questions and generate endpoints for you

Start a standalone mock:

npx @toolstackhq/mockit serve --config ./mockit.config.ts --port 3001

The dashboard is available at:

http://127.0.0.1:3001/_mockit

TypeScript Config Example

import { defineConfig } from '@toolstackhq/mockit';

export default defineConfig([
  {
    path: '/api/balance',
    method: 'GET',
    response: {
      status: 200,
      body: { balance: 200, currency: 'AUD' },
    },
  },
]);

In-Process Interceptor Example

Use HttpInterceptor when your code already runs in Node and you do not want to start a mock server.

import axios from 'axios';
import { HttpInterceptor } from '@toolstackhq/mockit';

const interceptor = new HttpInterceptor({ onUnhandled: 'fail' });

interceptor.expect('/api/users')
  .method('GET')
  .returns(200)
  .withBody([{ id: 1, name: 'Jane Doe' }]);

interceptor.enable();

const response = await axios.get('https://api.example.com/api/users');
console.log(response.data);

interceptor.disable();

The request still looks like a real outbound HTTP call, but MockIt returns the response inside the same Node process.

npm Script

{
  "scripts": {
    "mockit": "mockit serve --config ./mockit.config.ts --port 3001"
  }
}