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

api-emulator

v0.5.2

Published

Local API emulators you can run, share, and extend with plugins

Readme

api-emulator is a local app store for fake APIs. Run GitHub, Stripe, Resend, and plugin powered providers on localhost, seed state, inspect behavior, reset data, and test your app in one place.

Why use it?

  • Test API integrations locally without real provider credentials.
  • Run multiple fake services together, with shared state, auth, webhooks, seed data, and resets.
  • Keep provider behavior in plugins so public, private, and internal APIs can live outside your app.

Quick start

npx -p api-emulator api
npx -p api-emulator api --service github,stripe,resend

Then point your app at the local provider URLs:

http://localhost:4000/github
http://localhost:4000/stripe
http://localhost:4000/resend

Use trusted local HTTPS names when your app needs browser compatible origins:

npx -p api-emulator api --service github,stripe,resend --portless
https://github.api-emulator.localhost
https://stripe.api-emulator.localhost
https://resend.api-emulator.localhost

Create starter config and list available services:

npx -p api-emulator api init
npx -p api-emulator api list

Use in tests

import { createEmulator } from 'api-emulator'

const github = await createEmulator({ service: 'github', port: 4001 })
process.env.GITHUB_API_BASE = github.url

afterEach(() => github.reset())
afterAll(() => github.close())

Capture and replay a stable fixture after a stochastic or stateful run:

const fixture = github.exportFixture({ metadata: { name: 'pull-request-flow' } })

github.resetToFixture(fixture)

Plugins

Install more providers from a public or internal plugin shelf:

npx -p api-emulator api install posthog
npx -p api-emulator api install pepper --no-package-manager

Or load a plugin file directly:

npx -p api-emulator api --plugin ./api-emulator-plugins/@posthog/api-emulator.mjs --service posthog

The installer auto discovers sibling api-emulator-plugins and api-emulator-internal checkouts. Set API_EMULATOR_PLUGIN_CATALOGS=/path/to/shelf,/path/to/internal to add more shelves.

A plugin exports a ServicePlugin:

import type { ServicePlugin } from '@api-emulator/core'

export const plugin: ServicePlugin = {
  name: 'internal-billing',
  register(app) {
    app.get('/v1/customers', (c) => c.json({ data: [] }))
  },
}

Next.js embedded mode

npm install @api-emulator/adapter-next @api-emulator/core
import { createEmulateHandler } from '@api-emulator/adapter-next'
import type { ServicePlugin } from '@api-emulator/core'

const internalPlugin: ServicePlugin = {
  name: 'internal',
  register(app) {
    app.get('/health', (c) => c.json({ ok: true }))
  },
}

export const { GET, POST, PUT, PATCH, DELETE } = createEmulateHandler({
  services: {
    internal: { emulator: { plugin: internalPlugin } },
  },
})

Configuration

npx -p api-emulator api init creates api-emulator.config.yaml.

tokens:
  test_token_admin:
    login: admin
    scopes: [repo, user]

github:
  users:
    - login: octocat
      name: The Octocat

The CLI auto-detects api-emulator.config.yaml, .yml, and .json. Older emulate.config.* and service-emulator.config.* names still work as migration aliases.

Examples

Development

bun install
bun run build
bun run format:check
bun run type-check
bun run lint
bun run test

Links

License

MIT