User manual

Find your workflow

Counterfact starts with an OpenAPI document, a local URL, and generated responses. Choose the next guide by the job your frontend, team, or test suite needs—not by a feature checklist.

New to the terminology? Read How Counterfact fits together, including what an API group shares.

For feature explanations, use the user manual. For exact options and signatures, use the API reference.

Frontend workflows

Team and test workflows

Advanced control

Reference and troubleshooting

  • API reference — CLI flags, response builders, the $ parameter, and architecture.
  • FAQ — state, validation, type safety, and regeneration questions.
  • How Counterfact compares — comparison with json-server, WireMock, Prism, Microcks, and MSW.
  • Without OpenAPI — the alternative path when no OpenAPI document exists.

Telemetry and privacy

Counterfact sends usage events to PostHog: startup options, hot-reload change categories (route/context/OpenAPI), and REPL command names. Events include the Node.js version, operating system, and architecture; startup events also include the Counterfact version and a subset of resolved options such as port and enabled actions. API file locations are SHA-256 hashed before sending. REPL command arguments are not included in these events.

To disable Counterfact telemetry, set COUNTERFACT_TELEMETRY_DISABLED=true before starting the process. For example, in a POSIX shell:

export COUNTERFACT_TELEMETRY_DISABLED=true
npx counterfact@latest ./openapi.yaml api

In PowerShell, use $env:COUNTERFACT_TELEMETRY_DISABLED = "true" before the command. Telemetry is also disabled when the CI environment variable is set. This switch controls Counterfact process telemetry; it does not configure analytics on this website.

See Feedback, Telemetry, and Privacy for the project discussion.