New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

interceptr

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

interceptr

Local HTTP proxy for mocking, intercepting and delaying API calls. Import OpenAPI/Swagger specs and control every endpoint from a browser UI — no code changes needed.

latest
Source
npmnpm
Version
1.6.1
Version published
Maintainers
1
Created
Source

Interceptr

release status npm version npm downloads Node.js version MIT license

A local HTTP proxy for mocking, intercepting, and delaying API calls — with a browser-based UI.

Import your OpenAPI / Swagger spec, control each endpoint individually (pass, delay, mock, or both), and watch live traffic in real time. No code changes. No config files. Just run it and point your app at the proxy.

Quick Start

npx interceptr

Then open http://localhost:3001 in your browser. Point your app (or Postman, curl, etc.) at http://localhost:4000 — traffic will be intercepted and handled based on your settings.

# Install globally
npm install -g interceptr
interceptr --port 3001

CLI Options

FlagAliasDefaultDescription
--port-p3001Port for the management UI and API

What Is It For?

Interceptr runs as a local reverse proxy that sits between your frontend (or any HTTP client) and your real backend. Once your OpenAPI/Swagger spec is imported, you can control every endpoint without touching your application code:

  • Frontend dev without a backend — mock any endpoint with a custom JSON response
  • Simulate slow networks — inject configurable latency per endpoint
  • Test error handling — force 4xx/5xx responses on demand
  • Switch environments instantly — toggle between local, staging, or mock mode per endpoint
  • Debug API issues — inspect full request/response cycles in the live traffic monitor

Features

  • OpenAPI / Swagger Import — Load specs from a URL or file upload. Supports OpenAPI 3.0 and 3.1, JSON and YAML. Mock responses are auto-populated from spec examples.
  • Per-Endpoint Proxy Modes — Choose Pass (forward to upstream), Delay (inject latency + jitter), Mock (serve custom response), or Delay + Mock (mock response with simulated latency) for each endpoint individually. Delay and Mock can be combined by activating both buttons simultaneously.
  • Group Actions — Apply a mode to all endpoints in a tag group at once.
  • Live Traffic Monitor — Watch request/response cycles in real time. Filter by method, status code, or proxy mode. Click any entry to inspect headers and JSON body.
  • Presets — Save and restore full endpoint configurations. Built-in actions: Pass All, Slow All, Error All.
  • Multi-Project & Multi-Spec — Organize work into projects. Toggle multiple specs (e.g., local + staging) simultaneously.
  • Global Response Headers — Inject headers (e.g., CORS) across all responses for a spec, overridable per endpoint. Optionally extend injection to all proxied requests — including those not in the endpoint registry — via the "Apply to all requests" toggle.
  • Conditional Rules — Define per-request overrides based on request count, random failure rate, or header matching.
  • No Config Files — Everything is managed from the web UI and persisted automatically as JSON.
  • Theme Support — Dark mode (Midnight Blue) and high-contrast light mode.

Usage

1. Import a Spec

Click Select Spec in the header → + → paste a URL (e.g. https://petstore.swagger.io/v2/swagger.json) or upload a .json / .yaml file.

2. Configure Endpoints

The Endpoints Registry lists every operation from your spec, grouped by tag.

ModeBehavior
PassForwards the request to the upstream server unchanged.
DelaySimulates latency. Configure milliseconds and optional jitter.
MockReturns a custom response. Use spec-defined examples or write your own JSON.
Delay + MockReturns a mock response after the configured delay. Activate by clicking both the Delay and Mock buttons simultaneously.

Click an endpoint to open the editor. Use group action buttons (Pass / Delay / Mock) above each tag group to apply a mode to all endpoints at once.

3. Monitor Traffic

The Traffic Monitor (right panel) streams every request in real time. Click any entry to inspect the full request/response — headers, status code, body, and matched endpoint.

4. Use Presets

The Preset Bar lets you save and restore complete endpoint configurations. Built-in quick actions:

  • Pass All — Instant bypass for all endpoints
  • Slow — Set all endpoints to 2000 ms delay
  • Errors — Set all endpoints to return 500

5. Point Your App at the Proxy

Set your app's base URL (or HTTP_PROXY / HTTPS_PROXY env var) to http://localhost:4000. All matching traffic will be intercepted.

Architecture

┌─────────────────────────────────────────────┐
│                  pnpm monorepo              │
├──────────────┬──────────────┬───────────────┤
│  apps/server │  apps/web    │ packages/     │
│              │              │   shared      │
│  Hono API    │  React 19    │  TypeScript   │
│  :3001       │  Vite :5173  │  types        │
│              │              │               │
│  Proxy       │  Tailwind v4 │               │
│  :4000       │  TanStack    │               │
└──────────────┴──────────────┴───────────────┘
ComponentStack
Management APIHono on port 3001
Proxy ServerHono on port 4000
FrontendReact 19, Vite, Tailwind v4, TanStack Query, React Router v7
StorageJSON files in data/
Live FeedServer-Sent Events (SSE)
TestingVitest, Testing Library

API Reference

The management API runs on port 3001. All endpoints are prefixed with /api.

Projects

MethodPathDescription
GET/projectsList all projects
POST/projectsCreate a project (body: {name})
GET/projects/activeGet active project with specs
PUT/projects/activeSwitch active project (body: {projectId})
PUT/projects/:idRename a project (body: {name})
DELETE/projects/:idDelete a project

Specs

MethodPathDescription
GET/specsList specs in the active project
POST/specsUpload a spec (body: {spec, name, upstreamUrl?})
POST/specs/urlImport a spec from URL (body: {url, name})
POST/specs/:id/reimportReimport from source URL or new body
PUT/specs/:idUpdate spec metadata (body: {name?, upstreamUrl?, active?, globalHeaders?, applyGlobalHeadersToAll?})
PUT/specs/:id/toggleToggle spec active state
DELETE/specs/:idDelete a spec

Endpoints

MethodPathDescription
GET/endpointsList endpoints (query: ?specId=...)
PUT/endpoints/:idUpdate endpoint config
PUT/endpoints/bulkBulk update endpoints (body: {[id]: Partial<EndpointConfig>})

The endpoint config supports a conditionalRules array for request-time overrides. Each rule has a type of nth-request, random-failure, or header-match, and a response served when triggered.

Presets

MethodPathDescription
GET/presetsList saved presets
POST/presetsSave a preset (body: {name, description?, endpoints})
DELETE/presets/:nameDelete a preset
POST/presets/:name/applyApply a preset to all endpoints

Logs

MethodPathDescription
GET/logsFetch recent logs (query: ?limit=100)
GET/logs/streamSSE stream for live logs
DELETE/logsClear all logs

Proxy

MethodPathDescription
GET/proxy/statusProxy running status ({running, port})
POST/proxy/startStart the proxy server
POST/proxy/stopStop the proxy server

Config

MethodPathDescription
GET/configGet global config
PUT/configUpdate global config (body: {proxyPort?})
GET/config/exportExport all data as JSON
POST/config/importImport configuration from JSON

Health

MethodPathDescription
GET/healthHealth check — returns {status: "ok", version}

Data Storage

All data is stored as JSON files in the data/ directory:

data/
  global.json          # Global config + project list
  logs.json            # Activity logs (500-entry ring buffer)
  projects/
    <project-id>.json  # Specs, endpoints, and presets per project

Writes are debounced (1 second) to avoid excessive disk I/O.

Development

Prerequisites

  • Node.js >= 22
  • pnpm >= 10

Install & Run

pnpm install
pnpm dev

Starts:

Test

pnpm test

Build

pnpm build && pnpm start

License

MIT

Keywords

api

FAQs

Package last updated on 04 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts