type: decision
status: active
timestamp: 2026-06-20
tags: [decisions, architecture, testing, api-mock, msw, mockoon]

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

Two API-mock tools. MSW handles in-browser + in-Node test mocks (unit / Vitest, component stories, Playwright dev). Mockoon handles E2E + manual dev mocks of third-party APIs (Razorpay sandbox, Open-Meteo, Alpha Vantage when offline). Both free OSS. Different surfaces, different reasons.

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


Edit on GitHub · Back to index