Skip to content

Latest commit

 

History

History
61 lines (41 loc) · 2.54 KB

File metadata and controls

61 lines (41 loc) · 2.54 KB

Counterfact


MIT License Coverage Status friction 0% Swagger 2.0 OpenAPI 3.0-3.2

Mock servers work—until you need state, failures, or control mid-run.

Static responses aren’t enough. There’s no shared state. You can’t inject failures. You can’t test real workflows.
Mock servers make it easy to get started, but hard to keep going.
Counterfact is an API simulator without those limits.

Point it at an OpenAPI document and get a live, stateful API in seconds. Supports Swagger 2.0 and OpenAPI 3.0, 3.1, and 3.2.

  • Type-safe TypeScript handlers for every endpoint
  • Hot reloading as you edit
  • Shared state across routes
  • A built-in REPL to control behavior at runtime
  • Optional proxying to real backends

Flexbile for humans. Stable for AI agents.

You’re in control—without restarting.

For a frontend developer waiting on a backend,
a test engineer who needs clean, reproducible state,
or an AI agent that needs a stable API

Real enough to be useful. Fake enough to be usable.

Try it now

npx counterfact@latest https://petstore3.swagger.io/api/v3/openapi.json api

Starts a local server with a live REPL to inspect and control API behavior
Requires Node ≥ 22.0.0

Go deeper

  • Getting started – Detailed walkthrough with state, REPL, and proxy
  • Patterns – How Counterfact transforms your workflow
  • Example repo – Using Counterfact to implement the Swagger Petstore
  • How it compares – json-server, WireMock, Prism, Microcks, MSW
  • Usage – Explore features and how to use them
  • Reference$ API, CLI flags, architecture
  • FAQ – State, types, regeneration