Skip to content

mockrMock API server for frontend prototyping

Define endpoints, get full CRUD for free. Mock the routes you're building, proxy the rest to a real backend. Record traffic from the Chrome extension and map it to local files.

Quick start

bash
npm install @yoyo-org/mockr zod
npx tsx mock.ts
ts
import { mockr, mockGroup } from '@yoyo-org/mockr';

type Endpoints = { '/api/todos': { id: number; title: string; done: boolean }[] };

const todos = mockGroup<Endpoints>()
  .data('/api/todos', [{ id: 1, title: 'Buy milk', done: false }])
  .done();

await mockr({ port: 4000, groups: [todos] });

That's it. GET /api/todos returns the array. POST /api/todos inserts. PATCH /api/todos/1 updates. DELETE /api/todos/1 removes. No glue code.

Continue with the tutorial →

MIT License