← knowledge.oriz.in

API mocks — MSW (in-process) + Mockoon (out-of-process), split by surface

decision decisionsarchitecturetestingapi-mockmswmockoon

API mocks — MSW + Mockoon, split by surface

Decision

Two API-mock tools, one per surface — same posture as the AI split between Puter.js and Cloudflare Workers AI: different surfaces, different tools, no overlap.

  1. In-process mocksMSW (Mock Service Worker). Service-Worker based in the browser; Node interceptor in tests. Used for Vitest unit / integration suites, Storybook stories that need network responses, and pnpm dev when the developer wants the app to talk to a deterministic stub instead of a live upstream.
  2. Out-of-process mocksMockoon. Free OSS desktop app + headless CLI. Used for E2E ( Playwright) suites against third-party APIs the family doesn't own (Razorpay sandbox, Open-Meteo, Alpha Vantage when offline / quota-conscious), and for manual exploratory work.

Both free, both OSS, both no card.

Why

Implications

Where each lives

@chirag127/oriz-kit/testing/
+-- msw/
¦   +-- handlers.ts          ? shared MSW handlers (Razorpay sandbox, Hono RPC, Firestore REST)
¦   +-- server.ts            ? Node-side `setupServer()` for Vitest
¦   +-- browser.ts           ? Service-Worker `setupWorker()` for Storybook + dev
+-- mockoon/
¦   +-- razorpay.json        ? Mockoon environment file — Razorpay sandbox endpoints
¦   +-- open-meteo.json      ? weather data API — used when offline
¦   +-- alpha-vantage.json   ? finance data API — used when offline / quota-conscious
¦   +-- README.md

Per-site mocks/ directory only carries site-specific handlers; the shared core ships from oriz-kit.

MSW surfaces

Mockoon surfaces

What we don't mock with these

What we don't add

Per-PR gating

Cross-refs