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.
| # | Chapter | Feature |
|---|---|---|
| 01 | Data list | data: T[] → free CRUD |
| 02 | Data files | dataFile + file<T> + hot-reload |
| 03 | Cross-endpoint | ctx.endpoint(url) joins |
| 04 | Handlers + zod | handler({ body, query, params, fn }) |
| 05 | Middleware | logger / delay / auth + custom post |
| 06 | Scenarios | named server states |
| 07 | Multi-method | methods: { GET, POST, ... } |
| 08 | Proxy | passthrough to upstream |
| 09 | ctx.forward() | forward + mutate |
| 10 | Everything | composed showcase |
| 11 | WebSocket | ws({...}) + WsHandle.broadcast |
Setup once
bash
npm install @yoyo-org/mockr zodAdd "type": "module" to package.json. Run any chapter's server with:
bash
npx tsx server.tsFor 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.