Skip to content

Tutorial

Eleven short chapters. Each isolates one feature, simplest first. Code in every chapter mirrors a working example in examples/ — clone the repo or open the chapter live in StackBlitz.

#ChapterFeature
01Data listdata: T[] → free CRUD
02Data filesdataFile + file<T> + hot-reload
03Cross-endpointctx.endpoint(url) joins
04Handlers + zodhandler({ body, query, params, fn })
05Middlewarelogger / delay / auth + custom post
06Scenariosnamed server states
07Multi-methodmethods: { GET, POST, ... }
08Proxypassthrough to upstream
09ctx.forward()forward + mutate
10Everythingcomposed showcase
11WebSocketws({...}) + WsHandle.broadcast

Setup once

bash
npm install @yoyo-org/mockr zod

Add "type": "module" to package.json. Run any chapter's server with:

bash
npx tsx server.ts

For dev work use tsx watch — saves to the server file or imported mock groups respawn the process.

Read the chapters in order

Each chapter is self-contained but builds on vocabulary from the prior one. Skim 01–03 to absorb the data model; jump to whichever later chapter matches the feature you need.

MIT License