Skip to content

Mocking GUIEvery state your API can return

Empty lists, expired sessions, the 500 that only shows up in production. Switch between them from a panel inside your running app — no server to start, no database to seed, no code to change.

Get it running ​

Three steps, and the panel is in your app. The Installation guide covers Next.js, SSR and the parts this page leaves out.

1. Install ​

bash
pnpm add -D @kakaocloud/mocking-gui

2. Add MSW's service worker ​

bash
npx msw init public

3. Declare an endpoint, and mount the panel ​

tsx
// config.ts
import type { MockingConfig } from '@kakaocloud/mocking-gui';

export const mockConfig: MockingConfig = {
  mocks: [
    {
      name: 'Get User',
      url: '/api/user',
      method: 'get',
      responseVariants: [
        { name: 'Success', status: 200, body: { id: 1, name: 'John Doe' } },
        { name: 'Empty', status: 200, body: null },
        { name: 'Server error', status: 500, body: { message: 'Something went wrong' } },
      ],
    },
  ],
};
tsx
// App.tsx — the dev check matters: without it the panel ships to production.
import { MockingGUIBoundary } from '@kakaocloud/mocking-gui/browser';
import { mockConfig } from './config';

const IS_DEV = import.meta.env.DEV;

function App() {
  const content = <AppContent />;

  return IS_DEV ? <MockingGUIBoundary config={mockConfig}>{content}</MockingGUIBoundary> : content;
}

Reload, and GET /api/user is a row in the panel. Switch it on, pick which of the three responses it returns, give it a two-second delay — the screen follows, and nothing in your code moved.

Read the documentation →

Start from a working example ​

Released under the MIT License.