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.
- 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.
npx counterfact@latest https://petstore3.swagger.io/api/v3/openapi.json apiStarts a local server with a live REPL to inspect and control API behavior
Requires Node ≥ 22.0.0
- 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