Skip to content

Latest commit

 

History

History
64 lines (39 loc) · 2.15 KB

File metadata and controls

64 lines (39 loc) · 2.15 KB

Usage

Counterfact is three tools in one:

  • a code generator that converts an OpenAPI document to TypeScript route files
  • a mock server optimized for front-end development workflows
  • a live REPL for inspecting and manipulating server state at runtime

This page is your map to the documentation.


Getting started

New to Counterfact? Begin with the Getting Started guide for a step-by-step walkthrough.


Features

Feature Description
Generated code How Counterfact generates TypeScript from your OpenAPI spec
Routes Writing route handlers, building responses, reading request data
State (context objects) Sharing in-memory state across routes
Hot reload Live file updates without restarting the server
REPL Interactive terminal for runtime inspection and control
Proxy Mix real backend calls with mocked endpoints
Middleware Cross-cutting request/response logic
TypeScript native mode Run route files directly without a compilation step
Programmatic API Embed Counterfact in test suites with Playwright, Cypress, etc.
Without OpenAPI Use Counterfact without an OpenAPI document

Patterns

Patterns are reusable solutions to recurring problems when building API simulations.

See the patterns index for the full list.


Reference

Complete technical reference: the $ parameter API, CLI flags, architecture overview, and more.

Reference


FAQ

Common questions about state, types, hot reload, code generation, and regeneration.

FAQ


How it compares

Side-by-side comparison with json-server, WireMock, Prism, Microcks, and MSW.

How it compares