apifae
v0.6.0
Published
Mock HTTP APIs locally and keep the mocks honest as the API changes
Downloads
738
Maintainers
Readme
apifae
APIFae mocks the HTTP APIs your code depends on, and tells you when those mocks stop matching the real API.
A mock is written once, but the API it stands in for keeps changing. Tests that use the mock go on passing against responses the API no longer sends. APIFae is built to catch that:
apifae initreads an OpenAPI 3.x or Swagger spec and writes one mock per documented path, as YAML files you commit.apifae recordcan build them from a real API's traffic instead.apifae upserves the mocks on your machine or in CI. Edit a mock and the next request reflects it.apifae diff <url>compares each mock with the live API. It exits 1 when a mock has drifted and 2 when it can't reach the API, so a CI job can tell drift from an outage. It needs no spec; given one, it also checks the API against it.apifae patch <url>writes whatdifffound back into your mocks.
APIFae is a single native binary, so there is no runtime to install first. The CLI is free and will stay free.
Install
npx apifae --version # try it without installing
npm install --global apifae # or keep itThis package has no binary of its own. It lists five platform packages as
optional dependencies (@apifae/darwin-arm64, @apifae/darwin-x64,
@apifae/linux-arm64, @apifae/linux-x64 and @apifae/win32-x64), and npm
installs the one that matches your machine. Nothing is downloaded after
install and there is no install script, so npm install --ignore-scripts
works too.
Learn more
Guides, the command reference and the other ways to install (Homebrew, Scoop and a shell script) are at https://apifae.com.
Closed source; binaries under MIT or Apache-2.0.
