Free CRUD from data
`data: T[]` becomes a list endpoint with GET/POST/PUT/PATCH/DELETE. `data: T` becomes a record endpoint. Mutations persist in memory.
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.
npm install @yoyo-org/mockr zod
npx tsx mock.tsimport { 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.