Skip to content

You need Node.js 22.12 or later and an OpenAPI 3.0, 3.1 or 3.2 file.

npm install -D @rapidoc/cli @rapidoc/mock
npx rapidoc mock openapi.yaml --stateful

The server listens on http://localhost:4010 and serves each API under its own path, named after the file: openapi.yaml is served at http://localhost:4010/openapi. It prints what it found:

• State: openapi: 3 resource(s), 30 record(s). Operations: 14 stateful, 2 needs review, 3 static
• Mock UI: http://localhost:4010/__mock/ui
curl -X POST localhost:4010/openapi/pets -H "Content-Type: application/json" -d '{"name":"Biscuit"}'
curl localhost:4010/openapi/pets

The second call lists the seeded pets and the one you created.

Open http://localhost:4010/__mock/ui to see the records and what the mock does for each operation. See the Mock UI tour.

npx rapidoc mock orders.yaml billing.yaml # /orders and /billing
npx rapidoc mock ./specs --port 4011 # every OpenAPI file in the folder
npx rapidoc mock # in a portal folder: the local specs under apis:

When two files would get the same name, their parent folders are added until the names differ (billing-v1/openapi.yaml becomes /billing-v1-openapi). The mapping is printed at start, and GET / lists the APIs served.

Leave out --stateful and every call is answered on its own, from examples or generated data. Request validation and token checks work the same. See What it answers.