← learn
internals·8h · advanced · 7 lessons · 7 labs

Build a Reactivity Engine

From signals to DOM updates — build a mini reactivity library from scratch in vanilla JavaScript.

0 of 7 lessons complete

How labs work

  1. Follow the steps in the task panel.
  2. Edit the highlighted file — usually engine.js.
  3. Watch the preview update as you type.
  4. Run tests when you think you are done.
  5. Open hints if you get stuck — they reveal one at a time.

After this path

  • Implement dependency tracking and effect scheduling
  • Batch updates with microtask flushing
  • Build computed signals and a minimal render block
  • Ship a working todo app on your own engine

Lesson runbook

  1. Observable State

    45 min · guided lab

    Implement createSignal with get, set, and subscribe — the foundation of push-based reactivity.

    Continue here →
  2. Dependency Tracking

    50 min · guided lab

    Wire createEffect so signals automatically re-run effects when dependencies change.

  3. Effects and Cleanup

    55 min · guided lab

    Support cleanup callbacks and disposeEffect to prevent leaks and duplicate listeners.

  4. Batching and Scheduling

    50 min · guided lab

    Batch multiple signal writes into a single microtask flush of effects.

  5. Computed Signals

    55 min · guided lab

    Add lazy, cached createComputed that invalidates when dependencies change.

  6. Render Block

    60 min · guided lab

    Build createBlock and text() to bind signal values to DOM nodes.

  7. Capstone — Todo App

    90 min · guided lab

    Ship a todo app on your reactivity engine with add, toggle, remove, and empty state.