<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Dennis Bruijn's blog</title>
    <link>https://www.0x1ad2.dev/blog</link>
    <description>Writing about agent-driven workflows, native apps, React, Node.js, testing and the craft of building software that lasts.</description>
    <language>en</language>
    <atom:link href="https://www.0x1ad2.dev/feed.xml" rel="self" type="application/rss+xml" />
    <lastBuildDate>Wed, 25 Nov 2026 00:00:00 GMT</lastBuildDate>
    <item>
      <title>🐦‍⬛ Crow: a card scanner that knows what your binder is worth</title>
      <link>https://www.0x1ad2.dev/blog/crow</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/crow</guid>
      <pubDate>Wed, 25 Nov 2026 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>Crow scans a card on your phone, prices it and files it in a binder, then keeps the whole collection in sync across iPhone, iPad, Android and a desktop dashboard. It runs on its own crawled catalog and works offline first.</description>
      <category>projects</category>
      <category>cross-platform</category>
      <category>swift</category>
      <category>kotlin</category>
      <category>supabase</category>
      <content:encoded><![CDATA[<p>Crows have a reputation for hoarding shiny things, and Crow&#x27;s own site leans right into it: <em>collect your shiny things</em>. The idea is simple. You point the camera at a card, Crow tells you what it is and what it&#x27;s worth, and the card ends up in a binder you can browse on your phone, your tablet or a big screen. It covers five games: Magic, Pokémon, Lorcana, One Piece and Yu-Gi-Oh!.</p>
<p>The simple version grew into a monorepo with a SwiftUI app, a Kotlin port, a React dashboard, a Supabase back-end, a Python crawler and two Rust crates. This post walks through it: what Crow does, how the pieces fit, and what isn&#x27;t there yet.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/crow/hero.webp" alt="Three of Crow&#x27;s own card illustrations on a Night Sky backdrop with a foil glow, beside two iPhones showing Binders and Home"/></p>
<p><em>The hero is composed in Montage from Crow&#x27;s own card illustrations.</em></p>
<p>If you&#x27;d rather watch than read, here&#x27;s the 33.5-second explainer:</p>
<p><a href="https://www.0x1ad2.dev/images/projects/crow/explainer.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/crow/explainer-poster.webp" alt="Watch the Crow explainer: Crowie with fanned cards and the line &quot;Collect your shiny things.&quot;"/></a></p>
<p><em>Made with Montage. All data in it is synthetic, and the card art is Crow&#x27;s own illustration set.</em></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/crow/crowie.webp" alt="Crowie, the crowned crow mascot, holding three trading cards"/></p>
<p><em>Meet Crowie, the crowned mascot. You&#x27;ll see the crown again.</em></p>
<h2>A scanner that agrees with the crawler, bit for bit</h2>
<p>The camera scanner is the front door, and recognition runs <strong>on the device</strong>. The card fingerprint the phone computes is bit-identical to the one the crawler computes when it builds the catalog. The shared piece is a Rust image core, <code>crates/crow-image-core</code>. What the phone sees and what the catalog stored are computed the same way, down to the bit.</p>
<p>A scan session goes like this:</p>
<ol>
<li>Point the camera at a card. Crow names the printing, shows its price and adds it to the session.</li>
<li>Keep going. The rail counts the cards and the session total adds up their value.</li>
<li>Tap <strong>Add to</strong> and the confirmed cards go into a binder, a list or a deck in one step.</li>
</ol>
<p>Each card also plays a sound. You pick one per value range: under 1, 1 to 9.99, 10 to 19.99, 20 to 99.99, 100 and up, plus one for a card that has no price yet. Your ears know whether that card was worth the scan before you&#x27;ve looked at the screen.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/crow/scan-streak.webp" alt="Left: the scan streak, three synthetic cards locking under the gold reticle while the price counts up. Right: a scan session on the iPhone with three scanned cards, one to confirm"/></p>
<p><em>Left: the scan streak, rebuilt from the SwiftUI scanner in Montage with synthetic cards. Right: a real capture of a scan session on the iPhone.</em></p>
<p>Here&#x27;s a toy version of that loop to play with. It&#x27;s a few lines of HTML and not Crow&#x27;s code: the value ranges come from the README, the beeps stand in for Crow&#x27;s caw sound pack, and the prices are made up (the first three match the synthetic cards in the GIF above). Click <strong>Scan next card</strong> a few times and edit the numbers if you like.</p>
<pre><code class="language-html-live">&lt;style&gt;
  :root { --crown: #FFB71A; --bg: #0B0A11; --card: #151519; --line: #2C2C33; --text: #F8F7F4; --muted: #9a99a6; }
  * { box-sizing: border-box; }
  body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, sans-serif; padding: 16px; }
  .wrap { display: grid; gap: 12px; max-width: 420px; margin: auto; }
  .viewfinder { position: relative; height: 160px; border: 1px solid var(--line); border-radius: 14px; display: grid; place-items: center; overflow: hidden; }
  .reticle { width: 84px; height: 116px; border: 2px dashed var(--muted); border-radius: 8px; transition: border-color .2s, box-shadow .2s, transform .2s; }
  .reticle.lock { border: 2px solid var(--crown); box-shadow: 0 0 24px rgb(255 183 26 / .45); transform: scale(1.04); }
  .price { position: absolute; bottom: 10px; font: 600 22px ui-monospace, monospace; }
  .tier { position: absolute; top: 10px; right: 10px; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); }
  .row { display: flex; gap: 8px; }
  button { flex: 1; background: var(--crown); color: #0F0E16; border: 0; border-radius: 10px; padding: 10px; font-weight: 600; cursor: pointer; }
  button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
  .rail { display: flex; gap: 6px; min-height: 30px; flex-wrap: wrap; }
  .chip { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font: 12px ui-monospace, monospace; animation: drop .3s ease-out; }
  @keyframes drop { from { transform: translateY(-12px); opacity: 0; } }
  .total { display: flex; justify-content: space-between; color: var(--muted); }
  .total b { color: var(--text); }
  @media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
&lt;/style&gt;
&lt;div class=&quot;wrap&quot;&gt;
  &lt;div class=&quot;viewfinder&quot;&gt;
    &lt;div class=&quot;reticle&quot; id=&quot;reticle&quot;&gt;&lt;/div&gt;
    &lt;span class=&quot;tier&quot; id=&quot;tier&quot;&gt;ready&lt;/span&gt;
    &lt;span class=&quot;price&quot; id=&quot;price&quot;&gt;€0.00&lt;/span&gt;
  &lt;/div&gt;
  &lt;div class=&quot;row&quot;&gt;&lt;button id=&quot;scan&quot;&gt;Scan next card&lt;/button&gt;&lt;button class=&quot;ghost&quot; id=&quot;clear&quot;&gt;Clear&lt;/button&gt;&lt;/div&gt;
  &lt;div class=&quot;rail&quot; id=&quot;rail&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;total&quot;&gt;&lt;span id=&quot;count&quot;&gt;0 cards&lt;/span&gt;&lt;span&gt;Session total &lt;b id=&quot;sum&quot;&gt;€0.00&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;script&gt;
  // Made-up prices; null is a card with no price yet.
  const deck = [0.60, 7.40, 48.20, 12.50, 134.00, null, 3.10];
  // The five value ranges from Crow&#x27;s README, each with its own (stand-in) beep.
  const tiers = [[1, &#x27;under 1&#x27;, 220], [10, &#x27;1 to 9.99&#x27;, 330], [20, &#x27;10 to 19.99&#x27;, 440], [100, &#x27;20 to 99.99&#x27;, 550], [Infinity, &#x27;100 and up&#x27;, 880]];
  const $ = (id) =&gt; document.getElementById(id);
  const fmt = (v) =&gt; &#x27;€&#x27; + v.toFixed(2);
  let next = 0, sum = 0, count = 0, audio;

  function tierOf(value) {
    if (value === null) return [&#x27;no price yet&#x27;, 160];
    const [, label, freq] = tiers.find(([max]) =&gt; value &lt; max);
    return [label, freq];
  }

  function beep(freq) {
    try {
      audio = audio || new AudioContext();
      const osc = audio.createOscillator(), gain = audio.createGain();
      osc.frequency.value = freq;
      gain.gain.setValueAtTime(0.08, audio.currentTime);
      gain.gain.exponentialRampToValueAtTime(0.0001, audio.currentTime + 0.25);
      osc.connect(gain).connect(audio.destination);
      osc.start();
      osc.stop(audio.currentTime + 0.25);
    } catch (e) { /* no sound, no problem */ }
  }

  $(&#x27;scan&#x27;).onclick = () =&gt; {
    const value = deck[next++ % deck.length];
    const [label, freq] = tierOf(value);
    $(&#x27;reticle&#x27;).classList.add(&#x27;lock&#x27;);
    $(&#x27;tier&#x27;).textContent = label;
    beep(freq);
    const start = performance.now();
    (function countUp(now) {
      const k = Math.min(1, (now - start) / 600);
      $(&#x27;price&#x27;).textContent = value === null ? &#x27;—&#x27; : fmt(value * k);
      if (k &lt; 1) return requestAnimationFrame(countUp);
      count += 1;
      sum += value ?? 0;
      const chip = document.createElement(&#x27;span&#x27;);
      chip.className = &#x27;chip&#x27;;
      chip.textContent = value === null ? &#x27;no price&#x27; : fmt(value);
      $(&#x27;rail&#x27;).prepend(chip);
      $(&#x27;count&#x27;).textContent = count + (count === 1 ? &#x27; card&#x27; : &#x27; cards&#x27;);
      $(&#x27;sum&#x27;).textContent = fmt(sum);
      setTimeout(() =&gt; $(&#x27;reticle&#x27;).classList.remove(&#x27;lock&#x27;), 250);
    })(start);
  };

  $(&#x27;clear&#x27;).onclick = () =&gt; {
    next = 0; sum = 0; count = 0;
    $(&#x27;rail&#x27;).innerHTML = &#x27;&#x27;;
    $(&#x27;count&#x27;).textContent = &#x27;0 cards&#x27;;
    $(&#x27;sum&#x27;).textContent = &#x27;€0.00&#x27;;
    $(&#x27;price&#x27;).textContent = &#x27;€0.00&#x27;;
    $(&#x27;tier&#x27;).textContent = &#x27;ready&#x27;;
  };
&lt;/script&gt;
</code></pre>
<p>Two practical notes from the README. Camera frames never leave the phone: the scanner recognizes cards locally and never stores or sends a frame. And scanning needs a real camera, so the simulators and the dashboard can&#x27;t scan. The dashboard reviews scan sessions instead, and an Android phone without a camera can still scan photos.</p>
<h2>Offline first, with a database per game in your pocket</h2>
<p>Card shops, conventions and kitchen tables don&#x27;t always have good Wi-Fi, so search and scanning don&#x27;t need it. Each game comes as a <strong>snapshot database</strong> (GRDB on top of SQLite FTS5), and search runs against that local copy. You pick the games you collect in <strong>Settings › Offline catalog</strong>, and from then on search and scanning work without a connection.</p>
<p>Writes are handled with the same care. The phones change the collection only through <strong>queued mutations</strong>, which sync with Supabase when there&#x27;s a connection, conflicts included. Row-level security in Postgres keeps each account&#x27;s rows to itself.</p>
<p>The README draws the whole flow as one diagram, redrawn here in plain text:</p>
<pre><code class="language-text">Free card sources (data, prices, images)
        │
        ▼
Crawler (Python + Scrapy)
        │
        ▼
Supabase (Postgres 17 + Storage) ◄────► Dashboard (React 19) ──► Marketplace adapters (simulated)
        │             ▲
        ▼             │ queued sync
Per-game snapshots    │
(SQLite FTS5)         │
        │             │
        ▼             │
iPhone · iPad · Android (offline first)
</code></pre>
<h3>Its own catalog, crawled politely</h3>
<p>Crow doesn&#x27;t borrow someone else&#x27;s catalog. Card data, prices and images are crawled politely from free sources into Crow&#x27;s own Supabase. A Scrapy spider fetches a source, a normalizer validates the items, the images are mirrored into the <code>card-images</code> storage bucket and the rows are upserted with deterministic ids, followed by prices and a daily snapshot. Primary sources own a game, and enrichment sources only add to it. When that&#x27;s done, the crawler publishes the per-game snapshot the phones fetch.</p>
<p>The five games come from a single list that every app, the back-end, the crawler and <code>crow-cli</code> build on. Adding a game means adding it to that list, without touching the core collection code. This is the <code>supported</code> part of <code>packages/types/src/games.json</code>:</p>
<pre><code class="language-json">&quot;supported&quot;: [
  { &quot;id&quot;: &quot;mtg&quot;, &quot;name&quot;: &quot;Magic: The Gathering&quot; },
  { &quot;id&quot;: &quot;pokemon&quot;, &quot;name&quot;: &quot;Pokémon&quot; },
  { &quot;id&quot;: &quot;lorcana&quot;, &quot;name&quot;: &quot;Disney Lorcana&quot; },
  { &quot;id&quot;: &quot;onepiece&quot;, &quot;name&quot;: &quot;One Piece Card Game&quot; },
  { &quot;id&quot;: &quot;yugioh&quot;, &quot;name&quot;: &quot;Yu-Gi-Oh!&quot; }
]
</code></pre>
<h2>Binders, prices and a screen that changes color</h2>
<p>Once the cards are in, the fun starts. You keep them in <strong>binders</strong> and lists, see what each binder is worth, and track how complete every set is in <strong>Collector mode</strong>. Home shows your most valuable cards and what you looked at last.</p>
<p>Prices come from <strong>one resolver</strong> that prices every copy and printing in your account&#x27;s currency, on every platform. That gives you value over time, value by set and a shelf of your most valuable cards.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/crow/iphone-screens.webp" alt="Three iPhone screens side by side: Home with the most valuable cards, Collection with the binders and their values, and a Lorcana binder as a grid of cards with prices"/></p>
<p><em>Home, Collection and a binder on the iPhone. Real captures of the app, signed in as a showcase account.</em></p>
<h3>Match game</h3>
<p>This is my favorite small detail. With the default accent, Crow takes the color of <strong>the game you&#x27;re browsing</strong>. The game switcher at the top of the screen changes the game, and its accent spreads out of the switcher button and recolors the whole screen. If you&#x27;d rather keep one color, there are five fixed accents: gold, coral, lavender, mint and blue.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/crow/match-game.webp" alt="The iPhone Home screen three times side by side, recolored by the Magic, Pokémon and Lorcana accents"/></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/crow/match-game-loop.webp" alt="The game switcher on Home picking All Games, Magic, Pokémon, Lorcana, One Piece and Yu-Gi-Oh! in turn, each game&#x27;s accent spreading from the switcher button over the screen"/></p>
<p><em>The game switcher recoloring Home, rebuilt from the SwiftUI source in Montage with synthetic cards.</em></p>
<p>Below is a toy version that uses Crow&#x27;s real dark-mode accent tokens, with the crown gold for All Games. Pick a game and watch the color spread out of the switcher:</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; background: #0B0A11; color: #F8F7F4; font: 14px/1.4 system-ui, sans-serif; padding: 16px; }
  .phone { --a: #FFB71A; position: relative; max-width: 300px; margin: 0 auto 14px; border: 1px solid #2C2C33; border-radius: 28px; padding: 18px; overflow: hidden; }
  .washes { position: absolute; inset: 0; z-index: 0; }
  .wash { position: absolute; inset: 0; background: color-mix(in oklab, var(--c) 18%, #0B0A11); clip-path: circle(0 at var(--x) var(--y)); transition: clip-path .6s ease-out; }
  .wash.on { clip-path: circle(150% at var(--x) var(--y)); }
  .content { position: relative; z-index: 1; display: grid; gap: 12px; }
  .top { display: flex; justify-content: space-between; align-items: center; }
  .logo { font-weight: 800; color: var(--a); transition: color .4s; }
  #switcher { background: var(--a); color: #0F0E16; border: 0; border-radius: 99px; padding: 4px 12px; font-weight: 600; transition: background .4s; }
  h4 { margin: 0; color: var(--a); transition: color .4s; }
  .cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .cards span { aspect-ratio: 5 / 7; border-radius: 6px; border: 2px solid var(--a); background: #151519; transition: border-color .4s; }
  .bar { height: 8px; border-radius: 99px; background: #2C2C33; overflow: hidden; }
  .bar i { display: block; height: 100%; width: 64%; background: var(--a); transition: background .4s; }
  .picks { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
  .picks button { background: transparent; color: #F8F7F4; border: 1px solid var(--c); border-radius: 99px; padding: 4px 10px; cursor: pointer; }
  @media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
&lt;/style&gt;
&lt;div class=&quot;phone&quot; id=&quot;phone&quot;&gt;
  &lt;div class=&quot;washes&quot; id=&quot;washes&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;content&quot;&gt;
    &lt;div class=&quot;top&quot;&gt;&lt;span class=&quot;logo&quot;&gt;Crow&lt;/span&gt;&lt;button id=&quot;switcher&quot;&gt;All Games ▾&lt;/button&gt;&lt;/div&gt;
    &lt;div&gt;Hello, Crow Collector.&lt;/div&gt;
    &lt;h4&gt;Most valuable cards&lt;/h4&gt;
    &lt;div class=&quot;cards&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
    &lt;div&gt;Collection value&lt;/div&gt;
    &lt;div class=&quot;bar&quot;&gt;&lt;i&gt;&lt;/i&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;picks&quot; id=&quot;picks&quot;&gt;&lt;/div&gt;
&lt;script&gt;
  // Crow&#x27;s dark-mode accents: the crown gold for All Games, then each game&#x27;s accent token.
  const games = [
    [&#x27;All Games&#x27;, &#x27;#FFB71A&#x27;], [&#x27;Magic&#x27;, &#x27;#E8A75A&#x27;], [&#x27;Pokémon&#x27;, &#x27;#FF7A6E&#x27;],
    [&#x27;Lorcana&#x27;, &#x27;#9CA9FF&#x27;], [&#x27;One Piece&#x27;, &#x27;#CDA2F0&#x27;], [&#x27;Yu-Gi-Oh!&#x27;, &#x27;#F58BBE&#x27;],
  ];
  const phone = document.getElementById(&#x27;phone&#x27;);
  const washes = document.getElementById(&#x27;washes&#x27;);
  const switcher = document.getElementById(&#x27;switcher&#x27;);

  function pick(name, color) {
    const s = switcher.getBoundingClientRect(), p = phone.getBoundingClientRect();
    const wash = document.createElement(&#x27;div&#x27;);
    wash.className = &#x27;wash&#x27;;
    wash.style.setProperty(&#x27;--c&#x27;, color);
    wash.style.setProperty(&#x27;--x&#x27;, s.left - p.left + s.width / 2 + &#x27;px&#x27;);
    wash.style.setProperty(&#x27;--y&#x27;, s.top - p.top + s.height / 2 + &#x27;px&#x27;);
    washes.append(wash);
    requestAnimationFrame(() =&gt; requestAnimationFrame(() =&gt; wash.classList.add(&#x27;on&#x27;)));
    phone.style.setProperty(&#x27;--a&#x27;, color);
    switcher.textContent = name + &#x27; ▾&#x27;;
    setTimeout(() =&gt; { while (washes.children.length &gt; 1) washes.firstChild.remove(); }, 700);
  }

  for (const [name, color] of games) {
    const button = document.createElement(&#x27;button&#x27;);
    button.textContent = name;
    button.style.setProperty(&#x27;--c&#x27;, color);
    button.onclick = () =&gt; pick(name, color);
    document.getElementById(&#x27;picks&#x27;).append(button);
  }
&lt;/script&gt;
</code></pre>
<h2>Decks, play, and an Android port at near parity</h2>
<p>Collecting is half the hobby; the other half is playing. Crow has a <strong>deck library and builder</strong> with format validation for Magic, Pokémon, Lorcana and One Piece. The per-game rules live in one package, <code>packages/tcg-core</code>, together with the mana symbol table. There are <strong>play tools</strong> on phones and tablets for Magic (Standard, Commander, Pauper Commander, Brawl and Oathbreaker), Lorcana and Pokémon, plus a Custom mode.</p>
<h3>Android, file by file</h3>
<p>iOS is the primary product, but Android isn&#x27;t an afterthought. It&#x27;s a <strong>native Kotlin and Jetpack Compose (Material 3) port</strong> for phones and tablets, with the same screens on the same back-end contracts. &quot;Near parity&quot; is a measured claim here, not a figure of speech: every iOS file has a row in <code>docs/ANDROID_PARITY.md</code>. It&#x27;s sideloaded as a signed APK.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/crow/android-screens.webp" alt="Four Android screens side by side in light mode: Home with the collection value, a scan session with three scanned cards, Collection with the binders, and a Pokémon binder with prices"/></p>
<p><em>Home, a scan session, Collection and a binder on Android, in light mode. Real captures of the app.</em></p>
<h3>iPad, keyboard first</h3>
<p>On the iPad, the system sidebar is the only layout, and the keyboard gets the shortcuts it deserves:</p>
<table><thead><tr><th>Shortcut</th><th>Action</th></tr></thead><tbody><tr><td><code>⌘1</code> to <code>⌘8</code></td><td>Open the sidebar destinations in order (the open one again goes back to its first screen)</td></tr><tr><td><code>⌘F</code></td><td>Find a card</td></tr><tr><td><code>⌘,</code></td><td>Settings</td></tr><tr><td><code>Esc</code></td><td>Close Card Viewer in a binder</td></tr></tbody></table>
<h2>The dashboard, for work that wants a big screen</h2>
<p>Some jobs are miserable on a phone. Bulk edits, analytics, decks, Crow and ManaBox CSV imports and exports, the bargain checker: all of that lives on the <strong>desktop dashboard</strong>, a React 19 app. <strong>Overview</strong> shows the collection value, the card, set and binder totals and the most valuable cards on a shelf.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/crow/dashboard-overview.webp" alt="The dashboard Overview: collection value, the most valuable cards on a shelf and the card, set and binder totals"/></p>
<p>My favorite dashboard feature is <code>⌘K</code>: it jumps to any page, set (by name or code) or card.</p>
<p><a href="https://www.0x1ad2.dev/images/projects/crow/demo.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/crow/demo-poster.webp" alt="Pressing Command K, typing Hyperia and opening the Hyperia City set"/></a></p>
<p><em><code>⌘K</code> in action. Click to play the clip.</em></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/crow/dashboard-analytics.webp" alt="Analytics on the dashboard: value, cost basis, price coverage and value over time"/></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/crow/dashboard-themes.webp" alt="Picking the Midnight, Sunset and Neon themes in Settings › Themes, each applying to the whole page at once"/></p>
<p><em>Analytics, and Settings › Themes, where a theme applies to the whole page at once. Real captures of the dashboard.</em></p>
<h3>Selling, but simulated</h3>
<p>From the dashboard you can list a copy on eBay, Cardmarket and CardTrader. <code>packages/marketplace-core</code> defines the provider contract, SKUs, sync plans and reconciliation, and each marketplace has its own adapter.</p>
<blockquote>
<p><strong>Read the label.</strong> The channels run in simulation mode, so nothing reaches a real marketplace. The CardTrader adapter runs as a dry run only. Every sale you see below is simulated.</p>
</blockquote>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/crow/dashboard-sales.webp" alt="Sales: simulated Cardmarket, eBay and CardTrader orders, labeled as simulated"/></p>
<p><em>Sales on simulated channels. Nothing here reached a real marketplace.</em></p>
<h2>Crow Control: my CI lives on localhost</h2>
<p>GitHub Actions runs nothing in this repository; that&#x27;s a recorded decision (ADR 0063). The quality gates run on my machine instead, through <strong>Crow Control</strong>, a localhost runner whose dashboard is laid out like GitHub Actions. It runs <code>pnpm verify</code>, the e2e journeys and the device suites, and it also shows the local stack, E2E evidence per feature, releases and a <strong>system map</strong> drawn from the code.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/crow/control-overview.webp" alt="Crow Control overview: platform health, verify on main, runs, gate cache, the run in progress and health by group"/></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/crow/control-run-live.webp" alt="A verify run in progress: the waterfall of gates and the integration gate&#x27;s log following live"/></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/crow/control-map-delivery.webp" alt="The Delivery map in Crow Control with a flow ready to play"/></p>
<p><em>Crow Control: the overview, a verify run following live, and the Delivery map from the system map.</em></p>
<p>Crow Control&#x27;s cache core is written in Rust (<code>crates/control-cache</code>): an incremental BLAKE3 file index, cache keys and a zstd content-addressed store. A TypeScript twin, <code>packages/control-cache-ts</code>, keeps the same index, keys and store as a benchmark baseline and a fallback engine.</p>
<p>The day-to-day loop looks like this:</p>
<pre><code class="language-sh">pnpm check             # format, knip, docs, lint, typecheck, unit tests, build: before every commit
pnpm verify            # the gates the branch needs, as the pre-push hook runs them
pnpm control           # Crow Control on 127.0.0.1:5190: run and watch the gates
pnpm e2e [targets]     # end-to-end journeys with video and steps
</code></pre>
<h3>Peck and Crow AI: prompts, not API calls</h3>
<p>This is where my agent-driven workflow shows up in the repo. <strong>Peck</strong> is a dev-only in-page annotator: you pick elements on a page, tag and comment them, and copy a Claude Code prompt that names their source files. <strong>Crow AI</strong> is the local hub for those annotations and a set of ready-made Claude Code prompts, with a <code>crow-ai</code> MCP server that Claude Code works from.</p>
<p>Neither one calls an AI service. They run on my machine and build prompts for Claude Code to read. The README puts it in three words: <em>No AI API.</em></p>
<h2>Under the hood</h2>
<table><thead><tr><th>Layer</th><th>What it runs on</th></tr></thead><tbody><tr><td>iPhone and iPad</td><td>Swift 6 and SwiftUI, offline first with GRDB and SQLite FTS5, built with XcodeGen</td></tr><tr><td>Android</td><td>Kotlin and Jetpack Compose (Material 3)</td></tr><tr><td>Dashboard, site, Crow Control</td><td>React 19, Vite 8, TanStack Router, Tailwind CSS 4, TypeScript</td></tr><tr><td>Back-end</td><td>Supabase: Postgres 17 migrations with row-level security, pgTAP tests, seeds and Deno Edge Functions</td></tr><tr><td>Catalog</td><td>Python and Scrapy crawler, plus <code>crow-cli</code> for set backfills, card and price syncs and catalog health</td></tr><tr><td>Native cores</td><td>Rust: <code>crow-image-core</code> for the crawler&#x27;s images and fingerprints, <code>control-cache</code> for Crow Control</td></tr><tr><td>Contracts</td><td>Zod schemas in <code>@crow/types</code>, the contract between every app, and pure collection logic in <code>@crow/domain</code></td></tr><tr><td>Design</td><td>DTCG tokens built by Style Dictionary for the web, iOS and Android, one Storybook for every web component</td></tr></tbody></table>
<p>It&#x27;s all one repository:</p>
<pre><code class="language-text">crow/
├── apps/ios/          SwiftUI app for iPhone and iPad (XcodeGen)
├── apps/android/      Kotlin and Compose port
├── apps/dashboard/    React desktop companion
├── apps/site/         marketing website
├── apps/back-end/     Supabase migrations, pgTAP tests, seeds, Edge Functions
├── apps/crawler/      Scrapy catalog crawler
├── apps/cli/          crow-cli catalog operations
├── apps/control/      Crow Control
├── apps/ai/           Crow AI and the crow-ai MCP server
├── apps/storybook/    the component catalog
├── apps/video/        Remotion feature videos
├── packages/          shared TypeScript: types, domain, api-client, ui, tokens, marketplace adapters…
├── crates/            Rust: crow-image-core, control-cache
├── design/            brand art and the caw sound pack
└── docs/              architecture, ADRs, runbooks and the README media
</code></pre>
<p>Every workspace carries its own SemVer version. Changesets name what moves, Conventional Commits decide the product version, and the iOS and Android apps follow it.</p>
<h3>Bringing the whole stack up</h3>
<p>Crow builds from source on a Mac. The toolbox is long (Node 24, pnpm, Docker Desktop, the Supabase CLI, Deno 2, uv, Rust, Xcode 27 or newer, and JDK 21 plus the Android SDK 37 for Android), but <code>pnpm stack:up</code> does most of the heavy lifting:</p>
<pre><code class="language-sh">brew bundle                        # the Homebrew tools (Brewfile)
proto trust .. &amp;&amp; proto install    # the pinned Node, Supabase CLI, Rust and pnpm
pnpm install
pnpm stack:up                      # Docker, Supabase and migrations, test accounts, Crow Control and Crow AI,
                                   # dashboard and site, simulators, then stack:doctor
pnpm ingest all --starter          # crawl the starter sets of every game, with images
pnpm stack:doctor                  # is the stack a working test bed? every check, with its fix
</code></pre>
<p><code>stack:up</code> takes flags to leave pieces out, such as <code>--no-ios</code>, <code>--no-android</code> and <code>--no-site</code>. A device test builds the Release configuration and points it at the local stack over the LAN.</p>
<h2>Privacy, briefly</h2>
<ul>
<li><strong>Your collection lives on your device and your Supabase.</strong> The phones keep it in a local database and sync it with the Supabase project the build points at, which in v1.0.0 is the local stack.</li>
<li><strong>Camera frames stay on the device.</strong> They&#x27;re never stored or sent.</li>
<li><strong>Error reporting in production builds only.</strong> Sentry is off in local and test builds, including the device-test Release build.</li>
<li><strong>Selling sends nothing.</strong> The channels are simulated, and CardTrader is a dry run.</li>
<li><strong>The crawler fetches public card data</strong> from the catalog sources listed in the repo. The bargain checker contacts CardTrader and the shops it compares only when you press <strong>Fetch new bargains</strong>.</li>
</ul>
<h2>What&#x27;s not there yet</h2>
<p>Crow is at <strong>v1.0.0</strong>, released on 2026-11-13. The README is honest about the gaps, so here they are:</p>
<ul>
<li><strong>Selling is simulated.</strong> Nothing is sent to CardTrader, eBay or Cardmarket. Selling, account backups, the bargain checker, catalog management and Admin are on the dashboard only.</li>
<li><strong>v1.0.0 runs on the local stack.</strong> The hosted project holds a smaller catalog and is behind on migrations until it goes live.</li>
<li><strong>No store release yet.</strong> There&#x27;s no TestFlight or Play Store build. The archive script and the App Bundle exist; uploading waits for the store accounts.</li>
<li><strong>Deck validation covers four games.</strong> Yu-Gi-Oh! decks aren&#x27;t checked yet, and Play has no formats for One Piece or Yu-Gi-Oh!.</li>
<li><strong>No currency conversion.</strong> A card priced only in the other currency shows no value, and a variant copy is valued at its printing&#x27;s price.</li>
<li><strong>Play history stays on the device.</strong> Finished games don&#x27;t sync, and removing the app loses them.</li>
<li><strong>Sign in with Apple isn&#x27;t built.</strong> Sign in with an e-mail and password or a magic link.</li>
<li><strong>iOS 27 and Android 13 (API 33) or newer only.</strong></li>
</ul>
<p>And what&#x27;s next on the roadmap:</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" disabled=""/> <strong>TestFlight distribution</strong> of the tagged release.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> <strong>Hosted catalog parity:</strong> the 2020+ catalog the local stack has, with the daily price sync the local worker already runs.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> <strong>The deck library on the hosted project.</strong></li>
<li class="task-list-item"><input type="checkbox" disabled=""/> <strong>CardTrader go-live:</strong> work through its go-live checklist and switch the channel from dry run to live.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> <strong>Real-phone checks on Android:</strong> scanner timings and a ManaBox side-by-side on a real Android 13 phone.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> <strong>A worktree for main runs</strong>, so Crow Control runs the full chain on <code>main</code> without touching the checkout I work in.</li>
</ul>
<p>Crow isn&#x27;t affiliated with, endorsed, sponsored or approved by any of the publishers behind these games. The game names, card images and card text belong to their owners.</p>
<p>Crow has its own card on the <a href="https://www.0x1ad2.dev/projects?project=crow">projects page</a>, with the demo loop, the explainer and the stack at a glance.</p>
<blockquote>
<p>Curious about the source? It&#x27;s private, but access can be granted to anyone interested in contributing. <a href="https://www.0x1ad2.dev/contact">Get in touch</a>.</p>
</blockquote>]]></content:encoded>
    </item>
    <item>
      <title>🧭 Mapping my agent fleet with Claudetographer</title>
      <link>https://www.0x1ad2.dev/blog/claudetographer</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/claudetographer</guid>
      <pubDate>Wed, 25 Nov 2026 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>Claudetographer reads what Claude Code already writes under ~/.claude and turns it into a live map of sessions, subagents, agent teams and workflows. It shows what each agent is doing, what it costs and how long it has left, locally and read-only by default.</description>
      <category>projects</category>
      <category>agent-tools</category>
      <category>claude-code</category>
      <category>typescript</category>
      <category>react</category>
      <category>nodejs</category>
      <content:encoded><![CDATA[<p>One Claude Code session is easy to follow. Then it hands work to a subagent, that one forks, a workflow starts a few dozen agents in waves, and an agent team shares a task list in the next terminal over. Every one of them writes a tidy transcript to disk, and none of them tells you where the fleet is right now. So I built a cartographer for it. The name is a pun, and the icon is a compass on a red tile.</p>
<p><a href="https://www.0x1ad2.dev/images/projects/claudetographer/explainer.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/claudetographer/explainer-poster.webp" alt="Watch the Claudetographer explainer: a survey camera pushing onto the live Overview"/></a></p>
<p><em>The explainer runs 28.5 seconds and was made with Montage. It rebuilds the app&#x27;s views from the app&#x27;s own components and color tokens, using the demo data, rather than recording the running app.</em></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/claudetographer/screenshot-1.webp" alt="The Claudetographer Overview in pure-black Ember with KPI cards, live throughput stacked by agent kind and the Running Now list"/></p>
<p><em>Every screenshot in this post is real output: headless Chrome against the demo fleet (<code>npm run demo</code>). The projects, sessions and pull requests are all made up.</em></p>
<h2>A live map of the whole fleet</h2>
<p>The Overview puts what is happening now above the fold: live sessions, running workflows, active agents, tokens per minute and burn rate. Below that sit a per-minute throughput chart and a <strong>Running Now</strong> list, with the running workflow and its phase on top. Scroll further for noteworthy events, workflow health, cost and token trends, how the workload splits between agent kinds, recent runs and pull requests.</p>
<p>Main threads, subagents, forks, agent teams and workflow agents all land in that one view.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/claudetographer/demo-live.webp" alt="The KPI cards, Live Throughput and Running Now updating while per-minute stacks march left and the migrate-auth wave advances"/></p>
<p><em>The Overview while agents work. A Montage recreation using the demo data.</em></p>
<h3>Only the new bytes</h3>
<p>The trick that keeps it live is boring, which is what you want from a trick like this. Transcripts only ever grow, so the server never re-reads one. <code>fs.watch</code> reports that a file changed, the collector reads from the last byte offset it saw to the end of the file, and folds those new lines into sessions, agents, runs, usage buckets and PR links. Snapshots are rebuilt at most every 750 ms, shared by every open tab and pushed over Server-Sent Events.</p>
<p>Here is a toy version you can poke at. Hit <strong>Burst</strong> and watch twelve writes collapse into a couple of pushes:</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; padding: 14px; background: #000; color: #e5e5e5; font: 12px/1.5 ui-monospace, Menlo, monospace; }
  .bar { margin-bottom: 10px; }
  button { font: 600 12px system-ui; background: #ff6b57; color: #000; border: 0; border-radius: 6px; padding: 6px 10px; margin-right: 6px; cursor: pointer; }
  .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
  .col { background: #0a0a0a; border: 1px solid #262626; border-radius: 10px; padding: 10px; min-height: 150px; }
  h4 { margin: 0 0 6px; font: 600 10px system-ui; letter-spacing: .1em; text-transform: uppercase; color: #8a8a8a; }
  pre { margin: 0; white-space: pre-wrap; word-break: break-all; }
  .new { color: #ff6b57; }
  .dim { color: #6b6b6b; }
&lt;/style&gt;
&lt;div class=&quot;bar&quot;&gt;&lt;button id=&quot;one&quot;&gt;Agent writes a line&lt;/button&gt;&lt;button id=&quot;burst&quot;&gt;Burst of 12&lt;/button&gt;&lt;/div&gt;
&lt;div class=&quot;grid&quot;&gt;
  &lt;div class=&quot;col&quot;&gt;&lt;h4&gt;transcript.jsonl&lt;/h4&gt;&lt;pre id=&quot;file&quot; class=&quot;dim&quot;&gt;(empty)&lt;/pre&gt;&lt;/div&gt;
  &lt;div class=&quot;col&quot;&gt;&lt;h4&gt;collector&lt;/h4&gt;&lt;pre id=&quot;log&quot; class=&quot;dim&quot;&gt;waiting for fs.watch…&lt;/pre&gt;&lt;/div&gt;
  &lt;div class=&quot;col&quot;&gt;&lt;h4&gt;browser, over SSE&lt;/h4&gt;&lt;pre id=&quot;ui&quot; class=&quot;dim&quot;&gt;no snapshot yet&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;script&gt;
  // A toy, not Claudetographer&#x27;s code: the reader keeps a byte offset and reads only
  // what was appended; snapshots go out at most once per 750 ms.
  const tools = [&quot;Read&quot;, &quot;Edit&quot;, &quot;Bash&quot;, &quot;Grep&quot;, &quot;Agent&quot;];
  let file = &quot;&quot;, offset = 0, events = 0, pushes = 0, last = -1e9, timer = null;
  const $ = (id) =&gt; document.getElementById(id);
  const esc = (s) =&gt; s.replace(/[&amp;&lt;&gt;]/g, (c) =&gt; ({ &quot;&amp;&quot;: &quot;&amp;amp;&quot;, &quot;&lt;&quot;: &quot;&amp;lt;&quot;, &quot;&gt;&quot;: &quot;&amp;gt;&quot; })[c]);

  function write() {
    file += JSON.stringify({ type: &quot;tool_use&quot;, name: tools[(Math.random() * 5) | 0] }) + &quot;\n&quot;;
    onFileChanged();
  }
  function onFileChanged() {
    const fresh = file.slice(offset);
    offset = file.length;
    events += fresh.trim().split(&quot;\n&quot;).length;
    const old = file.slice(0, file.length - fresh.length).split(&quot;\n&quot;).slice(-5).join(&quot;\n&quot;);
    $(&quot;file&quot;).className = &quot;&quot;;
    $(&quot;file&quot;).innerHTML = &#x27;&lt;span class=&quot;dim&quot;&gt;&#x27; + esc(old) + &quot;&lt;/span&gt;&quot; + &#x27;&lt;span class=&quot;new&quot;&gt;&#x27; + esc(fresh) + &quot;&lt;/span&gt;&quot;;
    $(&quot;log&quot;).className = &quot;&quot;;
    $(&quot;log&quot;).textContent = &quot;read &quot; + fresh.length + &quot; new bytes\noffset is now &quot; + offset + &quot;\nevents folded: &quot; + events;
    if (!timer) timer = setTimeout(push, Math.max(0, 750 - (performance.now() - last)));
  }
  function push() {
    timer = null; last = performance.now(); pushes++;
    $(&quot;ui&quot;).className = &quot;&quot;;
    $(&quot;ui&quot;).textContent = &quot;snapshot #&quot; + pushes + &quot;\n&quot; + events + &quot; events so far\n&quot; + pushes + &quot; pushes for &quot; + events + &quot; writes&quot;;
  }
  $(&quot;one&quot;).onclick = write;
  $(&quot;burst&quot;).onclick = () =&gt; { for (let i = 0; i &lt; 12; i++) setTimeout(write, i * 40); };
&lt;/script&gt;
</code></pre>
<h3>Every session, and what fills it</h3>
<p>The Sessions page lists every session in range: its mode (ultracode or standard), project, status (busy, idle, waiting on you, ended), where it runs, its model and a token mix bar across the main thread, subagents, forks and workflow agents. Click one and the whole dashboard zooms in on it. The icon next to a live session jumps to its VS Code window or terminal tab (Terminal, iTerm2 and Ghostty 1.4 or later). The page also shows git worktrees with files two live sessions both edited, fork lineage, a box to message a session through <code>claude --bg --resume</code>, and cost by model and effort level.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/claudetographer/sessions.webp" alt="The Sessions table with mode, project, status, token mix, delegated agents, pull requests, tokens and cost per session"/></p>
<p>Each live session&#x27;s context is split into conversation, system and tools, memory, skills and MCP, with warnings at 75% and 90% of the way to auto-compaction. Next to it, the model mix shows what the same tokens would have cost a model family down.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/claudetographer/context.webp" alt="Each live session&#x27;s context split into conversation, system and tools, memory, skills and MCP, measured against where auto-compaction starts"/></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/claudetographer/model-mix.webp" alt="Cost by model against the same tokens a model family down, and cost by effort level"/></p>
<h3>Pages you arrange</h3>
<p><strong>Customise</strong> (top right) turns every page except Settings into a grid of widgets and blocks you can move, resize, add and remove. Drag a block by its bar, resize it by its corner, or use its ⇅ menu from the keyboard. There are 7 presets (Overview, Live, Many sessions, Usage and cost, Agents and teams, Workflows and PRs, Widgets only) and separate layouts for wide, narrow and phone widths. Each layout stays in your browser.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/claudetographer/customise.webp" alt="The Overview in edit mode, with a toolbar of presets, Widgets &amp; blocks, Reset and Done above framed blocks"/></p>
<p>On a narrow screen the layout folds into tabs, each with its own saved layout.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/claudetographer/mobile.webp" alt="The Overview on a phone, with KPI cards stacked above the throughput chart"/></p>
<h2>How much longer, and can I afford it?</h2>
<p>That&#x27;s the question the session forecast answers for whichever session you&#x27;re focused on. It shows time left with a finish time, projected tokens, cost and plan quota, the plan&#x27;s steps read from the session&#x27;s plan file, and every run of the session on one timeline with dashed projections. It learns from finished agents in the same phase and from estimates in the plan, and it tells you how confident it is.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/claudetographer/screenshot-2.webp" alt="The session forecast with time left, projected tokens, cost and quota, plan waves and the run timeline with projections"/></p>
<p>The sidebar keeps the 5-hour and weekly usage of your Claude plan in view, with when each one resets, so you don&#x27;t have to keep <code>/usage</code> open. Warnings fire at 30, 50, 80, 90 and 100% of a quota window. Drag the sliders to see where each one trips, together with the two context warnings from the Sessions page:</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; padding: 16px; background: #000; color: #e5e5e5; font: 13px/1.4 system-ui, sans-serif; }
  .meter { background: #0a0a0a; border: 1px solid #262626; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
  .head { display: flex; justify-content: space-between; margin-bottom: 8px; }
  .head b { font-weight: 600; }
  .head span { font: 600 13px ui-monospace, Menlo, monospace; color: #ff6b57; }
  input { width: 100%; accent-color: #ff6b57; }
  .ticks { position: relative; height: 22px; margin-top: 4px; }
  .tick { position: absolute; transform: translateX(-50%); font: 600 10px ui-monospace, Menlo, monospace; padding: 2px 5px; border-radius: 999px; border: 1px solid #333; color: #6b6b6b; transition: all .2s; }
  .tick.on { color: #000; background: #f5b83d; border-color: #f5b83d; }
  .tick.on.crit { background: #ff4d4d; border-color: #ff4d4d; }
  .msg { margin-top: 6px; color: #9a9a9a; min-height: 1.4em; }
&lt;/style&gt;
&lt;div class=&quot;meter&quot; id=&quot;quota&quot;&gt;&lt;/div&gt;
&lt;div class=&quot;meter&quot; id=&quot;context&quot;&gt;&lt;/div&gt;
&lt;script&gt;
  // Thresholds from the README; colors and wording are this toy&#x27;s own.
  function meter(el, label, steps, crit, note) {
    el.innerHTML = &#x27;&lt;div class=&quot;head&quot;&gt;&lt;b&gt;&#x27; + label + &#x27;&lt;/b&gt;&lt;span&gt;0%&lt;/span&gt;&lt;/div&gt;&lt;input type=&quot;range&quot; min=&quot;0&quot; max=&quot;100&quot; value=&quot;0&quot;&gt;&lt;div class=&quot;ticks&quot;&gt;&lt;/div&gt;&lt;div class=&quot;msg&quot;&gt;&lt;/div&gt;&#x27;;
    const ticks = el.querySelector(&quot;.ticks&quot;);
    steps.forEach((s) =&gt; {
      const t = document.createElement(&quot;span&quot;);
      t.className = &quot;tick&quot;; t.style.left = Math.min(s, 97) + &quot;%&quot;; t.textContent = s + &quot;%&quot;;
      ticks.appendChild(t);
    });
    const input = el.querySelector(&quot;input&quot;);
    input.oninput = () =&gt; {
      const v = +input.value;
      el.querySelector(&quot;.head span&quot;).textContent = v + &quot;%&quot;;
      let hit = 0;
      [...ticks.children].forEach((t, i) =&gt; {
        const on = v &gt;= steps[i];
        t.classList.toggle(&quot;on&quot;, on);
        t.classList.toggle(&quot;crit&quot;, on &amp;&amp; steps[i] &gt;= crit);
        if (on) hit = steps[i];
      });
      el.querySelector(&quot;.msg&quot;).textContent = hit ? note(hit) : &quot;All quiet.&quot;;
    };
    input.oninput();
  }
  meter(document.getElementById(&quot;quota&quot;), &quot;Plan quota, 5-hour window&quot;, [30, 50, 80, 90, 100], 90,
    (h) =&gt; (h === 100 ? &quot;Window used up. Note when it resets.&quot; : &quot;Warning: &quot; + h + &quot;% of the window is gone.&quot;));
  meter(document.getElementById(&quot;context&quot;), &quot;Context, on the way to auto-compaction&quot;, [75, 90], 90,
    (h) =&gt; &quot;Warning: &quot; + h + &quot;% of the way to auto-compaction.&quot;);
&lt;/script&gt;
</code></pre>
<p>Cost starts as an estimate from the transcripts, at API list prices. If you want the real figures, an opt-in OpenTelemetry receiver (OTLP/HTTP JSON) swaps the estimates for Claude Code&#x27;s own token and cost numbers and tags them <strong>exact</strong>. Switch the receiver on under <strong>Settings › App</strong>, then start Claude Code with:</p>
<pre><code class="language-sh">CLAUDE_CODE_ENABLE_TELEMETRY=1 \
OTEL_METRICS_EXPORTER=otlp \
OTEL_LOGS_EXPORTER=otlp \
OTEL_EXPORTER_OTLP_PROTOCOL=http/json \
OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4317 \
claude
</code></pre>
<h2>Pause, stop, relaunch, and who opened that PR</h2>
<p>Workflows get the most attention, because they&#x27;re where things go sideways fastest. Claudetographer applies the rules from the Claude Code <a href="https://code.claude.com/docs/en/workflows">workflow docs</a>: size guidelines, the Large-workflow warning (also when ultracode hides it), stall restarts, resume replay and the concurrency cap.</p>
<p>Pick a run and you see its phases and every agent in them, each with its live tool, a quiet timer and a retry count. Three meters hold the run against its limits: agents against the Large-workflow threshold, context tokens against 1.5M, and peak concurrency against the cap. A stopped or abandoned run gets a <strong>resume forecast</strong>: how many agents a relaunch would reuse and how many it would rerun.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/claudetographer/screenshot-3.webp" alt="The run list beside a running 29-agent workflow, with phases and per-agent chips, meters against its limits, its pull request and its agents"/></p>
<p>An agent that writes nothing for 5 minutes while it isn&#x27;t waiting on a tool call gets flagged as a <strong>Possible stall</strong>. Claude Code restarts stalled agents on its own, and the chip then shows the retry.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/claudetographer/demo-stall-relaunch.gif" alt="The migrate-auth run card: the migrate billing agent goes quiet, is flagged with no output for 5m 02s of a 5m window, then restarts as retry 1 and turns live"/></p>
<p><em>A stalled agent restarting on its own. A Montage recreation using the demo data.</em></p>
<h3>The hook that holds the brakes</h3>
<p>Watching is nice. Being able to step in is better. <strong>Turn on workflow controls</strong> installs an optional <code>PreToolUse</code> hook, and from then on a running run gets <strong>Run · Pause · Stop</strong> and an ended run gets <strong>Relaunch…</strong>, which can change the concurrency cap and the size guideline before it starts again in a background session. You can aim the controls at one run, one session or everything. Try the rules:</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; padding: 16px; background: #000; color: #e5e5e5; font: 13px/1.45 system-ui, sans-serif; }
  .card { background: #0a0a0a; border: 1px solid #262626; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
  .label { font: 600 10px system-ui; letter-spacing: .1em; text-transform: uppercase; color: #8a8a8a; margin-bottom: 8px; }
  .seg { display: flex; flex-wrap: wrap; gap: 6px; }
  .seg button, .calls button { font: 600 12px system-ui; background: #141414; color: #d4d4d4; border: 1px solid #2e2e2e; border-radius: 6px; padding: 6px 10px; cursor: pointer; }
  .seg button.on { background: #ff6b57; color: #000; border-color: #ff6b57; }
  .calls { display: flex; flex-wrap: wrap; gap: 6px; }
  .calls button { font-family: ui-monospace, Menlo, monospace; }
  label { display: flex; gap: 8px; align-items: center; margin-top: 10px; color: #bdbdbd; }
  #out { font: 13px/1.5 ui-monospace, Menlo, monospace; min-height: 3em; }
  .ok { color: #4ade80; } .hold { color: #f5b83d; } .no { color: #ff4d4d; }
&lt;/style&gt;
&lt;div class=&quot;card&quot;&gt;
  &lt;div class=&quot;label&quot;&gt;Control for this run&lt;/div&gt;
  &lt;div class=&quot;seg&quot; id=&quot;modes&quot;&gt;&lt;/div&gt;
  &lt;label&gt;&lt;input type=&quot;checkbox&quot; id=&quot;up&quot; checked&gt; Dashboard is running&lt;/label&gt;
&lt;/div&gt;
&lt;div class=&quot;card&quot;&gt;
  &lt;div class=&quot;label&quot;&gt;The agent&#x27;s next tool call&lt;/div&gt;
  &lt;div class=&quot;calls&quot; id=&quot;calls&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;card&quot;&gt;&lt;div class=&quot;label&quot;&gt;PreToolUse says&lt;/div&gt;&lt;div id=&quot;out&quot;&gt;Pick a tool call.&lt;/div&gt;&lt;/div&gt;
&lt;script&gt;
  // The rules as the README states them, written as a toy decision function.
  const modes = [&quot;Run&quot;, &quot;Pause&quot;, &quot;Stop&quot;, &quot;No new agents&quot;];
  const calls = [&quot;Read&quot;, &quot;Edit&quot;, &quot;Bash&quot;, &quot;Agent&quot;, &quot;Task&quot;, &quot;Workflow&quot;];
  const launches = new Set([&quot;Agent&quot;, &quot;Task&quot;, &quot;Workflow&quot;]);
  let mode = &quot;Run&quot;;
  function decide(call) {
    if (!document.getElementById(&quot;up&quot;).checked) return [&quot;ok&quot;, &quot;allow: the dashboard isn&#x27;t running, so the hook lets every call through&quot;];
    if (mode === &quot;Pause&quot;) return [&quot;hold&quot;, &quot;hold: the call is held back, for up to an hour&quot;];
    if (mode === &quot;Stop&quot;) return [&quot;no&quot;, &quot;refuse: and Claude is told to wrap up&quot;];
    if (mode === &quot;No new agents&quot; &amp;&amp; launches.has(call)) return [&quot;no&quot;, &quot;refuse: no new &quot; + call + &quot; launches for this run&quot;];
    return [&quot;ok&quot;, &quot;allow&quot;];
  }
  const m = document.getElementById(&quot;modes&quot;);
  modes.forEach((name) =&gt; {
    const b = document.createElement(&quot;button&quot;);
    b.textContent = name; b.className = name === mode ? &quot;on&quot; : &quot;&quot;;
    b.onclick = () =&gt; { mode = name; [...m.children].forEach((c) =&gt; c.classList.toggle(&quot;on&quot;, c === b)); };
    m.appendChild(b);
  });
  const c = document.getElementById(&quot;calls&quot;);
  calls.forEach((name) =&gt; {
    const b = document.createElement(&quot;button&quot;);
    b.textContent = name;
    b.onclick = () =&gt; {
      const [cls, text] = decide(name);
      document.getElementById(&quot;out&quot;).innerHTML = name + &#x27; → &lt;span class=&quot;&#x27; + cls + &#x27;&quot;&gt;&#x27; + text + &quot;&lt;/span&gt;&quot;;
    };
    c.appendChild(b);
  });
&lt;/script&gt;
</code></pre>
<p>That last rule is the one I care about most: if Claudetographer isn&#x27;t running, the hook gets out of the way entirely. A dashboard should never be the reason your agents stop.</p>
<h3>Knowing when you&#x27;re needed</h3>
<p>Transcripts can&#x27;t show a session that&#x27;s stuck on a permission prompt or waiting for your next message. <strong>Install hooks</strong> adds five Claude Code <a href="https://code.claude.com/docs/en/hooks">hooks</a> to <code>~/.claude/settings.json</code>, and each one is a single fire-and-forget call set to <code>&quot;async&quot;: true</code>:</p>
<pre><code class="language-sh">curl … http://127.0.0.1:&lt;port&gt;/api/hook || true
</code></pre>
<p>So it never holds up a turn and does nothing when the dashboard isn&#x27;t running. <strong>Remove hooks</strong> takes out exactly what was added.</p>
<table><thead><tr><th>Event</th><th>What the dashboard does</th></tr></thead><tbody><tr><td><code>Notification</code></td><td>Flags the session as waiting for approval or input, raises an alert, can send a desktop notification and counts the prompt in the permission audit</td></tr><tr><td><code>UserPromptSubmit</code></td><td>Clears the flag and marks the session busy</td></tr><tr><td><code>Stop</code></td><td>Marks the session idle the moment Claude finishes its turn</td></tr><tr><td><code>SubagentStop</code></td><td>Marks the subagent done without waiting for its transcript</td></tr><tr><td><code>SessionEnd</code></td><td>Ends the session and records why (exit, <code>/clear</code>, logout)</td></tr></tbody></table>
<p>The Alerts page collects it all: waiting sessions, quota warnings, large runs, stalls, failed runs, possible loops and the permission audit.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/claudetographer/alerts.webp" alt="The Alerts page listing workflow health alerts by severity"/></p>
<h3>Every PR, credited to its run</h3>
<p>The Pull requests page shows every PR your sessions opened or touched, grouped by session, with state, review and checks from your own <code>gh</code> login. A PR linked by a workflow agent is credited to that run. Otherwise it&#x27;s matched to whichever run was going when the session linked it, and labeled &quot;during run&quot;, because I&#x27;d rather be honest than confidently wrong.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/claudetographer/prs.webp" alt="Pull requests grouped by session, with state, review and checks"/></p>
<h2>The rest of the map</h2>
<p>A few more corners worth knowing about:</p>
<ul>
<li><strong>Agents &amp; Teams.</strong> Workload by session and agent kind, subagent types, and the skills and agent definitions that never triggered.</li>
<li><strong>Agent teams.</strong> Each team&#x27;s shared task list, with who is blocked on whom.</li>
<li><strong>MCP health.</strong> Per project, each MCP server&#x27;s state, tool count, context cost, calls and failures.</li>
<li><strong>Config doctor.</strong> It checks managed, user and project settings for files that don&#x27;t parse, permission rules that never apply because a deny or ask elsewhere wins, values a higher layer overrides, hooks, status lines and MCP servers that run files that don&#x27;t exist, and enabled plugins that aren&#x27;t installed. Each finding comes with a fix.</li>
<li><strong>Settings editor.</strong> It re-reads a file before each save, changes only that one key and keeps the previous version as <code>&lt;file&gt;.claudetographer.bak</code>.</li>
<li><strong>Hook activity.</strong> Every hook run the transcripts record, yours and your plugins&#x27; included.</li>
<li><strong>⌘K search.</strong> Pages, settings, projects, sessions, runs, PRs, theme and palette.</li>
<li><strong>Rename and recolor.</strong> Give a session your own name and one of eight colors. Labels stay in your browser and never reach Claude Code.</li>
</ul>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/claudetographer/agents.webp" alt="Agents and Teams: a workload sunburst by session and agent kind above an agent timeline"/></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/claudetographer/teams.webp" alt="An agent team&#x27;s members and shared task list, with blocked tasks pointing at the task they wait on"/></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/claudetographer/mcp.webp" alt="MCP health per project, with each server&#x27;s state, tool count, context cost, calls, and failed and slow calls"/></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/claudetographer/doctor.webp" alt="The config doctor reporting a PostToolUse hook whose script is missing, with the fix"/></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/claudetographer/hooks.webp" alt="Hook activity: runs, average duration, blocks and failures per hook, then the latest runs"/></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/claudetographer/search.webp" alt="The ⌘K command palette searching for auth across pages, sessions, runs and pull requests"/></p>
<h2>Ten palettes and a lot of black</h2>
<p>You knew there&#x27;d be a theming section. One palette choice re-themes the whole app: charts, logo, favicon, buttons, active navigation, the alerts badge, icons, toggles and focus rings. Each palette has four series colors (one per agent kind) and an accent for the chrome, with separate sets for light and dark mode.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/claudetographer/demo-palettes.gif" alt="A cursor clicking swatches while the interface re-themes from Ember to Mono blue to Neon and back"/></p>
<p><em>Switching palettes re-themes everything without a reload. A Montage recreation using the demo data.</em></p>
<p>Dark mode is <strong>pure black</strong>: a <code>#000</code> page, <code>#0a0a0a</code> panels and neutral grays with no blue cast, so the palette carries all the color on screen. Light mode isn&#x27;t the dark one flipped. Every palette has its own light colors, and every built-in set was checked against the real chart surfaces (<code>#ffffff</code> and <code>#0a0a0a</code>) for lightness, chroma, contrast and color-blind separation. Status colors (good, warning, critical) are never reused as series colors, so a red bar never looks like an error.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/claudetographer/palette-grid.webp" alt="All ten palettes side by side, each as a small overview chart"/></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/claudetographer/overview-light.webp" alt="The Overview in light mode with the Ember palette"/></p>
<p>The reason it all switches without a reload: palettes are CSS custom properties on <code>&lt;html&gt;</code>, and the charts re-read the tokens. Here is the idea in miniature. The colors are my rough approximations, not the app&#x27;s exact values:</p>
<pre><code class="language-html-live">&lt;style&gt;
  :root { --s1: #ff5a4e; --s2: #2cc6b5; --s3: #f5b83d; --s4: #9b7bff; --accent: #ff5a4e; }
  body { margin: 0; padding: 16px; background: #000; color: #e5e5e5; font: 13px/1.4 system-ui, sans-serif; }
  .panel { background: #0a0a0a; border: 1px solid #262626; border-radius: 12px; padding: 14px; }
  .title { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 12px; }
  .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent), transparent 70%); transition: background .3s; }
  .chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; }
  .stack { flex: 1; display: flex; flex-direction: column-reverse; gap: 2px; }
  .stack i { display: block; border-radius: 2px; transition: background .3s; }
  .legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; color: #9a9a9a; font-size: 12px; }
  .legend span::before { content: &quot;&quot;; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: var(--c); }
  .swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
  .swatches button { font: 600 12px system-ui; color: #d4d4d4; background: #141414; border: 1px solid #2e2e2e; border-radius: 999px; padding: 6px 12px; cursor: pointer; }
  .swatches button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .swatches label { display: flex; gap: 6px; align-items: center; color: #9a9a9a; font-size: 12px; }
  input[type=color] { width: 32px; height: 26px; border: 0; background: none; padding: 0; }
&lt;/style&gt;
&lt;div class=&quot;panel&quot;&gt;
  &lt;div class=&quot;title&quot;&gt;&lt;span class=&quot;dot&quot;&gt;&lt;/span&gt;Live throughput&lt;/div&gt;
  &lt;div class=&quot;chart&quot; id=&quot;chart&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;legend&quot;&gt;
    &lt;span style=&quot;--c: var(--s1)&quot;&gt;main thread&lt;/span&gt;&lt;span style=&quot;--c: var(--s2)&quot;&gt;subagents&lt;/span&gt;
    &lt;span style=&quot;--c: var(--s3)&quot;&gt;forks&lt;/span&gt;&lt;span style=&quot;--c: var(--s4)&quot;&gt;workflow agents&lt;/span&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;swatches&quot; id=&quot;sw&quot;&gt;
  &lt;button data-p=&quot;#ff5a4e,#2cc6b5,#f5b83d,#9b7bff,#ff5a4e&quot;&gt;Ember&lt;/button&gt;
  &lt;button data-p=&quot;#b9d4ff,#6fa3ff,#2f6fe0,#1a3f8f,#6fa3ff&quot;&gt;Mono blue&lt;/button&gt;
  &lt;button data-p=&quot;#ff2bd6,#21b8ff,#b6ff2e,#8a3dff,#ff2bd6&quot;&gt;Neon&lt;/button&gt;
  &lt;label&gt;One color &lt;input type=&quot;color&quot; id=&quot;one&quot; value=&quot;#2cc6b5&quot;&gt;&lt;/label&gt;
&lt;/div&gt;
&lt;script&gt;
  // Only the custom properties change. Nothing re-renders the chart.
  const chart = document.getElementById(&quot;chart&quot;);
  for (let i = 0; i &lt; 18; i++) {
    const col = document.createElement(&quot;div&quot;);
    col.className = &quot;stack&quot;;
    for (let s = 1; s &lt;= 4; s++) {
      const seg = document.createElement(&quot;i&quot;);
      seg.style.height = 6 + Math.round(Math.random() * 22) + &quot;px&quot;;
      seg.style.background = &quot;var(--s&quot; + s + &quot;)&quot;;
      col.appendChild(seg);
    }
    chart.appendChild(col);
  }
  const root = document.documentElement.style;
  function apply(list) { [&quot;--s1&quot;, &quot;--s2&quot;, &quot;--s3&quot;, &quot;--s4&quot;, &quot;--accent&quot;].forEach((k, i) =&gt; root.setProperty(k, list[i])); }
  document.querySelectorAll(&quot;[data-p]&quot;).forEach((b) =&gt; (b.onclick = () =&gt; apply(b.dataset.p.split(&quot;,&quot;))));
  document.getElementById(&quot;one&quot;).oninput = (e) =&gt; {
    const c = e.target.value; // four shades mixed in OKLCH from one base color
    apply([
      &quot;color-mix(in oklch, &quot; + c + &quot;, white 45%)&quot;, c,
      &quot;color-mix(in oklch, &quot; + c + &quot;, black 30%)&quot;, &quot;color-mix(in oklch, &quot; + c + &quot;, black 55%)&quot;, c,
    ]);
  };
&lt;/script&gt;
</code></pre>
<p>The real <strong>One colour</strong> option does the grown-up version of that color picker: it builds four OKLCH shades and a readable accent for each mode. <strong>Pick each colour</strong> lets you choose all five yourself and warns when one falls under 3:1 against the background. On top of that come six logo marks (Compass, Radar, Constellation, Map pin, Orbit, Folded map), six typefaces, three densities, three corner styles and a reduced-motion setting. The fonts are bundled, so nothing loads from a font CDN, and your choices are applied before the first paint, so there&#x27;s no flash of the wrong theme.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/claudetographer/custom.webp" alt="The Overview with a custom teal palette, Space Grotesk, graphite surfaces and the Radar logo"/></p>
<h2>Under the hood</h2>
<table><thead><tr><th>Layer</th><th>Choice</th></tr></thead><tbody><tr><td>Language</td><td>TypeScript (7)</td></tr><tr><td>Server</td><td>One Node.js process (23.6 or newer runs the TypeScript directly), Server-Sent Events</td></tr><tr><td>UI</td><td>React 19, ECharts 6, Motion, react-grid-layout, Lucide</td></tr><tr><td>Build</td><td>Vite 8</td></tr><tr><td>Tests</td><td>Playwright end-to-end, in GitHub Actions on every push and pull request</td></tr></tbody></table>
<p>This is how the pieces connect:</p>
<pre><code class="language-text">~/.claude
 ├─ projects/*/*.jsonl      transcripts
 ├─ */subagents/…           subagents, forks, workflow agents
 ├─ */workflows/…           run summaries, scripts
 ├─ sessions/*.json         live sessions
 └─ settings*.json          ◀── edits from the Settings page
        │
        │  fs.watch + byte-offset tail
        ▼
  Collector (server/collector.ts)
        ▲   gh pr view, your auth ............ sweep every 60 s, cached
        ▲   hooks and status line ............ POST /api/hook, /api/statusline
        ▲   plan usage lookup, your login .... every 5 min
        │
        │  snapshot, at most every 750 ms
        ▼
  /api/stream  (Server-Sent Events)
        ▼
  React + ECharts dashboard
</code></pre>
<ol>
<li><strong>Index.</strong> At startup, one Node process reads the last <code>--days</code> of transcripts (3 by default), live sessions, run summaries, workflow scripts and settings under <code>~/.claude</code>.</li>
<li><strong>Tail.</strong> <code>fs.watch</code> reports changed files, and only the new bytes are read and folded in.</li>
<li><strong>Enrich.</strong> <code>gh pr view</code> adds PR state, review and checks. Open PRs are re-checked after 5 minutes and finished ones after an hour. The plan usage lookup, the hooks, the status line and the optional OTLP receiver add what transcripts can&#x27;t show.</li>
<li><strong>Stream.</strong> Snapshots are rebuilt at most every 750 ms, shared by all clients and pushed over <code>/api/stream</code>.</li>
<li><strong>Render.</strong> React, ECharts and Motion draw it, and the palette tokens live on <code>&lt;html&gt;</code>.</li>
</ol>
<p>The Playwright suite drives the dashboard the way you would, against the demo fleet: every page and the mobile tabs, filters and session focus, workflow runs and the forecast, alerts, ⌘K, customizing a page, every settings tab and the API&#x27;s guards. It starts its own demo on its own port with its data in a temp folder, so whatever you have running is left alone, and nothing that would run <code>claude</code> or your editor ever fires.</p>
<h2>Local, and read-only by default</h2>
<p>A tool that reads every transcript on your machine owes you some promises. These are the ones it makes:</p>
<ul>
<li><strong>Local.</strong> The server binds to <code>127.0.0.1</code> and only answers requests addressed to <code>localhost</code>, <code>127.0.0.1</code> or <code>[::1]</code> on its port. Anything that changes state also needs the app&#x27;s own header.</li>
<li><strong>Read-only by default.</strong> It writes to your Claude Code settings only when you edit them on the Settings page or install the hooks, status line or workflow controls, and it keeps the previous file as a <code>.claudetographer.bak</code>.</li>
<li><strong>Two outbound calls, both yours to turn off.</strong> <code>gh pr view</code> runs with your own GitHub login (<code>--no-github</code>). The plan usage lookup calls <code>api.anthropic.com</code> with your Claude Code login (<code>--no-usage-lookup</code>). The token stays in the server process and is never logged or sent to the browser.</li>
<li><strong>No telemetry.</strong> Nothing about you or your sessions goes anywhere else. The OpenTelemetry receiver only listens, on your own port, and stays off until you switch it on.</li>
<li><strong>Secrets stay out of the browser.</strong> Env vars whose names look secret (<code>KEY</code>, <code>TOKEN</code>, <code>SECRET</code>…) never reach the UI. You can replace them, not read them.</li>
<li><strong><code>claude</code> runs only when you ask.</strong> Messaging a session, relaunching a run or stopping a session runs <code>claude</code> (or a SIGTERM) only after you confirm.</li>
</ul>
<h2>Running it</h2>
<p>Claudetographer is at v2.4.0. It&#x27;s built from source, and it runs on any OS with Node 23.6 or newer, in a browser tab or in VS Code&#x27;s Simple Browser next to the Claude panel. The <code>gh</code> CLI is optional, for pull request details.</p>
<pre><code class="language-sh">npm install     # install dependencies
npm start       # http://localhost:4317, server in watch mode, UI with hot reload
npm run demo    # a made-up fleet on http://localhost:4318; never touches your real ~/.claude
</code></pre>
<p>The demo is the best way in. It generates a synthetic fleet and keeps it ticking: four live sessions (one waiting for your approval), a 29-agent workflow mid-run, an ultracode session six waves into an eight-wave plan, a failed run and its resume, stopped runs, pull requests and plan usage.</p>
<p>On macOS, <code>npm run autostart</code> installs a LaunchAgent that serves the static build from login, restarts it if it crashes and rebuilds when the sources are newer. <code>scripts/autostart.sh app</code> adds a small <code>Claudetographer.app</code> that opens the map in your browser, for Spotlight or a Stream Deck key.</p>
<p>Filters live in the URL hash, so a view you like is a link you can keep:</p>
<pre><code class="language-text">http://localhost:4317/#/workflows?mode=ultra&amp;session=&lt;id&gt;&amp;range=6h
</code></pre>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/claudetographer/settings-claude.webp" alt="Settings › Claude Code, showing the workflow settings in force with their defaults, and the settings file editor"/></p>
<h2>What&#x27;s not there yet</h2>
<p>The README is upfront about the rough edges, so I will be too:</p>
<ul>
<li><strong>Cost is an estimate</strong> at API list prices (cached 2026-10-06) unless you turn on the OpenTelemetry receiver. On a Claude subscription it measures usage, not what you pay.</li>
<li><strong>The context breakdown is an estimate</strong> for memory, skills and MCP (4 characters a token). The total is exact.</li>
<li><strong>Possible stall is a heuristic:</strong> no output for 5 minutes while not waiting on a tool call.</li>
<li><strong>Permission prompts are counted</strong> from hook events the server receives while it runs, so they start at zero on each restart.</li>
<li><strong>Settings in force</strong> are resolved at user level only. Project settings and per-session environment variables can differ.</li>
<li><strong>Plan usage comes from an undocumented lookup,</strong> and the on-disk formats are Claude Code internals. Either can change between versions. A failed lookup says why in the sidebar.</li>
</ul>
<p>Next up on the roadmap: unit tests for the collector parsers, inventory and doctor on fixture transcripts, next to the e2e suite; <strong>turns to compaction</strong>, a forecast of how many turns or minutes each live session has before it auto-compacts; and weekly budgets and holds, plus OTLP protobuf support for the receiver.</p>
<p><em>Claudetographer is unofficial and not affiliated with or endorsed by Anthropic. Claude and Claude Code are trademarks of Anthropic.</em></p>
<p>Claudetographer has its own card on the <a href="https://www.0x1ad2.dev/projects?project=claudetographer">projects page</a>, with the demo loop, the explainer and the stack at a glance.</p>
<blockquote>
<p>Curious about the source? It&#x27;s private, but access can be granted to anyone interested in contributing. <a href="https://www.0x1ad2.dev/contact">Get in touch</a>.</p>
</blockquote>]]></content:encoded>
    </item>
    <item>
      <title>🖱️ Halo: 17 Metal shaders for one tiny pointer</title>
      <link>https://www.0x1ad2.dev/blog/halo</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/halo</guid>
      <pubDate>Wed, 25 Nov 2026 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>Halo makes your pointer impossible to miss in screen recordings, presentations, tutorials and live demos. It stacks 17 real-time Metal effects, swaps in custom cursors and includes Halo Studio, a layer stack with a live shader editor, all from the menu bar.</description>
      <category>projects</category>
      <category>apple</category>
      <category>macos</category>
      <category>metal</category>
      <category>swift</category>
      <category>swiftui</category>
      <content:encoded><![CDATA[<p>You know the moment. Someone shares their screen, says &quot;so if you look right here&quot;, and fifty people squint at a 4K desktop hunting for an arrow the size of a grain of rice. The mouse pointer is the most important thing on screen during a demo, and macOS draws it like it would rather you didn&#x27;t notice.</p>
<p>So I gave mine a halo. Then a ring of fire. Then a raymarched 3D torus. Things escalated.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/halo/hero.webp" alt="Aurora Ring, Flame Halo, Plasma Halo, Torus 3D and the Neon Cursor rendered by Halo in a row over faint God Rays on a dark background"/></p>
<p><em>The hero row is Halo&#x27;s own output, rendered offscreen by the app and set on a Montage backdrop.</em></p>
<p>The 33.5-second tour, if you&#x27;d rather watch than read:</p>
<p><a href="https://www.0x1ad2.dev/images/projects/halo/explainer.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/halo/explainer-poster.webp" alt="Watch the 33-second Halo explainer"/></a></p>
<h2>17 effects and 20 presets, from Cyber Neon to God Mode</h2>
<p>At its simplest, Halo does what a cursor highlighter should: a filled circle, ring or rounded square with a soft glow around the pointer, in whatever shape, color, size, opacity, ring width and glow you like. Click effects get animated ripples. A spotlight dims the rest of the screen and keeps a soft pool of light around the cursor.</p>
<p>Then there&#x27;s the part I actually had fun with: a real-time <strong>Metal effects engine</strong> with 17 built-in GPU effects. Neon, aurora, flame, fire and spark trails, a glass orb, liquid chrome, plasma, god rays, a raymarched 3D torus, shockwaves and more. They stack in layers with four blend modes.</p>
<p><a href="https://www.0x1ad2.dev/images/projects/halo/demo.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/halo/demo-poster.webp" alt="Watch the effects loop: Aurora Ring, Plasma Halo, Torus 3D, Fire Trail, Spark Trail, Neon Cursor, Shockwave and the Inferno preset"/></a></p>
<p><em>One effect per second, cut from 4-second clips that Halo rendered itself. Click the still to play the loop.</em></p>
<p>Here are all 17, side by side. Every still was rendered offscreen by the app with <code>Halo --render-effect</code>, so nothing here is a mockup:</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/halo/effects-contact-sheet.webp" alt="A contact sheet of all 17 Halo effects. Top row: Aurora Ring, Flame Halo, Plasma Halo, Neon Ring, Torus 3D, Liquid Chrome. Middle row: Glass Orb, Fire Trail, Spark Trail, Shockwave, Neon Ripple, God Rays. Bottom row: Vignette Spotlight, Classic Ring, Neon Cursor, Glass Cursor, Ember Cursor"/></p>
<p><em>Left to right, top to bottom: Aurora Ring, Flame Halo, Plasma Halo, Neon Ring, Torus 3D, Liquid Chrome, Glass Orb, Fire Trail, Spark Trail, Shockwave, Neon Ripple, God Rays, Vignette Spotlight, Classic Ring, Neon Cursor, Glass Cursor and Ember Cursor.</em></p>
<p>A few personal favorites, in the README&#x27;s own words: <strong>Liquid Chrome</strong> is &quot;a ring of molten mercury&quot;, <strong>Glass Orb</strong> does two-surface refraction with dispersion, and <strong>Spark Trail</strong> throws grinder sparks that fall and cool.</p>
<p>Effects come in five categories:</p>
<table><thead><tr><th>Category</th><th>What it does</th></tr></thead><tbody><tr><td><code>cursor</code></td><td>Follows the pointer.</td></tr><tr><td><code>click</code></td><td>Fires on each click.</td></tr><tr><td><code>spotlight</code></td><td>Dims everything except a pool of light.</td></tr><tr><td><code>fullscreen</code></td><td>Covers the whole screen.</td></tr><tr><td><code>cursorReplacement</code></td><td>Draws the pointer itself.</td></tr></tbody></table>
<p>On top of that come <strong>20 built-in presets</strong>, including the combo looks Cyber Neon, Inferno, Cinematic Presenter, Glass Studio, Aurora Calm, Recording Pro and God Mode. You switch them from the menu bar, which lists every preset with a rendered thumbnail, and every pick applies at once to the live overlay:</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/halo/preset-roulette.webp" alt="The Halo menu bar menu opens its Preset submenu and picks God Mode, Inferno, Cyber Neon and Torus 3D in turn, and each pick lights the pointer with that preset"/></p>
<p><em>Preset roulette. The menu is a Montage recreation of <code>MenuBarController.swift</code>; the effects are Halo&#x27;s own renders.</em></p>
<h3>Clicks you can tell apart</h3>
<p>Left and right clicks get their own ripple colors and styles, so viewers can tell them apart in a recording. Stack a click effect such as <strong>Neon Ripple</strong> or <strong>Shockwave</strong> on top of any cursor effect and every click lands with a little ceremony:</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/halo/clicks.webp" alt="A highlighted pointer clicks on a dim slide window: left clicks spring blue neon rings, right clicks spring red dashed rings and a shockwave fringe follows each click"/></p>
<p><em>Click choreography, with the rings redrawn in Montage from the <code>neon-ripple</code> and <code>shockwave</code> parameters.</em></p>
<p>Ripples are one of those ideas that never get old. This site has its own three.js take on it. It isn&#x27;t Halo code, just the same itch scratched in a browser: move your pointer over the grid.</p>
<pre><code class="language-three-demo">pointer-ripples
</code></pre>
<h3>The spotlight, sketched in CSS</h3>
<p>Halo has a spotlight mode and a Metal effect called Vignette Spotlight (&quot;a cinematic follow-spot&quot;). The idea fits in a radial gradient, though, so here is a sketch you can edit. Move over the fake desktop and drag the slider to change how dark the rest of the screen gets:</p>
<pre><code class="language-html-live">&lt;style&gt;
  html, body { margin: 0; height: 100%; overflow: hidden; font: 12px system-ui, sans-serif; }
  .desk { position: absolute; inset: 0; background: linear-gradient(135deg, #1d2340, #3a1f3d); }
  .win { position: absolute; background: #e9e9ef; border-radius: 10px; padding: 26px 14px 12px; box-shadow: 0 10px 30px #0009; }
  .line { height: 8px; border-radius: 4px; background: #c4c4cf; margin: 8px 0; }
  .spot {
    --x: 50%; --y: 50%; --r: 120px; --dim: 0.75;
    position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(circle var(--r) at var(--x) var(--y),
      transparent 40%, rgb(0 0 0 / var(--dim)) 100%);
  }
  label { position: fixed; top: 8px; right: 10px; z-index: 1; color: #fff; }
&lt;/style&gt;
&lt;div class=&quot;desk&quot;&gt;
  &lt;div class=&quot;win&quot; style=&quot;left: 8%; top: 12%; width: 40%&quot;&gt;
    &lt;div class=&quot;line&quot;&gt;&lt;/div&gt;&lt;div class=&quot;line&quot; style=&quot;width: 70%&quot;&gt;&lt;/div&gt;&lt;div class=&quot;line&quot; style=&quot;width: 85%&quot;&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;win&quot; style=&quot;left: 46%; top: 42%; width: 44%&quot;&gt;
    &lt;div class=&quot;line&quot;&gt;&lt;/div&gt;&lt;div class=&quot;line&quot; style=&quot;width: 55%&quot;&gt;&lt;/div&gt;&lt;div class=&quot;line&quot;&gt;&lt;/div&gt;&lt;div class=&quot;line&quot; style=&quot;width: 35%&quot;&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;spot&quot; id=&quot;spot&quot;&gt;&lt;/div&gt;
&lt;label&gt;dim &lt;input id=&quot;dim&quot; type=&quot;range&quot; min=&quot;0&quot; max=&quot;0.95&quot; step=&quot;0.01&quot; value=&quot;0.75&quot;&gt;&lt;/label&gt;
&lt;script&gt;
  const spot = document.getElementById(&quot;spot&quot;).style
  addEventListener(&quot;pointermove&quot;, (e) =&gt; {
    spot.setProperty(&quot;--x&quot;, e.clientX + &quot;px&quot;)
    spot.setProperty(&quot;--y&quot;, e.clientY + &quot;px&quot;)
  })
  document.getElementById(&quot;dim&quot;).oninput = (e) =&gt; spot.setProperty(&quot;--dim&quot;, e.target.value)
&lt;/script&gt;
</code></pre>
<h2>Halo Studio, and a shader editor that answers while you type</h2>
<p>Presets are great until you want <em>your</em> look. That&#x27;s what <strong>Halo Studio</strong> is for: an effect library on the left, a live Metal preview in the middle and an inspector on the right.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/halo/screenshot-1.webp" alt="Halo Studio with a three-layer stack of Shockwave, Neon Ring and Aurora Ring and the inspector sliders for the selected layer"/></p>
<p><em>A real Studio window, captured by Halo&#x27;s own UI driver.</em></p>
<p>You build a look the way you&#x27;d build one in a design tool:</p>
<ul>
<li><strong>Library.</strong> Browse effects by category with thumbnails, tags and search, or switch to presets. Double-click, press <strong>+</strong> or drag an effect onto the layer list.</li>
<li><strong>Layers.</strong> Stack effects top first. Reorder, duplicate, remove, <strong>solo</strong> and mute.</li>
<li><strong>Inspector.</strong> Per layer: enabled, opacity, blend mode and speed, then every effect parameter grouped into sections with reset buttons.</li>
<li><strong>Live preview.</strong> The real compositor draws into the canvas. The effect follows your mouse and reacts to left and right clicks, and a transport bar has play and pause, a time scrubber, global speed, a simulated figure-eight cursor and click buttons. A HUD shows fps and frame time.</li>
<li><strong>Randomize.</strong> <strong>Random Stack</strong> (⌘R) builds a new stack; ⇧⌘R randomizes the selected layer&#x27;s parameters. Dangerous for productivity.</li>
<li><strong>Apply to Cursor.</strong> ⌘↩ sends the stack to the live overlay, and <strong>Revert</strong> undoes it. ⌘Z and ⇧⌘Z cover everything in between.</li>
</ul>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/halo/studio-presets.webp" alt="Halo Studio with the Presets library open, showing built-in and combo presets"/></p>
<p>Looks travel, too. <strong>Export…</strong> writes a preset as a <code>.halopreset</code> file (JSON) or an effect as a <code>.haloeffect</code> package, and <strong>Import…</strong> (⌘O) takes those, plain effect folders and <code>.zip</code> files. You can also just drop them on the Studio window.</p>
<h3>An effect is just data</h3>
<p>This is the bit I like most. An effect is a folder with two files: an <code>effect.json</code> descriptor and an <code>effect.metal</code> fragment function, compiled at run time. In the Studio, <strong>New Effect…</strong> creates exactly this template and opens it in the shader editor. Here&#x27;s the starter, a soft pulsing dot:</p>
<pre><code class="language-json">{
  &quot;id&quot;: &quot;my-dot&quot;,
  &quot;name&quot;: &quot;My Dot&quot;,
  &quot;category&quot;: &quot;cursor&quot;,
  &quot;author&quot;: &quot;Me&quot;,
  &quot;version&quot;: &quot;1.0&quot;,
  &quot;description&quot;: &quot;A soft pulsing dot that follows the cursor.&quot;,
  &quot;symbolName&quot;: &quot;circle.fill&quot;,
  &quot;bounds&quot;: { &quot;mode&quot;: &quot;cursorLocal&quot;, &quot;size&quot;: 64, &quot;sizeParams&quot;: { &quot;radius&quot;: 3 } },
  &quot;blend&quot;: &quot;normal&quot;,
  &quot;animated&quot;: true,
  &quot;clickTriggered&quot;: false,
  &quot;parameters&quot;: [
    { &quot;name&quot;: &quot;color&quot;,  &quot;label&quot;: &quot;Color&quot;,  &quot;type&quot;: &quot;color&quot;, &quot;default&quot;: [0.3, 0.75, 1.0, 1.0], &quot;group&quot;: &quot;Look&quot; },
    { &quot;name&quot;: &quot;radius&quot;, &quot;label&quot;: &quot;Radius&quot;, &quot;type&quot;: &quot;float&quot;, &quot;default&quot;: 18, &quot;min&quot;: 4, &quot;max&quot;: 80, &quot;step&quot;: 1, &quot;group&quot;: &quot;Shape&quot; },
    { &quot;name&quot;: &quot;pulse&quot;,  &quot;label&quot;: &quot;Pulse&quot;,  &quot;type&quot;: &quot;float&quot;, &quot;default&quot;: 0.3, &quot;min&quot;: 0, &quot;max&quot;: 1, &quot;step&quot;: 0.01, &quot;group&quot;: &quot;Motion&quot; }
  ]
}
</code></pre>
<pre><code class="language-metal">// `in.p` and `u.cursor` are in points (origin bottom-left, y up).
// Return a PREMULTIPLIED sRGB color.
float4 haloEffect(HaloFragmentIn in, constant HaloUniforms&amp; u, constant float4* params) {
    float4 color = param_color;
    float pulse = 1.0 + param_pulse * 0.25 * sin(u.time * 4.0);
    float r = param_radius * pulse;
    float d = haloSdCircle(in.p - u.cursor, r);
    float body = haloAA(d, haloPixel(u));
    float glow = exp(-max(d, 0.0) / (r * 0.35)) * 0.6;
    float a = max(body * 0.85, glow) * color.a;
    return haloPremultiply(color.rgb, a);
}
</code></pre>
<p>The contract fits on an index card:</p>
<ul>
<li><strong>Entry point.</strong> Exactly <code>float4 haloEffect(HaloFragmentIn in, constant HaloUniforms&amp; u, constant float4* params)</code>. No <code>#include</code>: the header already brings in <code>&lt;metal_stdlib&gt;</code> and the <code>halo*</code> helpers.</li>
<li><strong>Parameters become macros.</strong> <code>param_color</code>, <code>param_radius</code> and so on. Enum options become constants such as <code>shape_ring</code>.</li>
<li><strong>Uniforms.</strong> <code>u.time</code>, <code>u.cursor</code>, <code>u.cursorVelocity</code>, <code>u.resolution</code>, <code>u.screenScale</code>, <code>u.cursorIdleTime</code>, <code>u.seed</code> and up to 8 recent clicks in <code>u.clicks[i]</code> (<code>position</code>, <code>age</code>, <code>button</code>).</li>
<li><strong>Output.</strong> A <strong>premultiplied</strong> color. The engine applies layer opacity and the blend mode for you.</li>
<li><strong>Bounds.</strong> <code>cursorLocal</code> for a small region around the cursor (cheap), or <code>fullscreen</code> for whole-screen looks.</li>
</ul>
<h3>Run that shader in your browser</h3>
<p>Because the effect is just a function of a pixel position and a few uniforms, it ports almost line for line. Below is the <code>my-dot</code> shader translated to JavaScript, with Halo&#x27;s real <code>haloAA</code>, <code>haloSdCircle</code> and <code>haloSdRing</code> helpers copied over from its Metal header. It runs per pixel on the CPU, which is exactly the job Halo hands to the GPU. Move, left-click and right-click in the preview, then change <code>param_radius</code> or <code>param_pulse</code> in the source.</p>
<pre><code class="language-html-live">&lt;style&gt;
  html, body { margin: 0; height: 100%; background: #000; overflow: hidden; }
  canvas { display: block; width: 100vw; height: 100vh; cursor: crosshair; }
  p { position: fixed; left: 10px; bottom: 6px; margin: 0; font: 12px ui-monospace, Menlo, monospace; color: #777; }
&lt;/style&gt;
&lt;canvas id=&quot;c&quot;&gt;&lt;/canvas&gt;
&lt;p&gt;move · left click · right click&lt;/p&gt;
&lt;script&gt;
// my-dot/effect.json parameters
const param_color = [0.3, 0.75, 1.0, 1.0]
const param_radius = 18
const param_pulse = 0.3

// Halo&#x27;s helpers, ported from its Metal header
const saturate = (x) =&gt; Math.min(Math.max(x, 0), 1)
const haloAA = (d, w) =&gt; saturate(0.5 - d / Math.max(w, 1e-4))
const haloSdCircle = (x, y, r) =&gt; Math.hypot(x, y) - r
const haloSdRing = (x, y, r, width) =&gt; Math.abs(Math.hypot(x, y) - r) - width * 0.5
const haloPixel = (u) =&gt; 1 / Math.max(u.screenScale, 1)

const u = { time: 0, cursor: [0, 0], screenScale: 1, clicks: [] }
const still = matchMedia(&quot;(prefers-reduced-motion: reduce)&quot;).matches

// my-dot/effect.metal, line for line. Returns premultiplied [r, g, b, a].
function haloEffect(px, py) {
  const color = param_color
  const pulse = 1 + param_pulse * 0.25 * Math.sin(u.time * 4)
  const r = param_radius * pulse
  const d = haloSdCircle(px - u.cursor[0], py - u.cursor[1], r)
  const body = haloAA(d, haloPixel(u))
  const glow = Math.exp(-Math.max(d, 0) / (r * 0.35)) * 0.6
  const a = Math.max(body * 0.85, glow) * color[3]
  return [color[0] * a, color[1] * a, color[2] * a, a]
}

// Not part of my-dot: a ring per recent click, so u.clicks has a job.
function clickRing(px, py, c) {
  const d = haloSdRing(px - c.position[0], py - c.position[1], 8 + c.age * 150, 3)
  const a = haloAA(d, haloPixel(u)) * (1 - c.age / 0.6)
  const rgb = c.button === &quot;right&quot; ? [1, 0.33, 0.28] : [0.2, 0.55, 1]
  return [rgb[0] * a, rgb[1] * a, rgb[2] * a, a]
}

const canvas = document.getElementById(&quot;c&quot;)
const ctx = canvas.getContext(&quot;2d&quot;)
let W, H, image
function resize() {
  W = canvas.width = innerWidth
  H = canvas.height = innerHeight
  image = ctx.createImageData(W, H)
  u.cursor = [W / 2, H / 2]
}
resize()
addEventListener(&quot;resize&quot;, resize)
canvas.addEventListener(&quot;pointermove&quot;, (e) =&gt; (u.cursor = [e.offsetX, e.offsetY]))
canvas.addEventListener(&quot;contextmenu&quot;, (e) =&gt; e.preventDefault())
canvas.addEventListener(&quot;pointerdown&quot;, (e) =&gt; {
  u.clicks.unshift({ position: [e.offsetX, e.offsetY], age: 0, button: e.button === 2 ? &quot;right&quot; : &quot;left&quot; })
  u.clicks.length = Math.min(u.clicks.length, 8) // Halo keeps up to 8 recent clicks
})

let last = performance.now()
function frame(now) {
  const dt = (now - last) / 1000
  last = now
  if (!still) u.time += dt
  u.clicks.forEach((c) =&gt; (c.age += dt))
  u.clicks = u.clicks.filter((c) =&gt; c.age &lt; 0.6)

  const out = image.data
  for (let y = 0; y &lt; H; y++) {
    for (let x = 0; x &lt; W; x++) {
      let o = haloEffect(x, y)
      for (const c of u.clicks) {
        const s = clickRing(x, y, c) // premultiplied &quot;over&quot;
        o = o.map((v, i) =&gt; s[i] + v * (1 - s[3]))
      }
      const i = (y * W + x) * 4
      out[i] = o[0] * 255
      out[i + 1] = o[1] * 255
      out[i + 2] = o[2] * 255
      out[i + 3] = 255
    }
  }
  ctx.putImageData(image, 0, 0)
  requestAnimationFrame(frame)
}
requestAnimationFrame(frame)
&lt;/script&gt;
</code></pre>
<p>Your laptop fan may now understand why Halo does this on the GPU, and why <code>cursorLocal</code> bounds exist.</p>
<h3>Hot reload, with errors at your own line numbers</h3>
<p>In Halo&#x27;s shader editor, every edit schedules a compile <strong>300 ms after you stop typing</strong>. The compile runs off the main thread, so the UI never stalls. Errors and warnings appear inline at <em>your</em> line numbers. When the source compiles and the descriptor is valid, Halo writes both files back to the effect folder, reloads the library, and the live preview picks up the new shader at once.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/halo/screenshot-2.webp" alt="The shader editor on a Pulse Ring effect with a typo on line 6: a red gutter dot, a wavy underline under puls, a 1 error chip and an Issues list suggesting pulse"/></p>
<p><em>An inline compile error. This view is a Montage mockup rebuilt from the SwiftUI sources with a synthetic effect.</em></p>
<p>Fix the typo and you&#x27;re back in business:</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/halo/shader-editor-fixed.webp" alt="The live shader editor with Metal source, a Live compile status and the effect inspector"/></p>
<p>Two small touches I&#x27;m fond of: the <strong>JSON</strong> tab edits <code>effect.json</code> through a form or as raw JSON, and choosing <strong>Edit Shader</strong> on a built-in effect first duplicates it as &quot;<em>Name</em> Copy&quot;, so the originals stay untouched.</p>
<h3>The app is also a CLI</h3>
<p>The Halo binary doubles as a command-line tool for effect authors, and none of these commands opens a window. This is also how every still in this post was made.</p>
<pre><code class="language-sh">B=build/Halo.app/Contents/MacOS/Halo
$B --list-effects
$B --compile-effect ~/Library/Application\ Support/Halo/Effects/my-dot   # diagnostics with your line numbers
$B --render-effect neon-ring --out /tmp/neon.png --time 1.3 --background &#x27;#1E1E24&#x27;
$B --render-effect shockwave --out /tmp/shock.png --click-age 0.15 --click-button right
$B --render-preset cyber-neon --out /tmp/cyber.png --velocity 700,250 --click-age 0.25 \
   --background &#x27;#F2F2F5&#x27; --composite over                              # deterministic (fixed seed)
$B --render-cursor-theme neon --out /tmp/neon-cursor.png --scale 2
$B --bench-effect god-rays                                              # GPU ms: avg / p95 / max
</code></pre>
<h2>Seven cursor themes, and the pointer always comes back</h2>
<p>Sometimes a glow around the pointer isn&#x27;t enough and you want a different pointer altogether. Halo can hide the system cursor and draw its own: 7 themes covering 13 cursor types (arrow, I-beam, pointing hand, resize, busy and friends), tinted and scaled to taste. You can also import your own PNG or SVG cursors, or use an effect such as the Neon Cursor as the pointer.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/halo/screenshot-3.webp" alt="The seven cursor themes, each with an arrow, pointing hand and I-beam: Halo Classic, Big &amp; Bold, Minimal Dot, Retro Pixel, Glass, Neon and Ember"/></p>
<p><em>Halo Classic, Big &amp; Bold, Minimal Dot, Retro Pixel, Glass, Neon and Ember, rendered by Halo with <code>--render-cursor-theme</code>.</em></p>
<p>Now, hiding someone&#x27;s mouse pointer is a slightly terrifying thing for an app to do. A Mac with no visible pointer is the worst way this feature can fail, so every exit path puts the real one back:</p>
<table><thead><tr><th>Exit path</th><th>What happens</th></tr></thead><tbody><tr><td><strong>Panic hotkey</strong></td><td><strong>⌃⌥⌘H</strong> restores the real pointer immediately and turns the feature off. It&#x27;s registered only while the custom cursor is on, and the pointer is never hidden without it.</td></tr><tr><td><strong>Normal exits</strong></td><td>Quitting, stopping Halo or switching the feature off restores it.</td></tr><tr><td><strong>Crashes</strong></td><td><code>exit()</code>, crashes and signals (SIGTERM, SIGINT, SIGSEGV, SIGABRT and more) run an emergency restore before the process ends.</td></tr><tr><td><strong>Password fields</strong></td><td>When Secure Event Input is on, the custom cursor pauses and the real pointer shows.</td></tr><tr><td><strong>Killed process</strong></td><td>If the process is killed outright, WindowServer drops the hidden state together with the connection.</td></tr></tbody></table>
<p>Turn it on in <strong>Settings › Cursor</strong>, where the theme, size, tint and the panic hotkey live:</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/halo/settings-cursor.webp" alt="Halo Settings on Cursor, with the custom cursor switch, theme picker, size, tint and panic hotkey"/></p>
<h3>Shortcuts, Spotlight and Siri</h3>
<p>Halo adds 7 App Intents to the Shortcuts app and Spotlight. App Shortcuts work with no setup, so you can say <em>&quot;Toggle Halo&quot;</em>, <em>&quot;Apply Inferno in Halo&quot;</em> or <em>&quot;Open Halo Studio&quot;</em> to Siri, which is a very satisfying thing to say out loud mid-presentation.</p>
<table><thead><tr><th>Action</th><th>What it does</th></tr></thead><tbody><tr><td><strong>Toggle Halo</strong></td><td>Turns the highlight on or off.</td></tr><tr><td><strong>Set Halo On or Off</strong></td><td>Sets the highlight to a given state.</td></tr><tr><td><strong>Toggle Halo Spotlight</strong></td><td>Turns spotlight dimming on or off.</td></tr><tr><td><strong>Apply Halo Preset</strong></td><td>Applies any built-in or user preset, shown with rendered thumbnails.</td></tr><tr><td><strong>Toggle Halo Custom Cursor</strong></td><td>Turns the custom cursor on or off.</td></tr><tr><td><strong>Set Halo Custom Cursor On or Off</strong></td><td>Sets the custom cursor to a given state.</td></tr><tr><td><strong>Open Halo Studio</strong></td><td>Opens the Studio.</td></tr></tbody></table>
<p>Or skip all that and press <strong>⌃⌥H</strong> anywhere to toggle Halo (the hotkey is configurable).</p>
<h3>A resting cursor costs nothing</h3>
<p>All of this would be a hard sell if it cooked your Mac. Halo is a menu bar app with no Dock icon, and frames are drawn only when something changes, so a resting cursor costs no CPU. Animated effects render only while visible and slow down when you&#x27;re idle; static ones cost nothing while the cursor rests. It honors Reduce Motion and Low Power Mode too.</p>
<h2>A quick tour of the rest</h2>
<p>On first launch, a Welcome window explains what Halo does and asks you to choose a look:</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/halo/welcome-initial.webp" alt="The Halo Welcome window with a short explanation of the app and a Choose a look grid of presets"/></p>
<p>Settings uses Liquid Glass and has seven sections (<strong>General</strong>, <strong>Highlight &amp; Effects</strong>, <strong>Clicks</strong>, <strong>Spotlight</strong>, <strong>Cursor</strong>, <strong>Keystrokes</strong> and <strong>About</strong>). Changes apply live. Highlight &amp; Effects, Clicks, Spotlight, Cursor and Keystrokes each have their own <strong>Reset to Defaults…</strong>, and the one in General restores all appearance settings but keeps your hotkey, launch at login and on/off state.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/halo/settings-general.webp" alt="Halo Settings on the General section: enable switch, toggle hotkey, launch at login, renderer and motion options"/></p>
<p>There&#x27;s also an optional on-screen keystroke HUD with left and right click badges for tutorials, and Halo works across multiple displays and Spaces.</p>
<h2>Under the hood</h2>
<p><strong>Stack:</strong> Swift 6 · SwiftUI and AppKit · Metal · App Intents · XcodeGen · XCTest. Runs on macOS 26 and later.</p>
<p>Everything hangs off one composition root, <code>HaloController</code>. Here&#x27;s the shape of it:</p>
<pre><code class="language-text">AppDelegate (menu bar app)
└── HaloController                 composition root
    ├── HaloSettings               user defaults
    ├── HotkeyManager              ⌃⌥H
    ├── MenuBarController
    ├── InputMonitor               mouse, clicks, keys ──► OverlayController, KeystrokeHUD
    ├── OverlayController          per-screen panels   ──► EffectEngine
    ├── PresetStore                ── active stack ──► EffectEngine
    ├── EffectLibrary              ──► EffectEngine
    ├── EffectEngine               compositor
    │   ├── EffectShaderCompiler   runtime Metal, off-main
    │   └── ScreenCompositor ×N    CAMetalLayer + display link
    ├── CursorController           custom cursor ──► SystemCursorHider (always restores)
    └── StudioWindowController     Studio + shader editor ── Apply to Cursor ──► EffectEngine
</code></pre>
<p>Four ideas carry most of the weight:</p>
<ul>
<li><strong>Overlay.</strong> Each screen gets a transparent, click-through overlay panel. Effects are grouped into render surfaces: small <code>cursorLocal</code> surfaces move with the pointer without redrawing, and fullscreen surfaces cover their screen.</li>
<li><strong>Compile.</strong> Shaders compile at run time off the main actor. A layer whose pipeline is still compiling is skipped until it&#x27;s ready.</li>
<li><strong>Frame pacing.</strong> Frames are drawn on demand: animated effects are throttled when the cursor rests, and static ones render once per change.</li>
<li><strong>Input.</strong> <code>InputMonitor</code> follows the mouse, clicks and (with Accessibility) keys, and feeds the overlay, the click history in the shader uniforms and the keystroke HUD.</li>
</ul>
<p>The 17 built-in effects live in <code>Resources/Effects/&lt;id&gt;/</code> as the same <code>effect.json</code> plus <code>effect.metal</code> pair you saw above, next to 20 <code>.halopreset</code> files and the 7 cursor themes.</p>
<h3>Privacy by having nothing to leak</h3>
<table><thead><tr><th>Permission</th><th>Why it is needed</th></tr></thead><tbody><tr><td><strong>None</strong></td><td>Highlight, click effects, spotlight, Metal effects, the custom cursor and the global hotkey need no permission.</td></tr><tr><td><strong>Accessibility</strong></td><td>Only for the optional keystroke HUD, and requested only when you turn it on. Decline it and everything else keeps working.</td></tr><tr><td><strong>Screen Recording</strong></td><td><strong>Never.</strong> Halo doesn&#x27;t read screen pixels. Those glass and chrome reflections are synthetic.</td></tr></tbody></table>
<p>Halo has no network access, no analytics, no telemetry and no crash reporting. The keystroke HUD shows keys only while you type and never stores or logs them. Preferences, presets and effects stay on your Mac.</p>
<h3>Tested like it means it</h3>
<p><code>scripts/test.sh</code> runs the XCTest unit tests: the engine, shader editor, Studio, presets, settings, cursor themes and the reset and randomize paths. <code>scripts/e2e.sh</code> is a black-box suite against a Release build that renders every effect and every preset on a dark and a light background and checks each image. Its live phase drives the real app through App Intents and synthetic input, hides and restores the pointer, measures CPU budgets per preset and checks for crash reports.</p>
<pre><code class="language-sh">scripts/test.sh                          # unit tests (HaloKitTests, Debug, with coverage)
scripts/e2e.sh                           # build, unit tests, self-tests, compile and render every effect and preset
E2E_UI=1 scripts/e2e.sh                  # + scripted UI driver: menu, Settings, Welcome, Studio, shader editor, hotkey
E2E_LIVE=1 E2E_UI=1 scripts/e2e.sh -k    # + live phase: App Intents, synthetic input, cursor-restore drills, CPU budgets
</code></pre>
<p>That UI driver is also what captured the real window screenshots in this post, in light and dark.</p>
<h2>What&#x27;s not there yet</h2>
<p>Halo is in development, and the README is honest about it, so I will be too:</p>
<ul>
<li><strong>No notarized build.</strong> Developer ID signing and notarization haven&#x27;t been done yet, so you build from source (macOS 26, Xcode 27 and XcodeGen, then <code>scripts/build-app.sh</code>). Signing with Developer ID, notarizing and publishing a DMG from <code>scripts/release.sh</code> is the first item on the roadmap.</li>
<li><strong>CPU while the mouse moves.</strong> In the last full live run, 107 of 113 checks passed. The 6 failures were CPU budgets with the mouse moving (Classic Ring at about 7% against a 3% budget, for example), measured while other processes kept the machine busy. Re-checking those on a quiet machine is on the list.</li>
<li><strong>One frame rate per surface.</strong> Surfaces don&#x27;t yet idle at different rates, so the <code>maxFps: 20</code> of God Rays has no effect inside the God Mode preset, which also runs Plasma Halo. Per-surface frame rates are on the roadmap.</li>
<li><strong>Placeholder identifiers.</strong> The bundle identifier and defaults domain still need their real names before any public release.</li>
<li><strong>Small UI leftovers.</strong> A thin line under the traffic lights in the Settings sidebar, a small-looking Glass cursor theme preview and a default-style Studio error alert.</li>
</ul>
<p>The full project lives on the <a href="https://www.0x1ad2.dev/projects?project=halo">projects page</a>, next to the other things I&#x27;ve built.</p>
<blockquote>
<p>Curious about the source? It&#x27;s private, but access can be granted to anyone interested in contributing. <a href="https://www.0x1ad2.dev/contact">Get in touch</a>.</p>
</blockquote>]]></content:encoded>
    </item>
    <item>
      <title>🪷 Noema: where sound becomes vision</title>
      <link>https://www.0x1ad2.dev/blog/noema</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/noema</guid>
      <pubDate>Wed, 25 Nov 2026 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>Noema is where sound becomes vision. Layer synthesized or imported sound, shape ten GPU-rendered worlds that react to the real output mix, map signals like heart rate and breathing onto them, and play the results as sessions, meditations and playlists. Offline, no account.</description>
      <category>projects</category>
      <category>cross-platform</category>
      <category>cpp</category>
      <category>webgl</category>
      <category>swift</category>
      <category>kotlin</category>
      <category>electron</category>
      <category>audio</category>
      <content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/noema/icon.webp" alt="Noema&#x27;s app icon, the Bloom: six glowing petals inside an orbit on deep indigo"/></p>
<p>I gave this project one rule before I wrote a line of it: <strong>nothing is faked</strong>. If a petal swells on the bass, it&#x27;s because the audio engine heard bass in the mix that is actually leaving your speakers. If the colors follow a heartbeat, it&#x27;s either your heartbeat from an Apple Watch or a simulator that says <strong>Simulated</strong> right there on screen. No canned animation pretending to listen, no number on screen that didn&#x27;t come from somewhere.</p>
<p>That rule turned a &quot;pretty visualizer&quot; into something closer to a small studio: a synth, two editors, a signal router, a session player and a file format, on iPhone, iPad, Mac, Apple Watch, Android and Windows. Here&#x27;s the 31-second version:</p>
<p><a href="https://www.0x1ad2.dev/images/projects/noema/explainer.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/noema/explainer-poster.webp" alt="Watch the 31-second Noema explainer: the Surprise menu open over the Fractal Universe world on a Mac, with a play button"/></a></p>
<p><em>31 seconds, no audio. Made with Montage, my shared Remotion studio: the worlds are Noema&#x27;s own renderer shaders, the UI around them is rebuilt from the SwiftUI views and design tokens, and every heart-rate, breathing and meter value is synthetic.</em></p>
<h2>Ten worlds that hear the actual mix</h2>
<p>Every visual world reads the engine&#x27;s analysis of the output mix, frame by frame: level, bass, mids, treble, spectral centroid, flux, onsets and beats. The engine does the listening. The worlds just get very good at reacting.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/noema/visuals-that-hear.webp" alt="The Circular Spectrum world pulsing beside an audio-analysis card whose 64-band spectrum, onset dot and bass, mids and treble bars move with it"/></p>
<p><em>The Circular Spectrum world and the analysis card that drives it, a Montage recreation. The motion follows the engine&#x27;s analysis of a real mix, so the meters show the numbers that move the shader, frame for frame, for a mix you don&#x27;t hear.</em></p>
<p>Each world is a generator in the renderer, most of them a GLSL shader. The 17 built-in visual presets use one or two of them as layers:</p>
<table><thead><tr><th>World</th><th>What it draws</th></tr></thead><tbody><tr><td><strong>Fractal Universe</strong></td><td>Recursive kaleidoscopic and Julia-style structures with orbit-trap glow.</td></tr><tr><td><strong>Particle Cosmos</strong></td><td>A GPU particle galaxy on curl-noise flow fields, with trails and touch attraction.</td></tr><tr><td><strong>Fluid Dreamscape</strong></td><td>Domain-warped noise ribbons and silky displacement, layered.</td></tr><tr><td><strong>Sacred Geometry</strong></td><td>Flower-of-life lattices, petal rosettes and concentric orbits.</td></tr><tr><td><strong>Shape Field</strong></td><td>GPU-instanced circles, rings, polygons, stars, arcs and petals that drift, orbit, swirl or bounce.</td></tr><tr><td><strong>Infinite Tunnel</strong></td><td>An endless vortex of luminous rings and spiral seams. Touch steers the vanishing point.</td></tr><tr><td><strong>Aurora</strong></td><td>Curtains of light over a starfield. Touch bends the curtains.</td></tr><tr><td><strong>Living Cells</strong></td><td>A Voronoi field with glowing membranes that breathe, drift and swell around touch.</td></tr><tr><td><strong>Waveform</strong></td><td>An oscilloscope ribbon of the real output waveform, with feedback persistence.</td></tr><tr><td><strong>Circular Spectrum</strong></td><td>Radial or linear bars from the real 64-bin spectrum.</td></tr></tbody></table>
<h3>A bloom that only moves when it hears something</h3>
<p>Here&#x27;s the idea in a few dozen lines you can poke at. To be clear, this is <strong>not</strong> Noema&#x27;s code: Noema analyzes the mix inside its C++ engine, and this toy uses the browser&#x27;s <code>AnalyserNode</code>. But the principle is the same. Press <strong>Play</strong> for a drone and a soft kick. Until you do, nothing moves, because there&#x27;s nothing to hear.</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; background: #05040c; color: #e9e6ff; font: 12px system-ui, sans-serif; }
  canvas { display: block; width: 100%; height: 170px; }
  .bar { display: flex; gap: .75rem; align-items: center; padding: .5rem .75rem; }
  button { font: inherit; color: inherit; background: #a388ff26; border: 1px solid #a388ff80; border-radius: 999px; padding: .25rem .9rem; cursor: pointer; }
  output { opacity: .7; font-variant-numeric: tabular-nums; }
&lt;/style&gt;
&lt;canvas id=&quot;c&quot;&gt;&lt;/canvas&gt;
&lt;div class=&quot;bar&quot;&gt;&lt;button id=&quot;play&quot;&gt;Play&lt;/button&gt;&lt;output id=&quot;read&quot;&gt;Silence. Nothing moves.&lt;/output&gt;&lt;/div&gt;
&lt;script&gt;
  const c = document.getElementById(&quot;c&quot;), g = c.getContext(&quot;2d&quot;), read = document.getElementById(&quot;read&quot;);
  let an, bins, prevBass = 0, flash = 0, spin = 0, tick = 0;

  document.getElementById(&quot;play&quot;).onclick = (e) =&gt; {
    if (an) return;
    const ac = new AudioContext(), out = ac.createGain();
    an = ac.createAnalyser(); an.fftSize = 256; bins = new Uint8Array(an.frequencyBinCount);
    out.gain.value = 0.2; out.connect(an); an.connect(ac.destination);

    // A drone: a sawtooth through a low-pass filter that a slow LFO opens and closes.
    const saw = ac.createOscillator(), lp = ac.createBiquadFilter(), lfo = ac.createOscillator(), depth = ac.createGain();
    saw.type = &quot;sawtooth&quot;; saw.frequency.value = 55; lp.frequency.value = 600;
    lfo.frequency.value = 0.1; depth.gain.value = 500;
    lfo.connect(depth).connect(lp.frequency); saw.connect(lp).connect(out); saw.start(); lfo.start();

    // A soft kick every 750 ms (something to call an onset), and a bell on every other beat.
    setInterval(() =&gt; {
      const now = ac.currentTime, kick = ac.createOscillator(), env = ac.createGain();
      kick.frequency.setValueAtTime(140, now); kick.frequency.exponentialRampToValueAtTime(40, now + 0.2);
      env.gain.setValueAtTime(1, now); env.gain.exponentialRampToValueAtTime(0.001, now + 0.4);
      kick.connect(env).connect(out); kick.start(now); kick.stop(now + 0.4);
      if (tick++ % 2) {
        const bell = ac.createOscillator(), benv = ac.createGain();
        bell.type = &quot;triangle&quot;; bell.frequency.value = [660, 880, 990, 1320][Math.floor(Math.random() * 4)];
        benv.gain.setValueAtTime(0.4, now); benv.gain.exponentialRampToValueAtTime(0.001, now + 0.6);
        bell.connect(benv).connect(out); bell.start(now); bell.stop(now + 0.6);
      }
    }, 750);
    e.target.textContent = &quot;Playing&quot;;
  };

  // Average a run of FFT bins into 0..1. At 48 kHz each bin is about 190 Hz wide.
  const band = (a, b) =&gt; { let s = 0; for (let i = a; i &lt;= b; i++) s += bins[i]; return s / (b - a + 1) / 255; };

  function frame() {
    const dpr = devicePixelRatio, w = c.clientWidth * dpr, h = c.clientHeight * dpr;
    if (c.width !== w || c.height !== h) { c.width = w; c.height = h; }
    let bass = 0, mids = 0, treble = 0;
    if (an) {
      an.getByteFrequencyData(bins);
      bass = band(0, 1); mids = band(2, 10); treble = band(11, 63);
      if (bass - prevBass &gt; 0.12) flash = 1; // a crude onset: the bass jumped since the last frame
      prevBass = bass;
      read.textContent = `bass ${bass.toFixed(2)} · mids ${mids.toFixed(2)} · treble ${treble.toFixed(2)}`;
    }
    spin += mids * 0.04; flash *= 0.9;

    g.fillStyle = &quot;rgb(5 4 12 / .35)&quot;; g.fillRect(0, 0, w, h); // a short trail
    const r = Math.min(w, h) / 2, len = r * (0.35 + bass * 0.55);
    g.save(); g.translate(w / 2, h / 2); g.rotate(spin);
    g.shadowColor = &quot;#a388ff&quot;; g.shadowBlur = (8 + treble * 60) * dpr;
    g.fillStyle = `hsl(${255 - treble * 80} 90% ${60 + flash * 25}% / .55)`;
    for (let i = 0; i &lt; 6; i++) {
      g.rotate(Math.PI / 3);
      g.beginPath(); g.ellipse(0, -len / 2, len * 0.22, len / 2, 0, 0, Math.PI * 2); g.fill();
    }
    g.shadowBlur = 0; g.lineWidth = 1.5 * dpr;
    g.strokeStyle = `rgb(233 230 255 / ${0.15 + flash * 0.6})`;
    g.beginPath(); g.arc(0, 0, r * 0.92, 0, Math.PI * 2); g.stroke();
    g.restore();
    requestAnimationFrame(frame);
  }
  frame();
&lt;/script&gt;
</code></pre>
<p>Try changing the band ranges in <code>band(...)</code>, or swap the <code>55</code> Hz drone for something higher, and watch which petals stop caring.</p>
<h2>Two labs, 34 signals and 24 experiences</h2>
<p>Worlds are only half of it. The other half is the stuff you make and play.</p>
<p><strong>Sound Lab</strong> lets you layer sine, triangle, square and sawtooth tones, white, pink and brown noise, harmonic drones, AM and FM tones and evolving textures, then shape them with ADSR, filters, LFOs, tremolo, delay and reverb. You hear every change live.</p>
<p><strong>Visual Lab</strong> stacks and blends layers, lets you edit every parameter, pick from 12 palettes, randomize, and pause the animation while you fiddle. Undo and redo work in both labs, because &quot;randomize&quot; without undo is just a slot machine.</p>
<h3>Reactive mappings</h3>
<p>This is the part I&#x27;m proudest of. Any of 34 signals (audio, touch or mouse, device motion, guided breathing, microphone level, heart rate, depth, session and playlist progress) can drive any mappable parameter. Each mapping has range, curve, smoothing, hysteresis, rate limit and combine options, with live readouts so you can see what&#x27;s going on.</p>
<p>Three of those options fit in a playground. Drag the heart rate, then play with the curve and the smoothing. Note the label: if a value isn&#x27;t real, it says so.</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; background: #05040c; color: #e9e6ff; font: 12px system-ui, sans-serif; display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: .5rem; padding: .5rem; box-sizing: border-box; min-height: 13rem; }
  label { display: block; margin-bottom: .6rem; }
  input, select { display: block; width: 100%; margin-top: .25rem; accent-color: #a388ff; font: inherit; }
  .sim { padding: 0 .35rem; border-radius: 4px; background: #ffb02e33; color: #ffcf7a; font-weight: 600; }
  canvas { width: 100%; height: 150px; }
  output { grid-column: 1 / -1; opacity: .7; font-variant-numeric: tabular-nums; }
&lt;/style&gt;
&lt;div&gt;
  &lt;label&gt;Heart rate &lt;span class=&quot;sim&quot;&gt;Simulated&lt;/span&gt; &lt;b id=&quot;bpmOut&quot;&gt;&lt;/b&gt;
    &lt;input id=&quot;bpm&quot; type=&quot;range&quot; min=&quot;50&quot; max=&quot;140&quot; value=&quot;72&quot;&gt;&lt;/label&gt;
  &lt;label&gt;Curve
    &lt;select id=&quot;curve&quot;&gt;&lt;option&gt;linear&lt;/option&gt;&lt;option&gt;ease in&lt;/option&gt;&lt;option&gt;ease out&lt;/option&gt;&lt;/select&gt;&lt;/label&gt;
  &lt;label&gt;Smoothing
    &lt;input id=&quot;smooth&quot; type=&quot;range&quot; min=&quot;0&quot; max=&quot;0.98&quot; step=&quot;0.01&quot; value=&quot;0.9&quot;&gt;&lt;/label&gt;
&lt;/div&gt;
&lt;canvas id=&quot;c&quot;&gt;&lt;/canvas&gt;
&lt;output id=&quot;out&quot;&gt;&lt;/output&gt;
&lt;script&gt;
  const $ = (id) =&gt; document.getElementById(id), c = $(&quot;c&quot;), g = c.getContext(&quot;2d&quot;);
  const curves = { &quot;linear&quot;: (x) =&gt; x, &quot;ease in&quot;: (x) =&gt; x * x, &quot;ease out&quot;: (x) =&gt; 1 - (1 - x) ** 2 };
  let smoothed = 0.25, phase = 0, last = performance.now();

  function frame(now) {
    const dt = Math.min((now - last) / 1000, 0.1); last = now;
    const bpm = +$(&quot;bpm&quot;).value, k = +$(&quot;smooth&quot;).value;
    const x = (bpm - 50) / 90;                    // range: 50..140 bpm becomes 0..1
    const target = curves[$(&quot;curve&quot;).value](x);   // curve
    smoothed += (target - smoothed) * (1 - k);    // smoothing (per frame, to keep it short)
    const hue = 265 - smoothed * 240;             // violet at rest, ember when it races
    phase = (phase + dt * bpm / 60) % 1;
    const beat = Math.exp(-phase * 6);            // a sharp pulse on every beat

    const dpr = devicePixelRatio, w = c.clientWidth * dpr, h = c.clientHeight * dpr;
    if (c.width !== w || c.height !== h) { c.width = w; c.height = h; }
    g.clearRect(0, 0, w, h);
    const r = Math.min(w, h) * (0.28 + beat * 0.12);
    const grad = g.createRadialGradient(w / 2, h / 2, 0, w / 2, h / 2, r);
    grad.addColorStop(0, `hsl(${hue} 95% 70%)`); grad.addColorStop(1, `hsl(${hue} 95% 50% / 0)`);
    g.fillStyle = grad; g.beginPath(); g.arc(w / 2, h / 2, r, 0, Math.PI * 2); g.fill();

    $(&quot;bpmOut&quot;).textContent = bpm + &quot; bpm&quot;;
    $(&quot;out&quot;).textContent = `in ${x.toFixed(2)} → curve ${target.toFixed(2)} → smoothed ${smoothed.toFixed(2)} → hue ${hue.toFixed(0)}°`;
    requestAnimationFrame(frame);
  }
  requestAnimationFrame(frame);
&lt;/script&gt;
</code></pre>
<p>Crank the smoothing to the top and yank the slider: the color takes its time catching up. That lag is the whole job of smoothing, and in Noema it&#x27;s what keeps a jumpy sensor from turning a meditation into a disco.</p>
<h3>Sessions, meditations and playlists</h3>
<p>There are 24 built-in experiences, including 8 meditations of 1 to 10 minutes. A session can run from 10 seconds to hours, with an optional session arc of phases and intensity. Playlists chain experiences with crossfades scheduled on the audio clock, and two come built in: <strong>Noema — Inner Cosmos</strong> and <strong>Small Pauses</strong>.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/noema/mac-explore-light.webp" alt="Mac Explore screen in the light theme: the Noema Bloom featured session, an Environments row and a Meditations row, with the artwork staying dark"/></p>
<p><em>Mac Explore in the light theme, a Montage recreation. The artwork stays dark by design.</em></p>
<h3>Surprise, and Keep</h3>
<p>My favorite button. <strong>Surprise</strong> sits on Live, the Composer, Sound Lab, Visual Lab and Home, and offers <strong>Surprise session</strong>, <strong>Surprise sound</strong> or <strong>Surprise visual</strong>. In Live, the swap happens during playback with a crossfade, and <strong>Keep</strong> saves what you like. <strong>Explore</strong> goes one further and reshuffles the visual, the sound or both every 30 seconds, 1 minute or 2 minutes, scheduled on the engine&#x27;s transport clock so nothing fires while you&#x27;re paused.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/noema/surprise.webp" alt="On iPhone Live, Surprise, then Surprise visual dissolves Noema Bloom into Halo Orbit, then Surprise, then Keep saves it and the note reads Kept"/></p>
<p><em>Surprise visual during playback, then Keep: Noema Bloom dissolves into Halo Orbit over 2.5 seconds. A Montage recreation with synthetic values.</em></p>
<h2>A real heartbeat, an honest simulator, files that travel</h2>
<p>On Apple Watch, Noema reads live heart rate from a workout session you start yourself and sends it to the iPhone as a real signal. The watch also works as a now-playing remote with Crown volume, has a native Bloom visual, and can mirror the rendered visuals.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/noema/screenshot-2.webp" alt="iPhone Live view playing Deep Flow in the Noema Bloom world, with Apple Watch heart rate, guided breathing and the session-arc phases"/></p>
<p><em>iPhone Live playing Deep Flow, a Montage recreation. The heart rate and breathing values are synthetic.</em></p>
<p>No watch? No sensor? No problem, and no pretending either. The <strong>signal simulator</strong> drives heart rate, breathing, depth, tilt and microphone level, and every simulated value is labeled <strong>Simulated</strong> on screen. That label is the &quot;nothing is faked&quot; rule again, applied to the one place where faking would be easiest.</p>
<p>And everything you make travels. Presets, experiences and playlists export to <code>.noema</code> files that open on every platform. Make a meditation on the Mac, open it on Android.</p>
<h2>Try it in five moves</h2>
<p>If you get a build in front of you, this is the tour I&#x27;d give you:</p>
<ol>
<li><strong>Home › Surprise › Surprise session.</strong> A random 3-minute session starts. Move your finger or mouse over the visuals. In Live, open <strong>Surprise</strong> again to swap the sound or the visual, or turn on <strong>Explore</strong>.</li>
<li><strong>Home › Meditations › 1-Minute Reset.</strong> Breathe with the bloom.</li>
<li><strong>Settings › Signal simulator.</strong> Turn on heart rate and play <strong>Heart Coherence</strong>: the colors follow the simulated pulse. With an Apple Watch, start a session on the watch instead.</li>
<li><strong>Visual Lab › Randomize › Shapes.</strong> Then pause the animation and tweak the parameters.</li>
<li><strong>Composer.</strong> Pick a sound and a visual, turn the session arc off, choose 1 minute and save.</li>
</ol>
<h2>Under the hood</h2>
<p>Four apps, one brain. The architecture comes down to four sentences:</p>
<ul>
<li><strong>One engine everywhere.</strong> A portable C++17 DSP engine with a C API, compiled natively for Apple and Android and to WebAssembly (in an AudioWorklet) for the desktop app. Imported files and synthesized layers go through the same mix, limiter and analysis.</li>
<li><strong>One renderer everywhere.</strong> The visual engine (TypeScript, three.js 0.187 and GLSL) builds into a single self-contained WebGL2 <code>index.html</code> that each app hosts in its web view and drives over a small bridge.</li>
<li><strong>One data format.</strong> Versioned JSON schemas cover sounds, visuals, experiences, playlists and settings. The parameter and signal registries generate the editors on every platform.</li>
<li><strong>The audio clock is in charge.</strong> Phases, automation, playlist items, transitions and Explore are scheduled in transport time, not with UI timers.</li>
</ul>
<p>Here&#x27;s how a sound becomes a picture:</p>
<pre><code class="language-text"> synth layers ───┐
                 ├──► mix: scenes · transitions · limiter ──► audio out
 imported audio ─┘                    │
                                      ▼
                      analysis: bands · onsets · tempo ──── analysis frames ────┐
                                      │                                         ▼
 signals ─────────────────► signal and mapping engine ── visual params ──► WebGL2 renderer
   touch · motion · breathing         │                                   three.js · GLSL
   mic · Watch heart rate · simulator └── sound params ──► back into the synth layers
</code></pre>
<p>The native shells (SwiftUI, Compose, Electron) own the screens, the editors, the sensors and the JSON library with <code>.noema</code> import and export. Everything that makes sound or light is shared.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/noema/hero.webp" alt="A Mac playing the Expansion session full-bleed in the Fractal Universe world under glass controls, next to an iPhone playing Deep Flow in the Noema Bloom world, on a deep indigo backdrop"/></p>
<table><thead><tr><th>Platform</th><th>Built with</th><th>Minimum</th></tr></thead><tbody><tr><td><strong>iPhone · iPad · Mac</strong></td><td>SwiftUI (Swift 6), AVAudioEngine, WKWebView</td><td>iOS, iPadOS and macOS 26</td></tr><tr><td><strong>Apple Watch</strong></td><td>SwiftUI, HealthKit workout session, WatchConnectivity</td><td>watchOS 26</td></tr><tr><td><strong>Android</strong></td><td>Kotlin, Jetpack Compose (Material 3), NDK and JNI, AAudio, MediaCodec</td><td>Android 10 (API 29)</td></tr><tr><td><strong>Windows (and macOS desktop)</strong></td><td>Electron and React, the engine as WebAssembly in an AudioWorklet</td><td>Windows 10 or 11, x64</td></tr></tbody></table>
<p>The repo is laid out the same way:</p>
<pre><code class="language-text">Noema/
├── schemas/    shared JSON schemas, parameter and signal registries, built-in content
├── engine/     C++17 DSP engine, C API, doctest tests and the noema-analyze and noema-render tools
├── renderer/   TypeScript and three.js visual engine → one self-contained index.html
├── apple/      SwiftUI app for iOS, iPadOS and macOS, plus the watchOS companion (XcodeGen)
├── android/    Kotlin and Compose app (NDK and JNI, AAudio)
├── desktop/    Electron app for Windows and macOS (engine as WebAssembly)
├── design/     tokens, brand mark and the six app-icon variants
├── samples/    the demo track and decoder test fixtures
└── scripts/    build, test and schema-validation scripts
</code></pre>
<p>Two details I like. The renderer runs deterministically with <code>?clock=manual</code>, which is how frames can be rendered offline. And the Windows installer is built on macOS, no Wine involved:</p>
<pre><code class="language-sh">scripts/build-renderer.sh   # build the visual engine into one HTML file and copy it into the Apple and Android apps
scripts/test-all.sh         # schemas, engine, renderer, Apple, Android and desktop unit tests
scripts/build-desktop.sh    # the unsigned Windows x64 installer, built on macOS without Wine
</code></pre>
<p><code>test-all.sh</code> covers the engine (doctest, including a zero-allocation real-time test), the renderer (vitest, including 200-seed schema validation of the randomizer), Apple (Swift Testing on macOS and the iOS simulator), Android (JVM), the desktop app (vitest, including a WebAssembly engine smoke test) and schema validation of all built-in content. UI flows are tested by hand.</p>
<h3>Real captures</h3>
<p>Most images above are recreations. These two aren&#x27;t: they&#x27;re screenshots of the running v1.0.0 app on the Android emulator.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/noema/android-home.webp" alt="Android home screen with the featured session and rows of experiences, a real v1.0.0 capture"/></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/noema/screenshot-3.webp" alt="Android Live view playing Deep Flow, a real v1.0.0 capture"/></p>
<h2>Privacy, in five lines</h2>
<ul>
<li><strong>No network.</strong> The apps contain no network client and make no network requests.</li>
<li><strong>No accounts, analytics or ads.</strong> There is nothing to sign in to and nothing is tracked.</li>
<li><strong>Sensor data stays on your devices.</strong> Heart rate, motion and microphone level are used live and never sent anywhere. Heart rate travels only from your Apple Watch to Noema on your iPhone.</li>
<li><strong>Health is opt-in.</strong> A workout is saved to Apple Health only when you turn on <strong>Save to Health</strong>.</li>
<li><strong>No medical claims.</strong> Noema is an audiovisual experience, not a health or medical product. The meditations are for breathing with a bloom, not for diagnosing anything.</li>
</ul>
<h2>What&#x27;s not there yet</h2>
<p>Noema is at v1.0.1. The Apple apps run on device; Android and Windows are in testing. Here&#x27;s the honest hardware table, as of the latest README:</p>
<table><thead><tr><th>Surface</th><th>Status</th></tr></thead><tbody><tr><td><strong>iPhone · iPad · Mac</strong></td><td>Runs on device (tested on iPhone 17 Pro, iPad Pro 13&quot; and macOS)</td></tr><tr><td><strong>Apple Watch</strong></td><td>Built and installed on device, with the heart-rate relay to the iPhone. Remote, native Bloom and mirror bandwidth and battery are unmeasured</td></tr><tr><td><strong>Android</strong></td><td>Runs on the emulator (API 37). Phone testing in progress</td></tr><tr><td><strong>Windows</strong></td><td>Installer built on macOS. Testing on Windows in progress</td></tr><tr><td><strong>Depth (LiDAR, ARCore)</strong></td><td>Not built. The depth signals come only from the simulator</td></tr><tr><td><strong>Heart rate on Wear OS</strong></td><td>Not built. Simulator only</td></tr></tbody></table>
<p>A few more rough edges:</p>
<ul>
<li><strong>Unsigned desktop builds.</strong> The Windows installer and the macOS desktop zip aren&#x27;t signed, so SmartScreen and Gatekeeper warn the first time you open them.</li>
<li><strong>Basic editors.</strong> The lab editors are forms generated from the registries, and the tempo estimate stays low-confidence on ambient material by design.</li>
<li><strong>Number formatting.</strong> Android writes numbers as <code>1.0</code> where Apple writes <code>1</code> and drops unknown keys, so exported documents are equal in meaning but not byte for byte.</li>
</ul>
<p>And what&#x27;s next on the roadmap:</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" disabled=""/> Device testing of the Android phone and Windows builds, and a signed desktop installer</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> A horizontal playlist timeline with session-arc and automation editing</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Three-panel lab layouts with quick and advanced modes</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Real depth providers from LiDAR and ARCore</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Standalone audio on Apple Watch, and a Wear OS companion for heart rate</li>
</ul>
<p>Noema has its own card on the <a href="https://www.0x1ad2.dev/projects?project=noema">projects page</a>, with the demo loop, the explainer and the stack at a glance.</p>
<blockquote>
<p>Curious about the source? It&#x27;s private, but access can be granted to anyone interested in contributing. <a href="https://www.0x1ad2.dev/contact">Get in touch</a>.</p>
</blockquote>]]></content:encoded>
    </item>
    <item>
      <title>🎛️ Wavr: from first loop to finished WAV</title>
      <link>https://www.0x1ad2.dev/blog/wavr</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/wavr</guid>
      <pubDate>Wed, 25 Nov 2026 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>Wavr takes you from a first loop to a finished WAV on Mac, iPhone and iPad. Drop loops on a multitrack timeline, record and synthesize your own sounds, mix with real effects and perform in a clip grid, offline and with no account.</description>
      <category>projects</category>
      <category>creative</category>
      <category>swift</category>
      <category>swiftui</category>
      <category>audio</category>
      <content:encoded><![CDATA[<p>That last part is the whole pitch. You open the app and there is already a library of loops waiting, generated on the device the first time it runs. There&#x27;s no sign-in screen, no sample pack to fetch and no network involved. Then the path is the one in the title: drag a loop in, make a sound of your own, mix it, play it live and walk away with a WAV file.</p>
<p>This post follows that path. Along the way there are three small playgrounds you can poke at, rebuilt in a few lines of HTML, because a music app is easier to show than to describe.</p>
<p><a href="https://www.0x1ad2.dev/images/projects/wavr/explainer.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/wavr/explainer-poster.webp" alt="Watch the 31-second Wavr explainer. A Montage composition rebuilt from Wavr&#x27;s SwiftUI source with a synthetic demo session."/></a></p>
<p><em>The explainer: a 31.5-second, bar-locked 128 BPM tour, made with Montage. Click the poster to play it (this copy is muted).</em></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/wavr/hero.webp" alt="Wavr on Mac, iPad and iPhone: the arranger at the drop, Live Loops on iPad and the arranger on iPhone. Mockup rebuilt from source with Montage."/></p>
<p><em>Mockup rebuilt from source with Montage, using the synthetic &quot;Y2K Trance Intro&quot; session.</em></p>
<h2>Drag a loop and see where it lands</h2>
<p>The arranger is where a song comes together. The library sits on the left, track headers carry volume, pan, mute and solo, and colored section markers mark the intro, build, drop, breakdown and outro. Clips have cached waveforms, and you can move them in time and across tracks, resize, duplicate, split, copy, paste and delete them, with snap, zoom and undo and redo for every edit.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/wavr/screenshot-1.webp" alt="The Wavr arranger on the Mac at the drop, with Glass Keys being dragged onto a new track. Mockup rebuilt from source with Montage."/></p>
<p><em>The Mac arranger at the drop. Mockup rebuilt from source with Montage.</em></p>
<p>The drag itself is the tricky part, because on a touch screen your finger covers exactly the spot you&#x27;re aiming at. So Wavr draws a ghost clip: a dashed outline that shows the track, the bar and the length where the sound will land, snapping to the grid as you move. Drop it below the last track and you get a new track. Existing clips lift and glide between grid steps with a position badge, and the timeline scrolls when you hold near its edges.</p>
<p><a href="https://www.0x1ad2.dev/images/projects/wavr/demo.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/wavr/demo-poster.webp" alt="Dragging Glass Keys from the library onto a new track. Montage composition, 6 seconds."/></a></p>
<p><em>Glass Keys dragged from the library: the ghost snaps lane by lane and bar by bar, then lands below the last track as a new one. Click to play the 6-second loop.</em></p>
<p>Here is the idea in miniature. Drag the chip onto a lane and watch the ghost snap to whole bars, or drop it on the empty row to make a new track. It&#x27;s a sketch in HTML, not Wavr&#x27;s SwiftUI, but the rule is the same: show the landing spot before you let go.</p>
<pre><code class="language-html-live">&lt;style&gt;
  :root { color-scheme: dark; }
  body { margin: 0; padding: 12px; background: #000; color: #e8e8f0; font: 13px system-ui, sans-serif; user-select: none; }
  .chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; background: #16161e; border: 1px solid #3a3a4a; cursor: grab; touch-action: none; }
  .chip i { width: 8px; height: 8px; border-radius: 50%; background: #3ee6ff; }
  #grid { margin-top: 12px; border: 1px solid #222; border-radius: 8px; overflow: hidden; }
  .lane, .add { position: relative; height: 36px; border-bottom: 1px solid #1a1a1a; }
  .lane { background: repeating-linear-gradient(90deg, #08080c 0 calc(12.5% - 1px), #1c1c26 calc(12.5% - 1px) 12.5%); }
  .lane b { position: absolute; left: 6px; top: 11px; font-size: 11px; color: #666; z-index: 3; pointer-events: none; }
  .add { color: #555; display: flex; align-items: center; padding-left: 8px; border-bottom: 0; }
  .clip, .ghost { position: absolute; top: 4px; height: 28px; box-sizing: border-box; border-radius: 6px; padding: 0 6px; display: flex; align-items: center; font-size: 11px; }
  .clip { background: #3ee6ff26; border: 1px solid #3ee6ff; color: #bff6ff; z-index: 2; }
  .ghost { border: 1.5px dashed #3ee6ff; color: #3ee6ff; z-index: 4; pointer-events: none; }
  #badge { margin-top: 8px; color: #8a8aa0; }
&lt;/style&gt;
&lt;span class=&quot;chip&quot; id=&quot;chip&quot;&gt;&lt;i&gt;&lt;/i&gt;Glass Keys · 2 bars&lt;/span&gt;
&lt;div id=&quot;grid&quot;&gt;&lt;/div&gt;
&lt;div id=&quot;badge&quot;&gt;Drag the chip onto a lane, or onto the empty row.&lt;/div&gt;
&lt;script&gt;
  const BARS = 8, LEN = 2;
  const tracks = [&#x27;Drums&#x27;, &#x27;Bass&#x27;, &#x27;Lead&#x27;];
  const clips = [];
  const grid = document.getElementById(&#x27;grid&#x27;);
  const badge = document.getElementById(&#x27;badge&#x27;);
  const chip = document.getElementById(&#x27;chip&#x27;);
  let dragging = false;

  function box(host, bar, cls, text) {
    const el = document.createElement(&#x27;div&#x27;);
    el.className = cls;
    el.style.left = (bar / BARS * 100) + &#x27;%&#x27;;
    el.style.width = (LEN / BARS * 100) + &#x27;%&#x27;;
    el.textContent = text;
    host.appendChild(el);
    return el;
  }

  function render() {
    grid.innerHTML = &#x27;&#x27;;
    tracks.forEach((name) =&gt; {
      const lane = document.createElement(&#x27;div&#x27;);
      lane.className = &#x27;lane&#x27;;
      lane.innerHTML = &#x27;&lt;b&gt;&#x27; + name + &#x27;&lt;/b&gt;&#x27;;
      grid.appendChild(lane);
    });
    const add = document.createElement(&#x27;div&#x27;);
    add.className = &#x27;add&#x27;;
    add.textContent = &#x27;+ drop here for a new track&#x27;;
    grid.appendChild(add);
    const lanes = grid.querySelectorAll(&#x27;.lane&#x27;);
    clips.forEach((c) =&gt; box(lanes[c.lane], c.bar, &#x27;clip&#x27;, &#x27;Glass Keys&#x27;));
  }

  // Which lane and bar is the pointer over? lane === tracks.length means &quot;new track&quot;.
  function target(e) {
    const r = grid.getBoundingClientRect();
    if (e.clientX &lt; r.left || e.clientX &gt; r.right || e.clientY &lt; r.top || e.clientY &gt; r.bottom) return null;
    let lane = tracks.length;
    grid.querySelectorAll(&#x27;.lane&#x27;).forEach((l, i) =&gt; {
      const lr = l.getBoundingClientRect();
      if (e.clientY &gt;= lr.top &amp;&amp; e.clientY &lt; lr.bottom) lane = i;
    });
    const raw = (e.clientX - r.left) / r.width * BARS - LEN / 2;
    const bar = Math.max(0, Math.min(BARS - LEN, Math.round(raw)));
    return { lane, bar };
  }

  function showGhost(t) {
    grid.querySelectorAll(&#x27;.ghost&#x27;).forEach((g) =&gt; g.remove());
    if (!t) { badge.textContent = &#x27;Drag the chip onto a lane, or onto the empty row.&#x27;; return; }
    const host = t.lane &lt; tracks.length ? grid.querySelectorAll(&#x27;.lane&#x27;)[t.lane] : grid.querySelector(&#x27;.add&#x27;);
    box(host, t.bar, &#x27;ghost&#x27;, &#x27;Glass Keys&#x27;);
    const where = t.lane &lt; tracks.length ? tracks[t.lane] : &#x27;New track&#x27;;
    badge.textContent = where + &#x27; · bar &#x27; + (t.bar + 1) + &#x27; · &#x27; + LEN + &#x27; bars&#x27;;
  }

  chip.addEventListener(&#x27;pointerdown&#x27;, (e) =&gt; { dragging = true; chip.setPointerCapture(e.pointerId); });
  chip.addEventListener(&#x27;pointermove&#x27;, (e) =&gt; { if (dragging) showGhost(target(e)); });
  chip.addEventListener(&#x27;pointerup&#x27;, (e) =&gt; {
    dragging = false;
    const t = target(e);
    if (t) {
      if (t.lane === tracks.length) tracks.push(&#x27;Track &#x27; + (tracks.length + 1));
      clips.push(t);
    }
    render();
    showGhost(null);
  });
  render();
&lt;/script&gt;
</code></pre>
<h2>Bring your own sounds, or make them</h2>
<p>Every project starts from the starter library: loops at 120 BPM for house, techno, trance and dance, plus 90 BPM hip-hop and lo-fi loops. They&#x27;re synthesized in code on the first launch, so the pack contains no third-party samples and is CC0 by construction. Loops with a known BPM follow the project tempo.</p>
<p>When the starter pack runs out, there are three ways to add more:</p>
<ul>
<li><strong>Import.</strong> Bring audio in from Files or Finder, including drag and drop. Wavr spots duplicates by content hash, and you can filter by genre, BPM and key, see recently used sounds, and rename, tag and fix BPM and key by hand.</li>
<li><strong>Record.</strong> The Quick Recorder has an explicit start, a live level meter and the recorded waveform. Trim, normalize, fade in and out, then save the take to the library and drop it at the playhead. It records to a separate file and never touches the source audio.</li>
<li><strong>Synthesize.</strong> The Sound Creator is a polyphonic synth with sine, triangle, square and saw waves, white, pink and brown noise, an ADSR envelope, a low, high or band-pass filter, detune, pan and an LFO. It comes with 11 beginner presets (Soft Flute among them), a randomize button that stays safe, your own presets and a step-pattern loop editor of up to 4 bars. Play it from a keyboard, program a loop in the step grid and render it to audio for the library and the song.</li>
</ul>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/wavr/iphone-recorder-library-export.webp" alt="The Recorder, the Sounds drawer and the Export sheet on iPhone. Simulator captures with demo data."/></p>
<p><em>The Recorder, the Sounds drawer under the arranger, and the Export sheet on iPhone. Simulator captures with demo data.</em></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/wavr/screenshot-3.webp" alt="The Sound Creator on iPhone in Advanced mode. Simulator capture with demo data."/></p>
<p><em>The Sound Creator on iPhone. Simulator capture with demo data.</em></p>
<p>On iPad and Mac there is one optional extra: a <a href="https://freesound.org">Freesound</a> search with your own API key. It only offers CC0 and CC BY sounds, and it keeps the license and attribution with each sound so you can credit CC BY authors. (Wavr isn&#x27;t affiliated with or endorsed by Freesound.)</p>
<h2>Mix with a real effect chain</h2>
<p>Every track gets its own chain: EQ, low-pass, high-pass, a tempo-synced delay, reverb, distortion and a compressor, each with bypass and presets. The mixer puts every channel&#x27;s chain and meter side by side, with track and master meters, a clip indicator and a master limiter at the end.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/wavr/ipad-mixer-sound-creator.webp" alt="The mixer and the Sound Creator on iPad. Simulator captures with demo data."/></p>
<p><em>The mixer and the Sound Creator on iPad. Simulator captures with demo data.</em></p>
<h2>Perform it in a clip grid</h2>
<p>Live Loops turns the song into a grid of tracks by scenes that you launch in time with the transport. Launch a whole scene or a single slot, quantized to none, 1 beat, or 1, 2 or 4 bars. The handiest button is <strong>From Arrangement</strong>, which builds one scene per section of the song you just arranged, so the intro, build, drop and breakdown are ready to play live.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/wavr/screenshot-2.webp" alt="Live Loops on iPad: the Drop playing, the Breakdown queued and the FX pad in use. Mockup rebuilt from source with Montage."/></p>
<p><em>Live Loops on iPad, with the Drop playing and the Breakdown queued. Mockup rebuilt from source with Montage.</em></p>
<p>Quantized launch is the thing that makes a clip grid feel musical: you tap early and the scene waits for the next boundary. Try it below. The transport runs at 128 BPM in 4/4. Pick a quantize value, tap a scene, and it blinks until the next beat or bar line, then takes over. With <strong>None</strong> it switches the moment you tap.</p>
<pre><code class="language-html-live">&lt;style&gt;
  :root { color-scheme: dark; }
  body { margin: 0; padding: 12px; background: #000; color: #e8e8f0; font: 13px system-ui, sans-serif; user-select: none; }
  .top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  #clock { font: 600 20px ui-monospace, monospace; min-width: 4.5em; }
  .beats { display: flex; gap: 6px; }
  .beats span { width: 10px; height: 10px; border-radius: 50%; background: #222; }
  .beats span.on { background: #b06bff; box-shadow: 0 0 10px #b06bff; }
  select { background: #16161e; color: #e8e8f0; border: 1px solid #3a3a4a; border-radius: 6px; padding: 4px 6px; font: inherit; }
  .grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
  .scene { padding: 18px 6px; border-radius: 10px; border: 1px solid #2a2a38; background: #0c0c12; color: #aaa; font: 600 13px system-ui, sans-serif; cursor: pointer; }
  .scene.playing { background: #b06bff; border-color: #b06bff; color: #000; box-shadow: 0 0 18px #b06bff88; }
  .scene.queued { border-color: #b06bff; color: #e8e8f0; animation: blink 0.25s steps(2) infinite; }
  @keyframes blink { 50% { border-color: #2a2a38; } }
  #status { margin-top: 10px; color: #8a8aa0; min-height: 1.2em; }
&lt;/style&gt;
&lt;div class=&quot;top&quot;&gt;
  &lt;div id=&quot;clock&quot;&gt;1.1&lt;/div&gt;
  &lt;div class=&quot;beats&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;label&gt;Quantize
    &lt;select id=&quot;q&quot;&gt;
      &lt;option value=&quot;0&quot;&gt;None&lt;/option&gt;
      &lt;option value=&quot;1&quot;&gt;1 beat&lt;/option&gt;
      &lt;option value=&quot;4&quot; selected&gt;1 bar&lt;/option&gt;
      &lt;option value=&quot;8&quot;&gt;2 bars&lt;/option&gt;
      &lt;option value=&quot;16&quot;&gt;4 bars&lt;/option&gt;
    &lt;/select&gt;
  &lt;/label&gt;
&lt;/div&gt;
&lt;div class=&quot;grid&quot; id=&quot;grid&quot;&gt;&lt;/div&gt;
&lt;div id=&quot;status&quot;&gt;Tap a scene.&lt;/div&gt;
&lt;script&gt;
  const BPM = 128, SECONDS_PER_BEAT = 60 / BPM;
  const scenes = [&#x27;Intro&#x27;, &#x27;Build&#x27;, &#x27;Drop&#x27;, &#x27;Breakdown&#x27;];
  const grid = document.getElementById(&#x27;grid&#x27;);
  const clock = document.getElementById(&#x27;clock&#x27;);
  const dots = document.querySelectorAll(&#x27;.beats span&#x27;);
  const status = document.getElementById(&#x27;status&#x27;);
  const start = performance.now();
  let playing = 0, queued = null, launchAt = 0;

  const beatsNow = () =&gt; (performance.now() - start) / 1000 / SECONDS_PER_BEAT;
  const position = (b) =&gt; (Math.floor(b / 4) + 1) + &#x27;.&#x27; + (Math.floor(b % 4) + 1);

  const buttons = scenes.map((name, i) =&gt; {
    const b = document.createElement(&#x27;button&#x27;);
    b.className = &#x27;scene&#x27;;
    b.textContent = name;
    b.addEventListener(&#x27;click&#x27;, () =&gt; {
      const q = Number(document.getElementById(&#x27;q&#x27;).value);
      const now = beatsNow();
      // The heart of quantized launch: wait for the next multiple of q beats.
      launchAt = q ? Math.ceil(now / q + 1e-9) * q : now;
      queued = i;
    });
    grid.appendChild(b);
    return b;
  });

  function frame() {
    const b = beatsNow();
    if (queued !== null &amp;&amp; b &gt;= launchAt) { playing = queued; queued = null; }
    clock.textContent = position(b);
    dots.forEach((d, i) =&gt; d.classList.toggle(&#x27;on&#x27;, i === Math.floor(b % 4)));
    buttons.forEach((btn, i) =&gt; {
      btn.classList.toggle(&#x27;playing&#x27;, i === playing);
      btn.classList.toggle(&#x27;queued&#x27;, i === queued);
    });
    status.textContent = queued === null
      ? &#x27;Playing &#x27; + scenes[playing] + &#x27;.&#x27;
      : &#x27;Playing &#x27; + scenes[playing] + &#x27; · &#x27; + scenes[queued] + &#x27; launches at &#x27; + position(launchAt);
    requestAnimationFrame(frame);
  }
  requestAnimationFrame(frame);
&lt;/script&gt;
</code></pre>
<p>Then there&#x27;s the FX pad, which is pure fun. It&#x27;s an XY pad over the whole mix: X sweeps a resonant filter, low-pass to the left and high-pass to the right, and Y adds a dotted-eighth echo. Let go and it springs back to neutral, unless <strong>Hold</strong> is on.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/wavr/demo-xy-pad.webp" alt="A finger on the Live Loops FX pad: the low-pass closes and the Drop dims, then the high-pass and echo open and it flares. Montage composition."/></p>
<p><em>Sweeping the FX pad during the Drop. Montage composition; the readout follows the app&#x27;s FX state.</em></p>
<p>Below is the same gesture with sound, as a Web Audio sketch. Press <strong>Start</strong> for a 128 BPM arpeggio, then drag on the pad. Center is neutral, left closes a low-pass, right opens a high-pass, and up feeds a dotted-eighth echo (three sixteenths at 128 BPM is about 0.35 seconds). Mind your volume.</p>
<pre><code class="language-html-live">&lt;style&gt;
  :root { color-scheme: dark; }
  body { margin: 0; padding: 12px; background: #000; color: #e8e8f0; font: 13px system-ui, sans-serif; user-select: none; }
  .row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
  button { background: #16161e; color: #e8e8f0; border: 1px solid #3a3a4a; border-radius: 8px; padding: 6px 12px; font: inherit; cursor: pointer; }
  button[aria-pressed=&quot;true&quot;] { background: #3ee6ff; color: #000; border-color: #3ee6ff; }
  #pad { position: relative; width: 100%; max-width: 300px; aspect-ratio: 1; border-radius: 14px; border: 1px solid #2a2a38; background: radial-gradient(circle, #14141c, #040406); touch-action: none; cursor: crosshair; }
  #pad::before { content: &#x27;&#x27;; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 1px dashed #2a2a38; }
  .lbl { position: absolute; font-size: 10px; color: #555; }
  #dot { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: #3ee6ff; box-shadow: 0 0 22px #3ee6ff; left: 50%; top: 100%; transition: left .3s cubic-bezier(.3,1.6,.5,1), top .3s cubic-bezier(.3,1.6,.5,1); }
  #pad.active #dot { transition: none; }
  #read { margin-top: 8px; color: #8a8aa0; font-variant-numeric: tabular-nums; }
&lt;/style&gt;
&lt;div class=&quot;row&quot;&gt;
  &lt;button id=&quot;start&quot;&gt;Start&lt;/button&gt;
  &lt;button id=&quot;hold&quot; aria-pressed=&quot;false&quot;&gt;Hold&lt;/button&gt;
&lt;/div&gt;
&lt;div id=&quot;pad&quot;&gt;
  &lt;span class=&quot;lbl&quot; style=&quot;left:6px;bottom:6px&quot;&gt;low-pass&lt;/span&gt;
  &lt;span class=&quot;lbl&quot; style=&quot;right:6px;bottom:6px&quot;&gt;high-pass&lt;/span&gt;
  &lt;span class=&quot;lbl&quot; style=&quot;left:50%;top:6px;transform:translateX(-50%)&quot;&gt;echo&lt;/span&gt;
  &lt;div id=&quot;dot&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&quot;read&quot;&gt;Neutral. Press Start for sound.&lt;/div&gt;
&lt;script&gt;
  const BPM = 128, EIGHTH = 60 / BPM / 2;
  const NOTES = [57, 60, 64, 67, 69, 67, 64, 60];
  const pad = document.getElementById(&#x27;pad&#x27;), dot = document.getElementById(&#x27;dot&#x27;), read = document.getElementById(&#x27;read&#x27;);
  const holdBtn = document.getElementById(&#x27;hold&#x27;);
  let ctx = null, filter, wet, next = 0, step = 0, hold = false, down = false;

  function startAudio() {
    if (ctx) return;
    ctx = new AudioContext();
    filter = ctx.createBiquadFilter();
    filter.type = &#x27;lowpass&#x27;; filter.frequency.value = 20000; filter.Q.value = 8;
    const delay = ctx.createDelay(1);
    delay.delayTime.value = EIGHTH * 1.5;          // dotted eighth
    const feedback = ctx.createGain(); feedback.gain.value = 0.45;
    wet = ctx.createGain(); wet.gain.value = 0;
    const out = ctx.createGain(); out.gain.value = 0.2;
    filter.connect(out); filter.connect(wet);
    wet.connect(delay); delay.connect(feedback); feedback.connect(delay); delay.connect(out);
    out.connect(ctx.destination);
    next = ctx.currentTime + 0.05;
    setInterval(schedule, 25);
  }

  // Look-ahead scheduler: queue notes a little ahead of the audio clock.
  function schedule() {
    while (next &lt; ctx.currentTime + 0.1) {
      const osc = ctx.createOscillator(), env = ctx.createGain();
      osc.type = &#x27;sawtooth&#x27;;
      osc.frequency.value = 440 * Math.pow(2, (NOTES[step % NOTES.length] - 69) / 12);
      env.gain.setValueAtTime(0.0001, next);
      env.gain.exponentialRampToValueAtTime(0.5, next + 0.01);
      env.gain.exponentialRampToValueAtTime(0.0001, next + EIGHTH * 0.9);
      osc.connect(env); env.connect(filter);
      osc.start(next); osc.stop(next + EIGHTH);
      next += EIGHTH; step++;
    }
  }

  // x and y run from 0 to 1; (0.5, 0) is neutral.
  function apply(x, y) {
    dot.style.left = (x * 100) + &#x27;%&#x27;;
    dot.style.top = ((1 - y) * 100) + &#x27;%&#x27;;
    let label;
    if (Math.abs(x - 0.5) &lt; 0.02) { label = &#x27;Filter open&#x27;; }
    else if (x &lt; 0.5) { label = &#x27;Low-pass &#x27; + Math.round(200 * Math.pow(100, x * 2)) + &#x27; Hz&#x27;; }
    else { label = &#x27;High-pass &#x27; + Math.round(20 * Math.pow(200, (x - 0.5) * 2)) + &#x27; Hz&#x27;; }
    const echo = Math.round(y * 100);
    read.textContent = (label === &#x27;Filter open&#x27; &amp;&amp; echo === 0 ? &#x27;Neutral&#x27; : label + &#x27; · echo &#x27; + echo + &#x27;%&#x27;) + (ctx ? &#x27;&#x27; : &#x27;. Press Start for sound.&#x27;);
    if (!ctx) return;
    const t = ctx.currentTime;
    if (x &lt; 0.5) { filter.type = &#x27;lowpass&#x27;; filter.frequency.setTargetAtTime(200 * Math.pow(100, x * 2), t, 0.02); }
    else { filter.type = &#x27;highpass&#x27;; filter.frequency.setTargetAtTime(20 * Math.pow(200, (x - 0.5) * 2), t, 0.02); }
    wet.gain.setTargetAtTime(y * 0.8, t, 0.02);
  }

  function fromEvent(e) {
    const r = pad.getBoundingClientRect();
    const x = Math.min(1, Math.max(0, (e.clientX - r.left) / r.width));
    const y = Math.min(1, Math.max(0, 1 - (e.clientY - r.top) / r.height));
    apply(x, y);
  }

  pad.addEventListener(&#x27;pointerdown&#x27;, (e) =&gt; { down = true; pad.classList.add(&#x27;active&#x27;); pad.setPointerCapture(e.pointerId); fromEvent(e); });
  pad.addEventListener(&#x27;pointermove&#x27;, (e) =&gt; { if (down) fromEvent(e); });
  pad.addEventListener(&#x27;pointerup&#x27;, () =&gt; { down = false; pad.classList.remove(&#x27;active&#x27;); if (!hold) apply(0.5, 0); });
  document.getElementById(&#x27;start&#x27;).addEventListener(&#x27;click&#x27;, (e) =&gt; { startAudio(); e.target.textContent = &#x27;Playing&#x27;; apply(0.5, 0); });
  holdBtn.addEventListener(&#x27;click&#x27;, () =&gt; {
    hold = !hold;
    holdBtn.setAttribute(&#x27;aria-pressed&#x27;, String(hold));
    if (!hold &amp;&amp; !down) apply(0.5, 0);
  });
  apply(0.5, 0);
&lt;/script&gt;
</code></pre>
<h2>Finish with a WAV</h2>
<p>The last step is the one in the name. Export renders the whole song, the loop region or a single section, offline, as WAV at 16 or 24-bit and 44.1 or 48 kHz, or as M4A (AAC). It shows progress, you can cancel it, and it checks disk space before it starts.</p>
<p>Export runs the song through the same audio graph as playback, so the WAV sounds exactly like what you heard. More on that in the engine section below.</p>
<p>Projects travel too. A <code>.wavr</code> file is a self-contained package that opens unchanged on Mac, iPhone and iPad, with autosave, and every project file is validated before it opens.</p>
<p>On a Mac the whole path fits on the keyboard:</p>
<table><thead><tr><th>Step</th><th>What you do</th><th>Shortcut</th></tr></thead><tbody><tr><td>1</td><td>New project</td><td>⌘N</td></tr><tr><td>2</td><td>Drag loops from the library onto the timeline and arrange them into sections</td><td></td></tr><tr><td>3</td><td>Record a take, or design a sound in the Sound Creator</td><td>R · ⌥⌘K</td></tr><tr><td>4</td><td>Open the mixer, set levels and add effects to each track</td><td>⌥⌘M</td></tr><tr><td>5</td><td>Open Live Loops, choose <strong>From Arrangement</strong> and play it scene by scene</td><td>⌥⌘L</td></tr><tr><td>6</td><td>Export the song, the loop region or a section</td><td>⌘E</td></tr></tbody></table>
<p>In Live Loops, keys 1 to 9 launch scenes and Space stops them all. On iPhone and iPad the same actions sit on the toolbar, in context menus and in the arranger&#x27;s <strong>⋯</strong> menu, and a tap adds a sound at the playhead.</p>
<h2>Made in Wavr</h2>
<p>To show the path working end to end, there are two complete sessions, recorded on a Mac from start to finish with the app&#x27;s own audio. The app builds each track from an empty project and exports it as a 60-second WAV.</p>
<ul>
<li><strong>Y2K Trance Intro.</strong> 128 BPM, 32 bars, in the Millennium theme. A supersaw pad, a pluck arp, kick and sub, hats, a clap, a lead hook, a riser and a downlifter, all from the starter library.</li>
<li><strong>Flute Beat.</strong> 90 BPM, 22 bars, in True Black. A flute melody and an 808-style sub programmed in the Sound Creator&#x27;s step grid, the Boom Bap Beat and Lazy Hats from the library, and reverb on the flute.</li>
</ul>
<p>Both are attached to the v1.2.0 release. On GitHub, the explainer&#x27;s soundtrack is bars 9 to 25 of the Y2K Trance Intro export, so the music in the video was made in the app it advertises.</p>
<h2>The same studio on a phone</h2>
<p>The iPhone layout keeps the arranger full screen, with the sounds in a drawer underneath, and turns Live Loops into big scene buttons, a slot row and the XY pad.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/wavr/iphone-arranger-live-loops.webp" alt="The arranger and Live Loops on iPhone. Simulator captures with demo data."/></p>
<p><em>The arranger and Live Loops on iPhone. Simulator captures with demo data.</em></p>
<h2>Five themes, two modes</h2>
<p>Wavr has five themes: <strong>True Black</strong> (the default, OLED black with luminous accents where the color comes from the clips), <strong>Neon Rave</strong> (glossy gunmetal with neon clips), <strong>Millennium</strong> (glossy Y2K blue chrome with candy-colored clips), <strong>Graphite</strong> (soft neutral grays) and <strong>Daylight</strong> (a bright, light workspace).</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/wavr/themes.webp" alt="The five Wavr themes side by side: True Black, Neon Rave, Millennium, Graphite and Daylight. Composite of real captures."/></p>
<p><em>The five themes. A composite of real captures.</em></p>
<p>There are also two interface modes. <strong>Simple</strong>, the default for new users, shows the essentials: loops, levels, presets and one-tap export. <strong>Advanced</strong> adds the synth&#x27;s LFO and pitch sweeps, per-track effect chains, pan, clip fades, export format and sample rate, and Live Loops launch quantization. Simple only hides controls. Switch back and every setting is where you left it, and a project sounds the same in both modes.</p>
<h2>Under the hood</h2>
<p>Wavr is written in Swift 6 and SwiftUI, with AVFoundation and AVAudioEngine for sound. It is one universal app target, generated by XcodeGen from <code>project.yml</code>, plus one local Swift package, <code>WavrKit</code>, with three modules:</p>
<ul>
<li><strong>WavrCore</strong> (Foundation only) owns the domain model, musical time, <code>ProjectEditor</code> with undo, <code>.wavr</code> persistence and validation.</li>
<li><strong>WavrAudio</strong> (WavrCore and AVFoundation) owns the realtime engine, transport, scheduling, effects, export, recording, the synth, the sound library and the starter pack.</li>
<li><strong>WavrUI</strong> (SwiftUI) owns the design system, the components and every feature screen.</li>
</ul>
<p>It has no third-party dependencies. The signal path looks like this:</p>
<pre><code class="language-text">Library            starter pack, imports, recordings, synth renders
   │
   ▼
Project            .wavr package, positions in beats
   │
   ▼
ScheduleBuilder    sample-accurate segments
   │
   ▼
RenderGraph        one AVAudioEngine
   ├──▶ Speakers          live playback
   └──▶ OfflineRenderer   WAV or M4A export
</code></pre>
<p>A handful of decisions carry the whole thing:</p>
<ul>
<li><strong>One graph for playback and export.</strong> <code>RenderGraph</code> builds one <code>AVAudioEngine</code> with a player, an effect chain and a mixer per track, a master bus and a safety limiter. <code>OfflineRenderer</code> drives that same graph for export. That&#x27;s why the WAV can&#x27;t drift from what you heard: it is literally the same graph.</li>
<li><strong>Musical time is beats.</strong> Positions are stored in beats, and <code>TimeMap</code> is the only place that converts beats to seconds and sample frames. Change the tempo and every clip keeps its musical position.</li>
<li><strong>One clock, scheduled ahead.</strong> All track players start at the same <code>AVAudioTime</code>, and clip segments are scheduled by sample time on that shared timeline, about 1 to 2 seconds ahead.</li>
<li><strong>Pure scheduling.</strong> <code>ScheduleBuilder</code> has no AVFoundation dependency. It turns the project into sample-accurate segments with gain, fades and declick ramps, which makes it unit-testable.</li>
<li><strong>Live edits without glitches.</strong> Mix and effect parameters apply live without rescheduling. Structural changes re-anchor playback from the current position.</li>
</ul>
<p>The &quot;beats are the truth&quot; rule is easiest to see in the tests. This is the opening of <code>TimeMapTests</code>, straight from the repo: at 120 BPM and 48 kHz, a beat is half a second and 24,000 frames.</p>
<pre><code class="language-swift">@Suite struct TimeMapTests {
    let map = TimeMap(bpm: 120, sampleRate: 48_000)

    @Test func beatsSecondsFrames() {
        #expect(map.secondsPerBeat == 0.5)
        #expect(map.framesPerBeat == 24_000)
        #expect(map.frames(fromBeats: 4) == 96_000)
        #expect(map.beats(fromFrames: 36_000) == 1.5)
        #expect(map.seconds(fromBeats: 8) == 4)
        #expect(map.beats(fromSeconds: 1) == 2)
        #expect(map.beats(fromBars: 2) == 8)
        #expect(map.bars(fromBeats: 6) == 1.5)
    }

    // … rounding, snapping, bar/beat and range tests follow
}
</code></pre>
<p>A project is a directory package that travels as one item. Wavr treats every opened package as untrusted: unsafe file names and out-of-range values are rejected, and older schema versions go through a migration hook.</p>
<pre><code class="language-text">My Song.wavr/
├── manifest.json   { &quot;format&quot;: &quot;wavr&quot;, &quot;schemaVersion&quot;: N, &quot;appVersion&quot;: &quot;…&quot; }
├── project.json    the Project (Codable, ISO-8601 dates): tempo, tracks, clips, effects, sections
└── Audio/          a copy of every audio file the project uses
</code></pre>
<p>On testing: there are 130 package tests in Swift Testing covering the core model, musical time, scheduling, rendering, effects, export and the synth, with offline renders that check timing, mixing, effects, export and synth pitch and length. On top of that, an end-to-end suite runs the same journeys on iPhone, iPad and macOS. The big one builds a song from a new project, records a take, renders a synth sound, quits and relaunches, then exports a WAV and reads it back to check that it is non-silent, stereo and the right length.</p>
<h2>Private by default</h2>
<ul>
<li><strong>Offline by default.</strong> No accounts, no analytics, no telemetry. The starter pack is generated on the device, and the only network client in the app is the optional Freesound search.</li>
<li><strong>Freesound only when you search.</strong> Your search terms and your own API key go to the Freesound API, and the preview of a sound you import is fetched from Freesound. The key lives in the Keychain. Nothing else leaves the device.</li>
<li><strong>Microphone only when you press Record.</strong> Recordings are written to separate files and never modify the source audio.</li>
<li><strong>Your files stay on your device.</strong> Projects, the library and your presets are stored locally.</li>
</ul>
<h2>What&#x27;s not there yet</h2>
<p>The README is honest about the rough edges, so here they are:</p>
<ul>
<li><strong>Not yet verified by ear or on hardware.</strong> The audio quality of live playback, the synth and the XY pad, physical devices and live Freesound calls haven&#x27;t been checked by hand yet. Today&#x27;s coverage is the 130 package tests and the end-to-end suite on simulators and macOS.</li>
<li><strong>Tempo following is varispeed.</strong> Loops at a different BPM change pitch, and per-clip transpose isn&#x27;t applied.</li>
<li><strong>Edits while playing.</strong> Structural changes restart playback from the current position with a short gap of about 30 ms. Mix and effect tweaks are seamless.</li>
<li><strong>Recording.</strong> No latency compensation when you record along with the song, the count-in is visual only, and macOS uses the system default input.</li>
<li><strong>Live Loops.</strong> &quot;None&quot; quantization launches about 0.3 seconds late, structural changes while performing restart the scenes, and the XY pad isn&#x27;t saved in the project or applied to exports.</li>
<li><strong>Elsewhere.</strong> Online search isn&#x27;t on iPhone yet and imports use the high-quality MP3 preview, the theme and mode are per device, glide is polyphonic rather than mono legato, and the step grid only toggles cells.</li>
</ul>
<p>Next on the roadmap: pitch-preserving time stretch and per-clip transpose, latency compensation and an audible count-in, online sound search on iPhone, track drag-to-reorder, and more UI tests, performance tests and a full accessibility and layout pass.</p>
<h2>Getting your hands on it</h2>
<p>Wavr runs on macOS 15 or later and on iOS and iPadOS 18 or later. The latest tagged release is v1.2.0; the touch-first drag and drop and the roomier Mac and iPad layout landed on main after that tag. There&#x27;s no store build. You build it from source with Xcode 27 (XcodeGen is only needed when <code>project.yml</code> changes), and with no third-party dependencies there is nothing else to install:</p>
<pre><code class="language-sh">open Wavr.xcodeproj   # pick the Wavr scheme and a Mac, iPhone or iPad destination
</code></pre>
<p>The macOS build is sandboxed and signed ad hoc for local runs. Running it on a physical iPhone or iPad needs your own development team in Xcode.</p>
<p>Wavr has its own card on the <a href="https://www.0x1ad2.dev/projects?project=wavr">projects page</a>, with the demo loop, the explainer and the stack at a glance.</p>
<blockquote>
<p>Curious about the source? It&#x27;s private, but access can be granted to anyone interested in contributing. <a href="https://www.0x1ad2.dev/contact">Get in touch</a>.</p>
</blockquote>]]></content:encoded>
    </item>
    <item>
      <title>🏠 Homey: home control with no cloud in the way</title>
      <link>https://www.0x1ad2.dev/blog/homey</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/homey</guid>
      <pubDate>Wed, 25 Nov 2026 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>Homey for Mac scans your LAN and draws the network as an interactive map. Your iPhone or iPad then takes over and controls WiZ lights and Denon or Marantz receivers directly, with rooms, scenes and automations, and no cloud service in between.</description>
      <category>projects</category>
      <category>apple</category>
      <category>swift</category>
      <category>swiftui</category>
      <category>networking</category>
      <category>local-first</category>
      <content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/homey/icon.webp" alt="The Homey app icon"/></p>
<p>Here&#x27;s the thing that bugged me: the lamp is ten feet away, on the same Wi-Fi as the phone in your hand, and the usual way to turn it on is a round trip through somebody else&#x27;s server. Homey skips the detour. No account, no cloud, no analytics. The Mac does the heavy scanning, the phone does the everyday controlling, and every packet stays on your own network.</p>
<p><a href="https://www.0x1ad2.dev/images/projects/homey/explainer.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/homey/explainer-poster.webp" alt="Watch the Homey explainer, a 32.5-second video made with Montage"/></a></p>
<p><em>The explainer, rebuilt from Homey&#x27;s SwiftUI source with synthetic data. Click to play.</em></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/homey/hero.webp" alt="Homey for Mac&#x27;s scan dashboard and topology map next to the iPhone Home screen"/></p>
<h2>Eleven ways to find a lightbulb</h2>
<p>Homey for Mac runs 11 discovery methods in parallel, from Bonjour and SSDP to an ICMP sweep, the ARP table, NetBIOS names and a 38-port service fingerprint. Each method sees a different slice of the house, so asking all of them at once is how you catch the quiet devices too.</p>
<table><thead><tr><th>Method</th><th>What it catches</th><th>Runs on</th></tr></thead><tbody><tr><td>mDNS / Bonjour</td><td>HomeKit, Google Cast, AirPlay, Hue, Shelly, ESPHome, Sonos, HEOS, printers, Home Assistant, MQTT…</td><td>iOS · Mac</td></tr><tr><td>SSDP / UPnP</td><td>TVs, receivers, Sonos, Hue bridges, routers</td><td>iOS · Mac</td></tr><tr><td>LAN sweep</td><td>Hosts on the subnet, via TCP probes on 80 and 443</td><td>iOS · Mac</td></tr><tr><td>WiZ UDP</td><td>WiZ bulbs and plugs, with MAC, module, firmware and light state</td><td>iOS · Mac</td></tr><tr><td>Matter</td><td>Matter nodes, commissioners and Thread border routers</td><td>iOS · Mac</td></tr><tr><td>Bluetooth LE</td><td>Nearby sensors and accessories, with live RSSI</td><td>iOS · Mac</td></tr><tr><td>ARP / neighbour table</td><td>Every host the Mac has talked to, with MAC and OUI vendor</td><td>Mac</td></tr><tr><td>ICMP / TCP sweep</td><td>Silent hosts that advertise nothing</td><td>Mac</td></tr><tr><td>Service fingerprinting</td><td>Open ports and banners across 38 curated ports, plus a device class</td><td>Mac</td></tr><tr><td>NetBIOS / LLMNR names</td><td>Windows, Samba, NAS and Linux host names</td><td>Mac</td></tr><tr><td>Gateway &amp; routes</td><td>Router, default route, DNS servers and Wi-Fi association</td><td>Mac</td></tr></tbody></table>
<p>Why does the Mac get the long list? Because iOS doesn&#x27;t allow the rest. Reading the kernel ARP table through <code>sysctl</code>, sweeping a subnet with ICMP and fingerprinting ports are Mac-only moves, and Homey for Mac registers those deeper scanners on top of the shared discovery core. iPhone and iPad run the six methods iOS allows (plus the built-in demo devices), so they&#x27;re never helpless on their own.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/homey/mac-scan.webp" alt="Homey for Mac mid-scan, with a progress bar per discovery method and a live feed of findings"/></p>
<p><em>Rebuilt from Homey for Mac&#x27;s SwiftUI views with a synthetic network, not a capture. Identifiers are blurred.</em></p>
<h3>One device, many witnesses</h3>
<p>Eleven scanners means the same receiver can turn up four times: Bonjour knows its IP, SSDP knows its model, ARP knows its MAC, the port scan knows it answers on 8080. Homey merges findings by identity, strongest first: <strong>MAC address → IPv4 address → Bluetooth peripheral identifier</strong>. When a later finding adds a key, for example ARP attaching a MAC to a Bonjour device that only had an IP, the records that now share a key are coalesced. One physical device, one row, all the evidence.</p>
<p>Step through a toy version of that rule below. Same key order; much less code than the real <code>DeviceMerger</code>.</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; padding: 16px; background: #000; color: #eee; font: 13px/1.4 system-ui, sans-serif; }
  button { background: #9D6AF9; color: #000; border: 0; border-radius: 999px; padding: 6px 14px; font-weight: 600; cursor: pointer; margin-right: 6px; }
  button.ghost { background: #222; color: #eee; }
  #next { color: #aaa; margin: 10px 0; font-family: ui-monospace, monospace; }
  .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
  .card { border: 1px solid #333; border-radius: 12px; padding: 10px; }
  .card.hit { border-color: #9D6AF9; box-shadow: 0 0 0 1px #9D6AF9; }
  .k { color: #888; } .m { display: inline-block; background: #1b1430; color: #c9b3ff; border-radius: 6px; padding: 1px 6px; margin: 2px 2px 0 0; font-size: 11px; }
&lt;/style&gt;
&lt;button id=&quot;step&quot;&gt;Next finding&lt;/button&gt;&lt;button id=&quot;reset&quot; class=&quot;ghost&quot;&gt;Reset&lt;/button&gt;
&lt;div id=&quot;next&quot;&gt;&lt;/div&gt;
&lt;div class=&quot;grid&quot; id=&quot;out&quot;&gt;&lt;/div&gt;
&lt;script&gt;
const findings = [
  { method: &quot;Bonjour&quot;, ip: &quot;192.0.2.24&quot;, name: &quot;Living Room AVR&quot; },
  { method: &quot;SSDP&quot;, ip: &quot;192.0.2.24&quot;, name: &quot;Denon AVR-X3800H&quot; },
  { method: &quot;WiZ UDP&quot;, ip: &quot;192.0.2.31&quot;, mac: &quot;02:00:5e:00:00:31&quot;, name: &quot;Desk lamp&quot; },
  { method: &quot;Bluetooth LE&quot;, ble: &quot;7F3A-21C0&quot;, name: &quot;Climate sensor&quot; },
  { method: &quot;ARP&quot;, ip: &quot;192.0.2.24&quot;, mac: &quot;02:00:5e:00:00:24&quot; },
  { method: &quot;Ports&quot;, ip: &quot;192.0.2.24&quot;, name: &quot;Denon (HTTP 8080)&quot; },
  { method: &quot;ICMP sweep&quot;, ip: &quot;192.0.2.31&quot; },
];
let devices = [], i = 0, lastHit = null;
// Strongest key first: MAC, then IPv4 (unless the MACs disagree), then the BLE identifier.
function match(d, f) {
  if (f.mac &amp;&amp; d.mac) return d.mac === f.mac;
  if (f.ip &amp;&amp; d.ip === f.ip) return true;
  return !!(f.ble &amp;&amp; d.ble === f.ble);
}
function absorb(d, f) {
  for (const k of [&quot;ip&quot;, &quot;mac&quot;, &quot;ble&quot;, &quot;name&quot;]) if (!d[k] &amp;&amp; f[k]) d[k] = f[k];
  d.methods = [...new Set([...(d.methods || []), ...(f.methods || [f.method])])];
  return d;
}
function step() {
  if (i &gt;= findings.length) return;
  const f = findings[i++];
  let d = devices.find(x =&gt; match(x, f));
  if (d) absorb(d, f); else devices.push(d = absorb({}, f));
  // Coalesce: records that now share a key become one device.
  devices = devices.filter(o =&gt; o === d || !(match(d, o) || match(o, d)) || (absorb(d, o), false));
  lastHit = d; render();
}
function render() {
  document.getElementById(&quot;next&quot;).textContent = i &lt; findings.length
    ? &quot;Next: &quot; + findings[i].method + &quot; → &quot; + JSON.stringify(findings[i]).replace(/&quot;method&quot;:&quot;[^&quot;]+&quot;,?/, &quot;&quot;)
    : &quot;All findings merged: &quot; + findings.length + &quot; findings, &quot; + devices.length + &quot; devices.&quot;;
  document.getElementById(&quot;out&quot;).innerHTML = devices.map(d =&gt;
    `&lt;div class=&quot;card ${d === lastHit ? &quot;hit&quot; : &quot;&quot;}&quot;&gt;&lt;b&gt;${d.name || &quot;Unknown host&quot;}&lt;/b&gt;&lt;br&gt;
     &lt;span class=&quot;k&quot;&gt;ip&lt;/span&gt; ${d.ip || &quot;–&quot;}&lt;br&gt;&lt;span class=&quot;k&quot;&gt;mac&lt;/span&gt; ${d.mac || &quot;–&quot;}&lt;br&gt;
     &lt;span class=&quot;k&quot;&gt;ble&lt;/span&gt; ${d.ble || &quot;–&quot;}&lt;br&gt;${d.methods.map(m =&gt; `&lt;span class=&quot;m&quot;&gt;${m}&lt;/span&gt;`).join(&quot;&quot;)}&lt;/div&gt;`).join(&quot;&quot;);
}
document.getElementById(&quot;step&quot;).onclick = step;
document.getElementById(&quot;reset&quot;).onclick = () =&gt; { devices = []; i = 0; lastHit = null; render(); };
render();
&lt;/script&gt;
</code></pre>
<h3>Then it draws you a map</h3>
<p>The merged list becomes an interactive topology: internet → gateway → subnet → Wi-Fi segment, access points and switches → hosts, with Bluetooth and Thread branches hanging off the side. My favorite detail is the honesty in the line styles. Links a scanner actually observed are solid; placements Homey had to guess are drawn as <em>inferred</em> edges. A map that tells you where it&#x27;s guessing is a map you can trust.</p>
<p><a href="https://www.0x1ad2.dev/images/projects/homey/demo.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/homey/demo-poster.webp" alt="The topology map blooming level by level, from the Internet node to the hosts"/></a></p>
<p><em>The topology map, level by level, on a synthetic network. Click for the 7-second loop.</em></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/homey/mac-topology-detail.webp" alt="Homey for Mac&#x27;s topology map zoomed in on the router, subnet, one Wi-Fi access point and its hosts"/></p>
<p><em>Rebuilt from Homey for Mac&#x27;s SwiftUI views with a synthetic network, not a capture.</em></p>
<p>On the Mac, the Devices section turns the same scan into a sortable table, with an inspector that lists identity, roles, open ports, services and the evidence from each method.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/homey/mac-devices.webp" alt="Homey for Mac&#x27;s Devices table with type, vendor, discovery methods, ports and signal, identifiers blurred"/></p>
<p><em>Rebuilt from Homey for Mac&#x27;s SwiftUI views with a synthetic network, not a capture. Identifiers are blurred.</em></p>
<h2>Handing the scan to your phone</h2>
<p>A map on the Mac is nice. A map on the phone in your hand is the point. When you choose <strong>Share Scan</strong> (&lt;kbd&gt;⇧⌘E&lt;/kbd&gt;), the Mac advertises the scan over Bonjour as <code>_homey-sync._tcp</code> and shows a 6-digit pairing code. On the iPhone or iPad you open the Discovery Wizard, tap <strong>Import from Mac</strong>, pick your Mac and type the code.</p>
<p>Two rules keep that handoff from becoming a party trick for your neighbors: the Mac only serves its snapshot to local addresses that present the current code, and the code <strong>rotates after 5 wrong attempts</strong>. You can&#x27;t brute-force a million combinations five guesses at a time. Prefer files? Export a <code>.homeyscan</code> with &lt;kbd&gt;⌘E&lt;/kbd&gt; and send it through Files or AirDrop; imported files and frames are capped at 32 MB and schema-checked.</p>
<p>Try guessing your way in:</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; padding: 16px; background: #000; color: #eee; font: 14px/1.4 system-ui, sans-serif; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .pane { border: 1px solid #333; border-radius: 14px; padding: 14px; }
  h4 { margin: 0 0 8px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #9D6AF9; }
  #code { font: 600 28px ui-monospace, monospace; letter-spacing: .2em; }
  input { width: 100%; box-sizing: border-box; background: #111; color: #fff; border: 1px solid #444; border-radius: 10px; padding: 8px; font: 18px ui-monospace, monospace; letter-spacing: .2em; }
  button { margin-top: 8px; width: 100%; background: #9D6AF9; border: 0; border-radius: 999px; padding: 8px; font-weight: 600; cursor: pointer; }
  #log { grid-column: 1 / -1; color: #aaa; font: 12px ui-monospace, monospace; white-space: pre-line; }
  .dots span { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #333; margin-right: 4px; }
  .dots span.used { background: #ff6b6b; }
&lt;/style&gt;
&lt;div class=&quot;pane&quot;&gt;&lt;h4&gt;Homey for Mac&lt;/h4&gt;&lt;div&gt;Pairing code&lt;/div&gt;&lt;div id=&quot;code&quot;&gt;&lt;/div&gt;&lt;div class=&quot;dots&quot; id=&quot;dots&quot;&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class=&quot;pane&quot;&gt;&lt;h4&gt;iPhone&lt;/h4&gt;&lt;input id=&quot;guess&quot; maxlength=&quot;6&quot; inputmode=&quot;numeric&quot; placeholder=&quot;000000&quot;&gt;&lt;button id=&quot;send&quot;&gt;Import from Mac&lt;/button&gt;&lt;/div&gt;
&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
&lt;script&gt;
const MAX_REJECTED = 5;
let code, wrong;
const log = t =&gt; (document.getElementById(&quot;log&quot;).textContent = t + &quot;\n&quot; + document.getElementById(&quot;log&quot;).textContent);
function issue() {
  code = String(Math.floor(Math.random() * 1e6)).padStart(6, &quot;0&quot;);
  wrong = 0; draw();
}
function draw() {
  document.getElementById(&quot;code&quot;).textContent = code.slice(0, 3) + &quot; &quot; + code.slice(3);
  document.getElementById(&quot;dots&quot;).innerHTML = Array.from({ length: MAX_REJECTED }, (_, n) =&gt; `&lt;span class=&quot;${n &lt; wrong ? &quot;used&quot; : &quot;&quot;}&quot;&gt;&lt;/span&gt;`).join(&quot;&quot;);
}
document.getElementById(&quot;send&quot;).onclick = () =&gt; {
  const g = document.getElementById(&quot;guess&quot;).value.replace(/\D/g, &quot;&quot;);
  if (g === code) { log(&quot;✓ Code accepted. Snapshot sent over the LAN.&quot;); issue(); return; }
  wrong++;
  if (wrong &gt;= MAX_REJECTED) { log(&quot;✗ &quot; + MAX_REJECTED + &quot; wrong codes. New code issued, the old one stops working.&quot;); issue(); }
  else { log(&quot;✗ Wrong code (&quot; + (MAX_REJECTED - wrong) + &quot; left before it rotates). Empty frame returned.&quot;); draw(); }
};
issue();
&lt;/script&gt;
</code></pre>
<p>Without a Mac, the wizard runs the iOS methods itself. Without a network at all, a labeled demo home on documentation-only addresses lets you explore every screen before you scan.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/homey/phones-discovery.webp" alt="Discovery Wizard, Network Map and Devices on iPhone"/></p>
<p><em>Real captures of the built-in demo home on iPhone: the Discovery Wizard, the Network Map and Devices.</em></p>
<h2>Real local control, no middleman</h2>
<p>This is where most &quot;local&quot; home apps quietly phone home. Homey doesn&#x27;t. Two device families get real drivers:</p>
<ul>
<li><strong>WiZ lights</strong> over UDP 38899, using <code>setPilot</code> and <code>getPilot</code> with retries: power, brightness, a color wheel, tunable white, every built-in WiZ dynamic scene, groups and live status polling.</li>
<li><strong>Denon and Marantz receivers</strong> over the HTTP interface on port 8080 (80 on older models), with a telnet fallback on port 23: zones, volume in dB, mute, inputs, sound modes and a speaker layout read from <code>CV?</code>.</li>
</ul>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/homey/phones-control.webp" alt="Lighting and the Denon AVR screen on iPhone, and the Denon AVR screen on iPad"/></p>
<p><em>Real captures of the built-in demo home: Lighting and Denon AVR on iPhone, Denon AVR on iPad.</em></p>
<p>The WiZ protocol is refreshingly small: one JSON datagram per change. This is the function in <code>WiZClient</code> that builds it, trimmed of the scene branch:</p>
<pre><code class="language-swift">static func payload(isOn: Bool, light: LightState?) -&gt; Data {
    var params: [String: Any] = [&quot;state&quot;: isOn]
    if isOn, let light {
        params[&quot;dimming&quot;] = max(10, min(100, Int(light.brightness)))
        switch light.mode {
        case .white:
            params[&quot;temp&quot;] = max(2200, min(6500, light.kelvin))
        case .color:
            var value: UInt64 = 0
            Scanner(string: light.colorHex).scanHexInt64(&amp;value)
            let rgb = (Int(value &gt;&gt; 16 &amp; 0xFF), Int(value &gt;&gt; 8 &amp; 0xFF), Int(value &amp; 0xFF))
            if rgb == (0, 0, 0) {
                // WiZ rejects an all-zero colour; fall back to the white temperature.
                params[&quot;temp&quot;] = max(2200, min(6500, light.kelvin))
            } else {
                params[&quot;r&quot;] = rgb.0
                params[&quot;g&quot;] = rgb.1
                params[&quot;b&quot;] = rgb.2
            }
        // case .scene: sends a sceneId
        }
    }
    let body: [String: Any] = [&quot;id&quot;: 1, &quot;method&quot;: &quot;setPilot&quot;, &quot;params&quot;: params]
    return (try? JSONSerialization.data(withJSONObject: body)) ?? Data()
}
</code></pre>
<p>And here it is again as a playground. Push the sliders past the limits and watch the clamps do their job, or pick pure black and see the fallback kick in:</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; padding: 16px; background: #000; color: #eee; font: 13px/1.5 system-ui, sans-serif; display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
  label { display: block; margin-bottom: 8px; color: #aaa; }
  input[type=range], select { width: 100%; accent-color: #9D6AF9; }
  select { background: #111; color: #eee; border: 1px solid #444; border-radius: 8px; padding: 4px; }
  pre { margin: 0; background: #0b0b0b; border: 1px solid #333; border-radius: 12px; padding: 12px; font: 12px/1.5 ui-monospace, monospace; color: #c9b3ff; white-space: pre-wrap; }
  .bulb { width: 56px; height: 56px; border-radius: 50%; margin: 4px 0 10px; box-shadow: 0 0 32px var(--glow, #000); background: var(--glow, #111); }
&lt;/style&gt;
&lt;div&gt;
  &lt;div class=&quot;bulb&quot; id=&quot;bulb&quot;&gt;&lt;/div&gt;
  &lt;label&gt;&lt;input type=&quot;checkbox&quot; id=&quot;on&quot; checked&gt; On&lt;/label&gt;
  &lt;label&gt;Mode &lt;select id=&quot;mode&quot;&gt;&lt;option&gt;white&lt;/option&gt;&lt;option&gt;color&lt;/option&gt;&lt;/select&gt;&lt;/label&gt;
  &lt;label&gt;Brightness &lt;span id=&quot;bv&quot;&gt;&lt;/span&gt;&lt;input type=&quot;range&quot; id=&quot;b&quot; min=&quot;0&quot; max=&quot;100&quot; value=&quot;68&quot;&gt;&lt;/label&gt;
  &lt;label&gt;Kelvin &lt;span id=&quot;kv&quot;&gt;&lt;/span&gt;&lt;input type=&quot;range&quot; id=&quot;k&quot; min=&quot;1500&quot; max=&quot;8000&quot; step=&quot;100&quot; value=&quot;2700&quot;&gt;&lt;/label&gt;
  &lt;label&gt;Color &lt;input type=&quot;color&quot; id=&quot;c&quot; value=&quot;#9d6af9&quot;&gt;&lt;/label&gt;
&lt;/div&gt;
&lt;pre id=&quot;out&quot;&gt;&lt;/pre&gt;
&lt;script&gt;
const $ = id =&gt; document.getElementById(id);
const clamp = (lo, hi, v) =&gt; Math.max(lo, Math.min(hi, v));
function kelvinRGB(k) { const t = (k - 2200) / 4300; return [255, Math.round(180 + 60 * t), Math.round(110 + 145 * t)]; }
function render() {
  const isOn = $(&quot;on&quot;).checked, params = { state: isOn };
  let glow = &quot;#111&quot;;
  if (isOn) {
    params.dimming = clamp(10, 100, +$(&quot;b&quot;).value);
    const hex = parseInt($(&quot;c&quot;).value.slice(1), 16), rgb = [hex &gt;&gt; 16 &amp; 255, hex &gt;&gt; 8 &amp; 255, hex &amp; 255];
    if ($(&quot;mode&quot;).value === &quot;white&quot; || rgb.every(v =&gt; v === 0)) {
      params.temp = clamp(2200, 6500, +$(&quot;k&quot;).value);
      glow = `rgb(${kelvinRGB(params.temp)})`;
    } else {
      [params.r, params.g, params.b] = rgb;
      glow = $(&quot;c&quot;).value;
    }
    $(&quot;bulb&quot;).style.opacity = 0.25 + 0.75 * params.dimming / 100;
  }
  if (!isOn) $(&quot;bulb&quot;).style.opacity = 0.25;
  $(&quot;bulb&quot;).style.setProperty(&quot;--glow&quot;, glow);
  $(&quot;bv&quot;).textContent = $(&quot;b&quot;).value; $(&quot;kv&quot;).textContent = $(&quot;k&quot;).value + &quot; K&quot;;
  $(&quot;out&quot;).textContent = &quot;UDP → 192.0.2.31:38899\n\n&quot; + JSON.stringify({ id: 1, method: &quot;setPilot&quot;, params }, null, 2);
}
document.querySelectorAll(&quot;input, select&quot;).forEach(el =&gt; el.addEventListener(&quot;input&quot;, render));
render();
&lt;/script&gt;
</code></pre>
<p>Two safety rails sit around all of this. Commands only go to devices found on your network, never to demo devices. And <strong>Send commands to real devices</strong> in Settings › Discovery &amp; Network is a master switch: on by default, and one tap turns off every command to real hardware at once.</p>
<h2>A whole home, not just a remote</h2>
<p>Once the devices are in, Homey becomes the kind of app you leave on the home screen.</p>
<ul>
<li><strong>Home dashboard.</strong> Live tiles for devices online, energy today in kWh and cost, indoor temperature and humidity, plus Quick Scenes and an <strong>Active Now</strong> strip. iPad adds Dashboard, Energy and Climate pages.</li>
<li><strong>Rooms and scenes.</strong> Rooms grouped by floor with photos, climate and energy. Seven built-in scenes (Movie, Good Morning, Away, Night, Relax, Focus and Bright) set themselves up from the devices in the home or in one room.</li>
<li><strong>Automations.</strong> Triggers on time of day, sunrise or sunset with an offset, device state, washer finished and motion. Actions run a scene, change a device or send a notification, with a calendar, a day timeline and an execution log.</li>
<li><strong>Notifications.</strong> A notification center filtered by category and alert type, with a 24-hour summary, quiet hours and <strong>Open</strong> links that jump straight to the device.</li>
</ul>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/homey/phones-home.webp" alt="Home, Rooms and Scenes on iPhone"/></p>
<p><em>Real captures of the built-in demo home on iPhone: Home, Rooms and Scenes.</em></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/homey/phones-automations.webp" alt="Automations, Notifications and the simulated Washing Machine screen on iPhone"/></p>
<p><em>Real captures of the built-in demo home: Automations, Notifications and the Washing Machine screen.</em></p>
<p>A word on that washer, because I&#x27;d rather say it than have you find out: the washer and TV screens are full control screens with countdowns, programs and media status, but they&#x27;re <strong>simulated</strong>. Homey has no local driver for them yet, and each screen says so at the top. Same goes for cameras: modeled and automatable inside Homey, but no commands reach the hardware.</p>
<h3>Six accents, one tap</h3>
<p>Everything is built in SwiftUI with Liquid Glass, in Auto, Light or Dark, with reduced motion and high contrast. Pick an accent in Settings › Appearance and the whole interface retints: the tab bar, chips, toggles and the glow behind each room.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/homey/accent-retint.webp" alt="iPhone Home next to the Appearance card, retinting through violet, blue, cyan, green, amber and pink"/></p>
<p><em>Rebuilt from Homey&#x27;s SwiftUI source and theme tokens with synthetic data. One tap per accent.</em></p>
<p>The trick is that the accent is one observable value every view reads, so changing it redraws the lot. Here are Homey&#x27;s six accent hexes, straight from the source, driving one CSS variable:</p>
<pre><code class="language-html-live">&lt;style&gt;
  :root { --accent: #9D6AF9; }
  body { margin: 0; padding: 16px; background: #000; color: #eee; font: 14px system-ui, sans-serif; }
  .swatches { display: flex; gap: 8px; margin-bottom: 14px; }
  .swatches button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
  .swatches button.on { border-color: #fff; }
  .tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .tile { border-radius: 16px; padding: 12px; background: radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--accent) 35%, transparent), #0d0d12 70%); border: 1px solid #222; transition: background .4s; }
  .tile b { display: block; font-size: 20px; margin-top: 6px; }
  .chip { display: inline-block; margin-top: 12px; padding: 4px 12px; border-radius: 999px; background: var(--accent); color: #000; font-weight: 600; transition: background .4s; }
  .toggle { float: right; width: 40px; height: 24px; border-radius: 999px; background: var(--accent); position: relative; transition: background .4s; }
  .toggle::after { content: &quot;&quot;; position: absolute; right: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; }
&lt;/style&gt;
&lt;div class=&quot;swatches&quot; id=&quot;sw&quot;&gt;&lt;/div&gt;
&lt;div class=&quot;tiles&quot;&gt;
  &lt;div class=&quot;tile&quot;&gt;Devices&lt;b&gt;14 online&lt;/b&gt;&lt;/div&gt;
  &lt;div class=&quot;tile&quot;&gt;Lights&lt;b&gt;5 of 5 on&lt;/b&gt;&lt;/div&gt;
  &lt;div class=&quot;tile&quot;&gt;Living Room &lt;span class=&quot;toggle&quot;&gt;&lt;/span&gt;&lt;b&gt;21.5 °C&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span class=&quot;chip&quot;&gt;Movie&lt;/span&gt;
&lt;script&gt;
// Homey/Models/Home.swift: static let accents
const accents = [&quot;9D6AF9&quot;, &quot;4C8DFF&quot;, &quot;2FD6E0&quot;, &quot;3DD68C&quot;, &quot;FFB547&quot;, &quot;FF6BA8&quot;];
const sw = document.getElementById(&quot;sw&quot;);
accents.forEach((hex, n) =&gt; {
  const b = document.createElement(&quot;button&quot;);
  b.style.background = &quot;#&quot; + hex; b.title = &quot;#&quot; + hex; if (n === 0) b.className = &quot;on&quot;;
  b.onclick = () =&gt; {
    document.documentElement.style.setProperty(&quot;--accent&quot;, &quot;#&quot; + hex);
    sw.querySelectorAll(&quot;button&quot;).forEach(x =&gt; x.className = x === b ? &quot;on&quot; : &quot;&quot;);
  };
  sw.appendChild(b);
});
&lt;/script&gt;
</code></pre>
<p>(The tile numbers are made up for the playground. The hexes aren&#x27;t.)</p>
<h2>No cloud, on purpose</h2>
<p>Privacy isn&#x27;t a settings page in Homey; it&#x27;s the architecture.</p>
<ul>
<li><strong>No account, no cloud, no analytics.</strong> Homey has no server. Scans, homes and settings stay on your devices, saved in Application Support.</li>
<li><strong>Scans stay on the LAN.</strong> Reverse DNS goes only to private-address resolvers, and the gateway scanner never looks up your public IP.</li>
<li><strong>Device-supplied URLs are fenced in.</strong> SSDP <code>LOCATION</code> headers, UPnP links and HTTP banners go through <code>DeviceHTTP</code>, which only accepts plain <code>http</code> or <code>https</code> URLs pointing at the exact IP that replied, with no credentials and a valid port. Redirects must pass the same check, sessions are ephemeral and bodies are capped at 256 KB.</li>
<li><strong>App Lock.</strong> Face ID, Touch ID or Optic ID with a passcode fallback. The lock screen covers every window from the first frame, and the setting fails closed if saved data is lost.</li>
<li><strong>Security actions are confirmed.</strong> With <strong>Confirm security actions</strong> on (the default), Homey asks for authentication before a camera is switched on or off from a control, a scene or <strong>Run Now</strong>.</li>
</ul>
<p>That <code>DeviceHTTP</code> fence is my favorite paranoid detail. A device on your network gets to tell Homey where its description lives, and Homey politely refuses to go anywhere else.</p>
<h2>Under the hood</h2>
<p><strong>Stack:</strong> Swift 6 · SwiftUI (Liquid Glass) · Network.framework and BSD sockets · CoreBluetooth · Bonjour (DNS-SD) · XcodeGen. It targets iOS, iPadOS and macOS 26.</p>
<p>The whole thing fits in one picture:</p>
<pre><code class="language-text">Scanners ──ScanFinding──▶ DiscoveryEngine ──▶ ScanSnapshot
(Bonjour, SSDP, ARP,      (DeviceMerger,      (devices, environment,
 ICMP, WiZ, Matter,        TopologyBuilder)    topology)
 BLE, ports)                                        │
                                .homeyscan or _homey-sync._tcp
                                                    ▼
                         HomeStore (iPhone and iPad) ──▶ DeviceController
                                                          ├─ UDP 38899 ──────────────▶ WiZ lights
                                                          └─ HTTP 8080/80, telnet 23 ─▶ Denon or Marantz AVR
</code></pre>
<ul>
<li><strong>Shared discovery core.</strong> <code>Homey/Discovery</code> (engine, merger, topology, snapshot and sync) is compiled into both targets. The Mac registers its deeper scanners through <code>ScannerCatalog</code>, and a registered scanner replaces the built-in implementation of the same method.</li>
<li><strong>One store.</strong> <code>HomeStore</code> holds every home, saves to <code>homey.json</code> in Application Support, runs the automation engine and the demo simulation, and routes changes to real hardware through <code>DeviceController</code>, which throttles slider drags and keeps commands in order.</li>
<li><strong>Local drivers.</strong> <code>WiZClient</code> speaks the WiZ UDP protocol; <code>DenonClient</code> tries HTTP first and falls back to telnet.</li>
<li><strong>Swift 6 strict concurrency.</strong> Main-actor default isolation, with <code>nonisolated</code> and <code>Sendable</code> scanners.</li>
</ul>
<p>Homey for Mac is ad-hoc signed and not sandboxed, because ICMP datagram sockets, the ARP and routing tables through <code>sysctl</code> and broadcast UDP need it. If you have access to the source, building is three commands:</p>
<pre><code class="language-sh">brew install xcodegen      # once
xcodegen generate          # regenerates Homey.xcodeproj from project.yml
open Homey.xcodeproj       # pick the Homey or HomeyMac scheme and run
</code></pre>
<p>And because both apps read launch arguments, the Mac can also scan headless, which is handy for testing on a real network:</p>
<pre><code class="language-sh">build/Build/Products/Debug/HomeyMac.app/Contents/MacOS/HomeyMac -autoscan 25 -dumpSnapshot ~/Desktop/scan.json -quitAfterScan YES
</code></pre>
<h2>What&#x27;s not there yet</h2>
<p>Homey is in development: the README is at 1.0.0, with no tagged release. The README is blunt about the gaps, so I will be too.</p>
<ul>
<li><strong>Two device families are controlled for real.</strong> WiZ lights and Denon or Marantz receivers. The washer, TV, cameras and the rest are modeled and automatable, but their commands don&#x27;t reach the hardware.</li>
<li><strong>Automations run only while the app is open.</strong> There&#x27;s no always-on hub. <strong>Run Missed Automations</strong> (off by default) catches up on scheduled runs from at most 24 hours back when you return.</li>
<li><strong>Multicast on a physical iPhone needs an entitlement.</strong> Without <code>com.apple.developer.networking.multicast</code>, WiZ and SSDP discovery don&#x27;t work on a device. The Simulator isn&#x27;t affected.</li>
<li><strong>Homey for Mac runs from Xcode or a local build.</strong> It&#x27;s not ready for the Mac App Store.</li>
<li><strong>No automated tests.</strong> Only the Debug <code>SyncSelfTest</code> harness, which checks the Mac-to-iOS handoff over loopback and Bonjour.</li>
</ul>
<p>Next on the list:</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" disabled=""/> Local drivers for LG webOS TVs and connected washers (both screens are ready and already say what&#x27;s simulated)</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> An always-on hub, so automations run while the app is closed</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> The multicast entitlement, so a physical iPhone can run every iOS discovery method</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> A unit test target for the merger, topology builder and snapshot decoding</li>
</ul>
<p><em>About the media in this post: the Mac screenshots, the hero, the GIFs and the explainer are compositions rebuilt from Homey&#x27;s SwiftUI source with a synthetic network, not captures, with identifiers blurred. The iPhone and iPad screenshots are real captures of the built-in demo home.</em></p>
<p>Homey has its own card on the <a href="https://www.0x1ad2.dev/projects?project=homey">projects page</a>, with the demo loop, the explainer and the stack at a glance.</p>
<blockquote>
<p>Curious about the source? It&#x27;s private, but access can be granted to anyone interested in contributing. <a href="https://www.0x1ad2.dev/contact">Get in touch</a>.</p>
</blockquote>]]></content:encoded>
    </item>
    <item>
      <title>🔍 Loupe: point at the UI, hand it to the agent</title>
      <link>https://www.0x1ad2.dev/blog/loupe</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/loupe</guid>
      <pubDate>Wed, 25 Nov 2026 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>Loupe lets you point at any button, field or panel in any Mac app, say what should change and keep going. Then it hands the whole session to Claude Code or another coding agent as one prompt, with screenshots and element details attached.</description>
      <category>projects</category>
      <category>agent-tools</category>
      <category>macos</category>
      <category>swift</category>
      <category>accessibility</category>
      <content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/loupe/icon.webp" alt="The Loupe app icon"/></p>
<p>Here&#x27;s how I used to describe UI to a coding agent: &quot;The header above the cache button. No, not that one, the one in the settings window. Under Sync. Give it a bit more room.&quot; Then I&#x27;d take a screenshot, crop it, drag it into the chat, and hope the agent and I meant the same thing by &quot;a bit&quot;.</p>
<p>Words are a terrible pointing device. So I built a better one. Loupe lives in the menu bar, and when you press <strong>⌃⌥⌘L</strong> it turns your cursor into a jeweler&#x27;s loupe for the whole screen: hover over an element, see exactly what it is, click it, type what should change, and move on to the next one. When you&#x27;re done, the whole review becomes one Markdown prompt your agent can act on.</p>
<p><a href="https://www.0x1ad2.dev/images/projects/loupe/explainer.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/loupe/explainer-poster.webp" alt="Watch the Loupe explainer (31.5 seconds, no audio)"/></a></p>
<p><em>Every image and video in this post is an animated mockup rebuilt from source with Montage, not a screen recording. All the data in them is synthetic.</em></p>
<h2>Pick anything, on every display</h2>
<p>Pick Mode puts a transparent overlay on every display. A 1.5 pt accent outline follows the element under the cursor in whatever app owns it, and a small chip tells you its role, its label and the app. The fun part is the arrow keys: <strong>↑</strong> climbs to the parent element and the chip counts the steps (<strong>↑1</strong>, <strong>↑2</strong>), <strong>↓</strong> comes back down. So if you meant &quot;this whole Sync section&quot; instead of &quot;this one pop-up&quot;, you don&#x27;t hunt for a gap between controls. You just press up.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/loupe/hero.webp" alt="Pick Mode over a demo settings window: the outline sits on the Sync group after pressing the up arrow, with a chip reading AXGroup Sync ExampleApp ↑1"/></p>
<p>The app below stays frontmost the whole time and keeps its active look, which matters later for the screenshots. A click or <strong>↩</strong> captures the outlined element. If an app exposes nothing useful, you can drag out a region by hand, and when there&#x27;s no accessibility element at all, Loupe falls back to the window bounds and draws a dashed outline instead.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/loupe/hover-walk.webp" alt="The cursor glides over the Startup and Sync controls of a demo settings window while the outline and role chip snap from element to element, then the up arrow climbs to the Sync group and the down arrow comes back"/></p>
<p>It&#x27;s easier to feel than to read, so here&#x27;s a toy version you can poke at. Hover over the fake settings window below, press ↑ and ↓ to walk the hierarchy (click inside the playground first so it gets your keys), and click or press ↩ to &quot;capture&quot;. It&#x27;s about forty lines of JavaScript walking the DOM, not Loupe&#x27;s Accessibility code, but it&#x27;s the same idea.</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; padding: 16px; background: #000; color: #e6e6e6; font: 13px/1.4 system-ui, sans-serif; }
  .win { max-width: 340px; margin: 0 auto; background: #1c1c1e; border: 1px solid #333; border-radius: 12px; padding: 10px 14px 14px; }
  .title { text-align: center; color: #8e8e93; font-size: 12px; margin-bottom: 6px; }
  .group { border: 1px solid #2c2c2e; border-radius: 8px; padding: 8px 10px; margin-top: 8px; }
  .h { font-weight: 600; margin-bottom: 4px; display: inline-block; }
  .row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; }
  .btn { background: #2c2c2e; border-radius: 6px; padding: 2px 8px; }
  .toggle { width: 30px; height: 18px; border-radius: 9px; background: #0a84ff; }
  #outline { position: absolute; display: none; pointer-events: none; border: 1.5px solid #0a84ff; border-radius: 5px; transition: all .08s; }
  #chip { position: absolute; display: none; pointer-events: none; background: #0a84ff; color: #fff; font: 11px ui-monospace, monospace; padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
  .bar, #log { max-width: 340px; margin: 10px auto 0; text-align: center; color: #8e8e93; font-size: 12px; }
  #log { color: #7fd17f; font-family: ui-monospace, monospace; min-height: 1.4em; }
  kbd { border: 1px solid #444; border-radius: 4px; padding: 0 4px; font: 11px ui-monospace, monospace; }
&lt;/style&gt;
&lt;div class=&quot;win&quot; data-role=&quot;AXWindow&quot; data-label=&quot;Settings&quot;&gt;
  &lt;div class=&quot;title&quot;&gt;Settings&lt;/div&gt;
  &lt;div class=&quot;group&quot; data-role=&quot;AXGroup&quot; data-label=&quot;Startup&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;&lt;span data-role=&quot;AXStaticText&quot; data-label=&quot;Open at login&quot;&gt;Open at login&lt;/span&gt;&lt;span class=&quot;toggle&quot; data-role=&quot;AXCheckBox&quot; data-label=&quot;Open at login&quot;&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;group&quot; data-role=&quot;AXGroup&quot; data-label=&quot;Sync&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;&lt;span data-role=&quot;AXStaticText&quot; data-label=&quot;Sync interval&quot;&gt;Sync interval&lt;/span&gt;&lt;span class=&quot;btn&quot; data-role=&quot;AXPopUpButton&quot; data-label=&quot;Every hour&quot;&gt;Every hour ▾&lt;/span&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;group&quot; data-role=&quot;AXGroup&quot; data-label=&quot;Storage&quot;&gt;
    &lt;span class=&quot;h&quot; data-role=&quot;AXStaticText&quot; data-label=&quot;Storage&quot;&gt;Storage&lt;/span&gt;
    &lt;div class=&quot;row&quot;&gt;&lt;span&gt;Cache: 214 MB&lt;/span&gt;&lt;span class=&quot;btn&quot; data-role=&quot;AXButton&quot; data-label=&quot;Clear cache&quot;&gt;Clear cache&lt;/span&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;bar&quot;&gt;Hover · &lt;kbd&gt;↑&lt;/kbd&gt; parent · &lt;kbd&gt;↓&lt;/kbd&gt; child · click or &lt;kbd&gt;↩&lt;/kbd&gt; capture&lt;/div&gt;
&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
&lt;div id=&quot;outline&quot;&gt;&lt;/div&gt;&lt;div id=&quot;chip&quot;&gt;&lt;/div&gt;
&lt;script&gt;
  const outline = document.getElementById(&quot;outline&quot;);
  const chip = document.getElementById(&quot;chip&quot;);
  const log = document.getElementById(&quot;log&quot;);
  let base = null, current = null, trail = [], picks = 0;

  function show(el) {
    current = el;
    if (!el) { outline.style.display = chip.style.display = &quot;none&quot;; return; }
    const r = el.getBoundingClientRect(), x = r.left + scrollX, y = r.top + scrollY;
    Object.assign(outline.style, { display: &quot;block&quot;, left: x - 3 + &quot;px&quot;, top: y - 3 + &quot;px&quot;, width: r.width + 6 + &quot;px&quot;, height: r.height + 6 + &quot;px&quot; });
    chip.textContent = `${el.dataset.role} &quot;${el.dataset.label}&quot; ExampleApp${trail.length ? &quot; ↑&quot; + trail.length : &quot;&quot;}`;
    Object.assign(chip.style, { display: &quot;block&quot;, left: x - 3 + &quot;px&quot;, top: y + r.height + 6 + &quot;px&quot; });
  }

  function capture() {
    if (!current) return;
    picks += 1;
    log.textContent = `pick-${String(picks).padStart(3, &quot;0&quot;)} · ${current.dataset.role} &quot;${current.dataset.label}&quot;`;
  }

  document.addEventListener(&quot;mousemove&quot;, (e) =&gt; {
    const el = e.target.closest(&quot;[data-role]&quot;);
    if (el !== base) { base = el; trail = []; show(el); }
  });

  document.addEventListener(&quot;keydown&quot;, (e) =&gt; {
    if (!current) return;
    if (e.key === &quot;ArrowUp&quot;) {
      const parent = current.parentElement &amp;&amp; current.parentElement.closest(&quot;[data-role]&quot;);
      if (parent) { trail.push(current); show(parent); }
      e.preventDefault();
    } else if (e.key === &quot;ArrowDown&quot;) {
      if (trail.length) show(trail.pop());
      e.preventDefault();
    } else if (e.key === &quot;Enter&quot;) {
      capture();
    }
  });

  document.addEventListener(&quot;click&quot;, capture);
&lt;/script&gt;
</code></pre>
<h2>Notes in the flow, screenshots only on click</h2>
<p>Click an element and a composer springs open right beside it: a note, a priority, a category and tags. <strong>↩</strong> saves and keeps you picking, <strong>⌘↩</strong> saves, copies the session prompt and leaves Pick Mode, and <strong>Esc</strong> throws the pick away. You never leave the app you&#x27;re reviewing, so a pass over a settings window is a rhythm of hover, click, type, return. The <strong>Picks</strong> badge in Loupe&#x27;s sidebar counts along.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/loupe/screenshot-1.webp" alt="The inline composer open under a picked Storage header in a demo settings window, with a note field, priority, category and tag controls"/></p>
<p><a href="https://www.0x1ad2.dev/images/projects/loupe/demo.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/loupe/demo-poster.webp" alt="The capture loop: a click on the Storage header, a typed note, Medium priority and the Spacing category, then return saves and the Picks badge goes from 2 to 3 (8-second loop)"/></a></p>
<p><em>The capture loop, 8 seconds. Click the still to play it.</em></p>
<p>Here&#x27;s the bit I care about most: <strong>nothing is captured while you hover.</strong> Only on click does ScreenCaptureKit grab the element plus 32 pt of context, at the display&#x27;s backing scale, with Loupe&#x27;s own windows left out. A full-window capture is there if you want it. Each pick also records what Accessibility knows about the element: app, bundle ID, window title, role and subrole, label, value, identifier, description, help, bounds, the ancestor hierarchy, up to 8 labeled nearby elements, and the page URL where a browser exposes one.</p>
<p>A tool that can see every app on your screen has to be careful about what it looks at, so a few rules are not optional:</p>
<ul>
<li><strong>Secure text fields are never read or screenshotted.</strong></li>
<li><strong>Excluded apps are never inspected or captured.</strong> 1Password, Bitwarden, Keychain Access and Passwords are on that list by default.</li>
<li><strong>No network.</strong> Loupe has no network client: no uploads, no accounts, no analytics, no AI calls. A prompt leaves your Mac only when you paste it somewhere.</li>
<li><strong>Retention is yours.</strong> Screenshots can be deleted after 7, 30 or 90 days while the notes stay.</li>
</ul>
<h2>One prompt, every time the same</h2>
<p>When the review is done, Prompt Export turns the session into Markdown. You can toggle screenshots, annotations, technical metadata and resolved picks, switch between <strong>Concise</strong> and <strong>Detailed</strong>, pick absolute or relative screenshot paths, and edit the text before you copy it. Then it&#x27;s <strong>Copy Prompt</strong>, <strong>Copy Images</strong>, <strong>Save Markdown…</strong> or <strong>Export Bundle…</strong>, which writes a ZIP with <code>prompt.md</code>, <code>session.json</code> and the screenshots.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/loupe/screenshot-2.webp" alt="The Prompt Export screen with include toggles, the Concise and Detailed switch, a screenshot path picker, the generated Markdown prompt for three annotations and the Copy Prompt action bar"/></p>
<p>The prompt is a pure function of the session and the export options, so the same session always produces the same text. And Loupe never rewrites your notes: each <strong>Requested change</strong> is your text, verbatim. No helpful rephrasing, no &quot;improved&quot; version of what you meant. Here&#x27;s a full prompt for one synthetic pick:</p>
<pre><code class="language-md"># UI Review — Settings polish

## Objective
Apply the following UI improvements (1 annotation across ExampleApp).

## Annotation 1 — Storage

- Application: ExampleApp (com.example.app)
- Window: Settings
- Role: AXStaticText
- Label: Storage
- Bounds: x: 412, y: 318, w: 96, h: 20 (points, global screen coordinates)
- Hierarchy: AXWindow &quot;Settings&quot; › AXGroup &quot;Storage&quot; › AXStaticText &quot;Storage&quot;
- Priority: Medium · Category: Spacing · Tags: settings, spacing
- Screenshot: ./screenshots/pick-003.png
- Element in screenshot: x: 64, y: 64, w: 192, h: 40 (pixels)

Requested change:
Add 12 pt of space above the Storage header so it matches the Sync section.

## Implementation instructions
- Inspect the relevant project before modifying code.
- Locate the UI components that correspond to each annotation.
- Apply the requested changes.
- Preserve unrelated functionality.
- Test the affected interfaces.
- Report the changes made and any unresolved items.
- Element details come from macOS Accessibility; they do not identify source files.
- Screenshot paths are relative to this file.
</code></pre>
<p>That second-to-last instruction is my favorite line in the whole app. Accessibility can tell the agent the element is an <code>AXStaticText</code> labeled &quot;Storage&quot; in a group called &quot;Storage&quot;; it can&#x27;t tell it which source file drew it. Saying so up front saves the agent from confidently editing the wrong view.</p>
<p>&quot;Deterministic&quot; sounds abstract until you see it, so here&#x27;s another toy. It&#x27;s a cut-down sketch of the idea, not Loupe&#x27;s <code>PromptGenerator</code>: type a note, flip between Concise and Detailed, and watch the fingerprint. Same input, same fingerprint, every time. Concise drops the bundle ID, bounds and hierarchy, just like the real thing (which drops a few more fields too).</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; padding: 14px; background: #000; color: #e6e6e6; font: 13px/1.4 system-ui, sans-serif; }
  .controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
  textarea { width: 100%; box-sizing: border-box; background: #1c1c1e; color: #fff; border: 1px solid #333; border-radius: 8px; padding: 8px; font: inherit; resize: vertical; }
  select, button { background: #1c1c1e; color: #fff; border: 1px solid #333; border-radius: 6px; padding: 4px 8px; font: inherit; }
  button[aria-pressed=&quot;true&quot;] { background: #0a84ff; border-color: #0a84ff; }
  pre { background: #0d0d0d; border: 1px solid #222; border-radius: 8px; padding: 10px; white-space: pre-wrap; font: 11.5px/1.5 ui-monospace, monospace; color: #cfcfcf; margin: 10px 0 6px; }
  #fp { font: 11px ui-monospace, monospace; color: #7fd17f; }
&lt;/style&gt;
&lt;textarea id=&quot;note&quot; rows=&quot;2&quot;&gt;Add 12 pt of space above the Storage header so it matches the Sync section.&lt;/textarea&gt;
&lt;div class=&quot;controls&quot;&gt;
  &lt;select id=&quot;priority&quot;&gt;&lt;option&gt;Low&lt;/option&gt;&lt;option selected&gt;Medium&lt;/option&gt;&lt;option&gt;High&lt;/option&gt;&lt;/select&gt;
  &lt;button id=&quot;concise&quot; aria-pressed=&quot;false&quot;&gt;Concise&lt;/button&gt;
  &lt;button id=&quot;detailed&quot; aria-pressed=&quot;true&quot;&gt;Detailed&lt;/button&gt;
&lt;/div&gt;
&lt;pre id=&quot;out&quot;&gt;&lt;/pre&gt;
&lt;div id=&quot;fp&quot;&gt;&lt;/div&gt;
&lt;script&gt;
  const pick = {
    app: &quot;ExampleApp&quot;, bundle: &quot;com.example.app&quot;, window: &quot;Settings&quot;,
    role: &quot;AXStaticText&quot;, label: &quot;Storage&quot;,
    bounds: &quot;x: 412, y: 318, w: 96, h: 20&quot;,
    hierarchy: &#x27;AXWindow &quot;Settings&quot; › AXGroup &quot;Storage&quot; › AXStaticText &quot;Storage&quot;&#x27;,
  };
  let detailed = true;

  // A pure function: the same pick and options always give the same text.
  function prompt(p, o) {
    const lines = [
      &quot;# UI Review — Settings polish&quot;, &quot;&quot;,
      &quot;## Annotation 1 — &quot; + p.label, &quot;&quot;,
      &quot;- Application: &quot; + p.app + (o.detailed ? &quot; (&quot; + p.bundle + &quot;)&quot; : &quot;&quot;),
      &quot;- Window: &quot; + p.window, &quot;- Role: &quot; + p.role, &quot;- Label: &quot; + p.label,
    ];
    if (o.detailed) lines.push(&quot;- Bounds: &quot; + p.bounds + &quot; (points, global screen coordinates)&quot;, &quot;- Hierarchy: &quot; + p.hierarchy);
    lines.push(&quot;- Priority: &quot; + o.priority + &quot; · Category: Spacing&quot;, &quot;&quot;, &quot;Requested change:&quot;, o.note);
    return lines.join(&quot;\n&quot;);
  }

  function fingerprint(text) {
    let h = 2166136261;
    for (let i = 0; i &lt; text.length; i++) { h ^= text.charCodeAt(i); h = Math.imul(h, 16777619); }
    return (h &gt;&gt;&gt; 0).toString(16).padStart(8, &quot;0&quot;);
  }

  function render() {
    const text = prompt(pick, { detailed, priority: priority.value, note: note.value });
    out.textContent = text;
    fp.textContent = &quot;fingerprint &quot; + fingerprint(text);
    concise.setAttribute(&quot;aria-pressed&quot;, String(!detailed));
    detailed_btn.setAttribute(&quot;aria-pressed&quot;, String(detailed));
  }

  const note = document.getElementById(&quot;note&quot;), priority = document.getElementById(&quot;priority&quot;);
  const out = document.getElementById(&quot;out&quot;), fp = document.getElementById(&quot;fp&quot;);
  const concise = document.getElementById(&quot;concise&quot;), detailed_btn = document.getElementById(&quot;detailed&quot;);
  note.addEventListener(&quot;input&quot;, render);
  priority.addEventListener(&quot;change&quot;, render);
  concise.addEventListener(&quot;click&quot;, () =&gt; { detailed = false; render(); });
  detailed_btn.addEventListener(&quot;click&quot;, () =&gt; { detailed = true; render(); });
  render();
&lt;/script&gt;
</code></pre>
<p>The other half of the contract is the file on disk. Each session is a plain <code>session.json</code> plus PNG files, schema version 1, and that one file is the storage format, the export format and the surface for a future MCP companion. Fields are only ever added as optional within a schema version, never repurposed.</p>
<pre><code class="language-text">~/Library/Application Support/Loupe/
├── state.json                          current session id
└── Sessions/&lt;session-uuid&gt;/
    ├── session.json
    └── screenshots/
        ├── pick-001.png                element plus context
        └── pick-001-window.png         optional full window
</code></pre>
<p>Files, not a database. Export, import, deletion and outside tools all stay boring, and boring is exactly what you want from the thing that holds your notes.</p>
<h2>Under the hood</h2>
<p>Loupe is a native Mac app: <strong>Swift 6</strong>, <strong>SwiftUI and AppKit</strong>, the <strong>Accessibility API</strong> and <strong>ScreenCaptureKit</strong>, with the Xcode project generated by <strong>XcodeGen</strong> and committed. It runs on <strong>macOS 15 and later</strong>, and floating controls use Liquid Glass on macOS 26. The pipeline is short:</p>
<pre><code class="language-text">Pick Mode         overlay per display, 30 Hz poll
  → ElementInspector  AX hit test in the target app
  → Composer          note, priority, tags
  → ScreenCapturer    ScreenCaptureKit, on click
  → SessionStore      session.json + PNGs
  → PromptGenerator   Markdown prompt or ZIP bundle
</code></pre>
<p>A few of the decisions that made it work:</p>
<h3>Hit-testing through your own overlay</h3>
<p>Here&#x27;s the catch with Pick Mode. You need a full-screen overlay to absorb the clicks, but a system-wide Accessibility hit test under the cursor would then find… Loupe. So Loupe asks <code>CGWindowList</code> for the topmost <em>foreign</em> window under the cursor, then asks that app to hit-test with <code>AXUIElementCopyElementAtPosition</code>. The cursor is polled at 30 Hz, a hit test only runs after the mouse moves, and Accessibility calls time out after 250 ms, so one hung app can&#x27;t freeze the picker.</p>
<h3>Panels that don&#x27;t steal focus</h3>
<p>The overlay and the composer are <code>NSPanel</code>s with <code>.nonactivatingPanel</code>. The target app stays frontmost, so the screenshots show its real active state, and the panels still take your keystrokes.</p>
<h3>A shortcut without Input Monitoring</h3>
<p>The global shortcut (<strong>⌃⌥⌘L</strong> by default) is a Carbon <code>RegisterEventHotKey</code>. It needs no Input Monitoring permission and fails visibly when the combo is taken. Pick Mode gets its clicks and keys through its own overlay windows, so the only permissions are Accessibility (required) and Screen Recording (optional; without it, picks are saved with metadata only).</p>
<h3>Five palettes, glass only where it floats</h3>
<p>There are five palettes (Graphite, Slate, Midnight, Ember and System), each with light and dark variants. Every color resolves per appearance with <code>NSColor(name:dynamicProvider:)</code>, so switching themes needs no extra code. Glass is reserved for floating chrome (the Pick Mode bar, the composer and the action bars), never for content, and Reduce Transparency is respected.</p>
<h3>Tests where tests can reach</h3>
<p><code>PromptGenerator</code> is pure, <code>ElementInspecting</code> and <code>ScreenCapturing</code> are protocol boundaries around Accessibility and ScreenCaptureKit, and <code>SessionStore</code> takes its root folder as a parameter, so tests run against a temporary directory. There are 33 Swift Testing tests covering prompt generation, geometry (Retina scaling, displays at negative coordinates, popover placement), persistence, the ZIP round trip and the rejection of unsafe screenshot paths. The one thing they can&#x27;t reach is Accessibility hit-testing itself: that was verified by hand against Chrome under a full-screen overlay.</p>
<h2>What&#x27;s not there yet</h2>
<p>Loupe is in development. There&#x27;s no tagged release and no notarized build yet, and it can&#x27;t go on the Mac App Store at all: the App Sandbox blocks Accessibility inspection of other apps. The honest list of rough edges:</p>
<ul>
<li><strong>It only sees what Accessibility exposes.</strong> Some Electron, web and custom-drawn UIs expose coarse elements or none, and then the window fallback applies. Chrome may need accessibility switched on at <code>chrome://accessibility</code> first.</li>
<li><strong>An element spanning two displays</strong> is captured on the display that shows most of it.</li>
<li><strong>Scrolling in Pick Mode</strong> is absorbed by the overlay.</li>
<li><strong>Ad-hoc Debug builds</strong> can lose their Accessibility and Screen Recording grants after a rebuild.</li>
<li><strong>No MCP companion yet.</strong> The data contract and the inbox operations (list, get, claim and resolve) exist, but there&#x27;s no transport.</li>
</ul>
<p>And what&#x27;s next, per the roadmap:</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" disabled=""/> The MCP companion: a separate, explicitly configured local process with a stdio transport that serves <code>session.json</code> and may only change annotation status.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> A browser extension adapter for page context that Accessibility doesn&#x27;t expose.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> An automated test for Accessibility hit-testing under the overlay.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> A notarized Developer ID build attached to GitHub Releases.</li>
</ul>
<p>That MCP companion is the one I&#x27;m itching for. Right now the loop is &quot;pick, copy, paste&quot;. The inbox operations are already there in <code>SessionStore</code>: list, get, claim and resolve. Once the companion gives them a transport, an agent can claim a pick and mark it resolved, and that status is the only thing it is allowed to change.</p>
<p><em>Loupe is unofficial and not affiliated with or endorsed by Anthropic. Claude and Claude Code are trademarks of Anthropic.</em></p>
<p>Loupe has its own card on the <a href="https://www.0x1ad2.dev/projects?project=loupe">projects page</a>, with the demo loop, the explainer and the stack at a glance.</p>
<blockquote>
<p>Curious about the source? It&#x27;s private, but access can be granted to anyone interested in contributing. <a href="https://www.0x1ad2.dev/contact">Get in touch</a>.</p>
</blockquote>]]></content:encoded>
    </item>
    <item>
      <title>⚡ VoltWake: an alarm that won't take no for an answer</title>
      <link>https://www.0x1ad2.dev/blog/voltwake</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/voltwake</guid>
      <pubDate>Wed, 25 Nov 2026 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>VoltWake is for heavy sleepers who need an alarm that keeps coming back until they are really up, and for anyone who trains in rounds. It runs alarms, smart wake-ups like Couch Mode, concurrent timers and interval workouts on iPhone and Apple Watch.</description>
      <category>projects</category>
      <category>apple</category>
      <category>swift</category>
      <category>swiftui</category>
      <category>alarmkit</category>
      <category>watchos</category>
      <content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/voltwake/hero.webp" alt="Three iPhones on a sunrise backdrop: an active boxing round with an amber ring, the VoltWake Alarms tab and the Wake Check"/></p>
<p><em>A brand graphic made with Montage. The phone screens in it are recreated from the SwiftUI source.</em></p>
<p>Here&#x27;s the thing about a normal alarm: it trusts you. It rings, you tap Stop, and it assumes the person who tapped Stop is awake. That&#x27;s a bold assumption. The person who tapped Stop is often a half-conscious creature on a couch who will be asleep again in ninety seconds, and the alarm is already off duty.</p>
<p>VoltWake doesn&#x27;t trust you. Stopping a ring only silences that ring. The next one is already counting down, and the only way to call the whole thing off is to prove you&#x27;re up by holding a button for two full seconds. It&#x27;s an alarm with trust issues, and I mean that as a compliment.</p>
<p>It also turned into a training clock along the way, because the same engine that counts down to the next follow-up is very good at counting down to the next round. Here&#x27;s the 29-second version, made with Montage, my shared Remotion studio:</p>
<p><a href="https://www.0x1ad2.dev/images/projects/voltwake/explainer.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/voltwake/explainer-poster.webp" alt="Watch the 29-second VoltWake explainer: an amber work ring on iPhone and Apple Watch"/></a></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/voltwake/screenshot-1.webp" alt="Five VoltWake screens side by side in dark mode: the Alarms tab, a running smart alarm, three timers, a boxing workout and the Wake Check"/></p>
<p><em>Real app screens from the iOS Simulator.</em></p>
<h2>Every alarm is a real system alarm</h2>
<p>The first rule I set: no &quot;please keep the app open&quot; alarms. Every alarm in VoltWake is scheduled as a system alarm with AlarmKit, so iOS rings it when the iPhone is locked, silenced or in Focus, and when VoltWake is closed. One-time and repeating alarms get weekdays, a label, a sound and a snooze each.</p>
<p>On top of that sits the <strong>Power Alarm</strong>: switch it on and an alarm grows 1 to 8 follow-up stages, evenly spaced or edited one by one, each with its own sound and intensity. Stopping a stage only silences that stage. The next one still rings until you confirm you&#x27;re up.</p>
<p>And then there are <strong>smart alarms</strong>, which are one-tap wake-up patterns. The first alarm rings after a delay or at a clock time, followed by up to 8 follow-ups with their own gaps. The built-in one is my favorite feature name I&#x27;ve ever written down: <strong>Couch Mode</strong>. Tap it, and you get an alarm 2 hours later, then 5 hold-to-confirm follow-ups every 30 minutes. It&#x27;s for the &quot;I&#x27;ll just close my eyes for a bit&quot; moment we all lie to ourselves about.</p>
<p>Change the defaults below and watch the ladder rebuild. Then click a stage to pretend you held <strong>I&#x27;m Up</strong> there:</p>
<pre><code class="language-html-live">&lt;style&gt;
  :root { color-scheme: dark; --amber: #ffa51f; --teal: #3ec8c8; --dim: #8a8a99; }
  * { box-sizing: border-box; }
  body { margin: 0; padding: 14px; background: #000; color: #f4f4f5; font: 13px/1.4 system-ui, sans-serif; }
  .controls { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 12px; color: var(--dim); }
  label { display: flex; align-items: center; gap: 6px; }
  input { width: 64px; background: #111; color: #fff; border: 1px solid #333; border-radius: 6px; padding: 3px 6px; font: inherit; }
  input[type=time] { width: 92px; }
  ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
  li { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: 10px; background: #111; border: 1px solid #222; cursor: pointer; }
  li .t { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--amber); }
  li.first { border-color: var(--amber); }
  li.cancel { opacity: .35; text-decoration: line-through; }
  li.up { border-color: var(--teal); }
  li.up .t { color: var(--teal); }
  #note { margin-top: 10px; color: var(--dim); min-height: 1.4em; }
&lt;/style&gt;
&lt;div class=&quot;controls&quot;&gt;
  &lt;label&gt;Tap at &lt;input id=&quot;start&quot; type=&quot;time&quot; value=&quot;19:00&quot;&gt;&lt;/label&gt;
  &lt;label&gt;Delay (min) &lt;input id=&quot;delay&quot; type=&quot;number&quot; min=&quot;1&quot; value=&quot;120&quot;&gt;&lt;/label&gt;
  &lt;label&gt;Follow-ups &lt;input id=&quot;count&quot; type=&quot;number&quot; min=&quot;1&quot; max=&quot;8&quot; value=&quot;5&quot;&gt;&lt;/label&gt;
  &lt;label&gt;Every (min) &lt;input id=&quot;gap&quot; type=&quot;number&quot; min=&quot;1&quot; value=&quot;30&quot;&gt;&lt;/label&gt;
&lt;/div&gt;
&lt;ol id=&quot;ladder&quot;&gt;&lt;/ol&gt;
&lt;p id=&quot;note&quot;&gt;Click a stage to hold I&#x27;m Up there.&lt;/p&gt;
&lt;script&gt;
  const $ = (id) =&gt; document.getElementById(id);
  let upAt = null;
  const fmt = (m) =&gt; { m = ((m % 1440) + 1440) % 1440; return String(Math.floor(m / 60)).padStart(2, &quot;0&quot;) + &quot;:&quot; + String(m % 60).padStart(2, &quot;0&quot;); };
  function render() {
    const [h, m] = $(&quot;start&quot;).value.split(&quot;:&quot;).map(Number);
    const first = h * 60 + m + Math.max(1, +$(&quot;delay&quot;).value || 1);
    const count = Math.min(8, Math.max(1, +$(&quot;count&quot;).value || 1));
    const gap = Math.max(1, +$(&quot;gap&quot;).value || 1);
    const stages = [first];
    for (let i = 1; i &lt;= count; i++) stages.push(first + i * gap);
    if (upAt !== null &amp;&amp; upAt &gt;= stages.length) upAt = null;
    $(&quot;ladder&quot;).innerHTML = stages.map((t, i) =&gt; {
      const cls = [i === 0 ? &quot;first&quot; : &quot;&quot;, upAt !== null &amp;&amp; i &gt; upAt ? &quot;cancel&quot; : &quot;&quot;, i === upAt ? &quot;up&quot; : &quot;&quot;].join(&quot; &quot;);
      const name = i === 0 ? &quot;First alarm&quot; : &quot;Follow-up &quot; + i + &quot; (stage &quot; + (i + 1) + &quot; of &quot; + stages.length + &quot;)&quot;;
      return &#x27;&lt;li data-i=&quot;&#x27; + i + &#x27;&quot; class=&quot;&#x27; + cls + &#x27;&quot;&gt;&lt;span&gt;&#x27; + name + &#x27;&lt;/span&gt;&lt;span class=&quot;t&quot;&gt;&#x27; + fmt(t) + &quot;&lt;/span&gt;&lt;/li&gt;&quot;;
    }).join(&quot;&quot;);
    $(&quot;note&quot;).textContent = upAt === null
      ? &quot;Stop only silences one stage. Click a stage to hold I&#x27;m Up there.&quot;
      : &quot;I&#x27;m Up at &quot; + fmt(stages[upAt]) + &quot;: &quot; + (stages.length - 1 - upAt) + &quot; follow-up(s) canceled. Your other alarms are left alone.&quot;;
  }
  $(&quot;ladder&quot;).addEventListener(&quot;click&quot;, (e) =&gt; { const li = e.target.closest(&quot;li&quot;); if (li) { upAt = +li.dataset.i; render(); } });
  document.querySelectorAll(&quot;input&quot;).forEach((el) =&gt; el.addEventListener(&quot;input&quot;, () =&gt; { upAt = null; render(); }));
  render();
&lt;/script&gt;
</code></pre>
<p><em>A small JavaScript sketch of the Couch Mode rule from the README, not the app&#x27;s planner (that&#x27;s Swift, in <code>VoltWakeCore</code>). The real limits are 1 to 8 follow-ups, and you change the defaults in <strong>Settings › Smart Alarms</strong>.</em></p>
<h2>Two seconds to prove you&#x27;re awake</h2>
<p>So how do you end a wake-up? Not with a tap. <strong>I&#x27;m Up</strong> opens the <strong>Wake Check</strong>: a 2-second hold while a ring fills. A quick tap does nothing, so turning off the safety net is a deliberate act. When the hold lands, the confirmation tells you how many follow-ups it canceled, and your next scheduled alarm stays as it was.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/voltwake/demo-wake-check.webp" alt="The Wake Check on iPhone: a finger holds the I&#x27;m Up button while the ring fills with an amber gradient, then the screen says You&#x27;re up"/></p>
<p><em>Recreated in Montage from the SwiftUI source, including the 2-second hold timing.</em></p>
<p>Two seconds sounds like nothing. Try it while you&#x27;re 80% asleep. Or try it right here, with a mouse, a finger or the space bar. Let go early and see what happens:</p>
<pre><code class="language-html-live">&lt;style&gt;
  :root { color-scheme: dark; --amber: #ffa51f; --dim: #8a8a99; }
  body { margin: 0; min-height: 220px; display: grid; place-items: center; background: #000; color: #f4f4f5; font: 14px/1.4 system-ui, sans-serif; }
  .wrap { display: grid; justify-items: center; gap: 12px; text-align: center; }
  button { position: relative; width: 132px; height: 132px; border-radius: 50%; border: 0; background: #141414; color: #fff; font: 600 15px system-ui; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
  button:focus-visible { outline: 2px solid var(--amber); outline-offset: 4px; }
  svg { position: absolute; inset: -8px; width: 148px; height: 148px; transform: rotate(-90deg); pointer-events: none; }
  circle { fill: none; stroke-width: 8; }
  .track { stroke: #262626; }
  .fill { stroke: url(#energy); stroke-linecap: round; }
  #msg { color: var(--dim); min-height: 1.4em; }
  .done #msg { color: var(--amber); font-weight: 600; }
&lt;/style&gt;
&lt;div class=&quot;wrap&quot; id=&quot;wrap&quot;&gt;
  &lt;button id=&quot;btn&quot; aria-describedby=&quot;msg&quot;&gt;
    &lt;svg viewBox=&quot;0 0 148 148&quot; aria-hidden=&quot;true&quot;&gt;
      &lt;defs&gt;&lt;linearGradient id=&quot;energy&quot;&gt;&lt;stop offset=&quot;0&quot; stop-color=&quot;#ffd166&quot;/&gt;&lt;stop offset=&quot;1&quot; stop-color=&quot;#ff7a1a&quot;/&gt;&lt;/linearGradient&gt;&lt;/defs&gt;
      &lt;circle class=&quot;track&quot; cx=&quot;74&quot; cy=&quot;74&quot; r=&quot;66&quot;/&gt;
      &lt;circle class=&quot;fill&quot; id=&quot;ring&quot; cx=&quot;74&quot; cy=&quot;74&quot; r=&quot;66&quot;/&gt;
    &lt;/svg&gt;
    Hold&lt;br&gt;I&#x27;m Up
  &lt;/button&gt;
  &lt;div id=&quot;msg&quot;&gt;Press and hold for 2 seconds.&lt;/div&gt;
&lt;/div&gt;
&lt;script&gt;
  const HOLD_MS = 2000, C = 2 * Math.PI * 66;
  const ring = document.getElementById(&quot;ring&quot;), msg = document.getElementById(&quot;msg&quot;), wrap = document.getElementById(&quot;wrap&quot;), btn = document.getElementById(&quot;btn&quot;);
  ring.style.strokeDasharray = C; ring.style.strokeDashoffset = C;
  let start = null, raf = 0, done = false;
  function tick(now) {
    const p = Math.min(1, (now - start) / HOLD_MS);
    ring.style.strokeDashoffset = C * (1 - p);
    if (p &lt; 1) { raf = requestAnimationFrame(tick); return; }
    done = true; wrap.classList.add(&quot;done&quot;);
    msg.textContent = &quot;You&#x27;re up. The rest of this wake-up is canceled.&quot;;
    setTimeout(reset, 2200);
  }
  function press(e) { if (done || start !== null) return; e.preventDefault(); start = performance.now(); msg.textContent = &quot;Keep holding...&quot;; raf = requestAnimationFrame(tick); }
  function release() {
    if (start === null || done) return;
    cancelAnimationFrame(raf); start = null; ring.style.strokeDashoffset = C;
    msg.textContent = &quot;Too quick. A tap does nothing, and the next follow-up still rings.&quot;;
  }
  function reset() { done = false; start = null; wrap.classList.remove(&quot;done&quot;); ring.style.strokeDashoffset = C; msg.textContent = &quot;Press and hold for 2 seconds.&quot;; }
  btn.addEventListener(&quot;pointerdown&quot;, press);
  [&quot;pointerup&quot;, &quot;pointerleave&quot;, &quot;pointercancel&quot;].forEach((t) =&gt; btn.addEventListener(t, release));
  btn.addEventListener(&quot;keydown&quot;, (e) =&gt; { if ((e.key === &quot; &quot; || e.key === &quot;Enter&quot;) &amp;&amp; !e.repeat) press(e); });
  btn.addEventListener(&quot;keyup&quot;, (e) =&gt; { if (e.key === &quot; &quot; || e.key === &quot;Enter&quot;) release(); });
&lt;/script&gt;
</code></pre>
<p>If the hold feels like too much ceremony, one-tap confirmation is an option. I keep the hold.</p>
<h2>The countdown is always on the Lock Screen</h2>
<p>A wake-up that keeps coming back should at least tell you when. Once a smart alarm is running, a Live Activity counts down to its first alarm, and then each follow-up counts down to its turn, on the Lock Screen and in the Dynamic Island. Snoozes count down there too. And every one of them carries an <strong>I&#x27;m Up</strong> button, so you can end the wake-up without hunting for the app.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/voltwake/screens-wake-up.webp" alt="Three VoltWake iPhone screens: the Alarms tab with the next alarm over a sunrise card and Couch Mode, the expanded Dynamic Island showing Couch Mode stage 3 of 6 with I&#x27;m Up, and the Lock Screen counting down to the next follow-up"/></p>
<p><em>Recreated in Montage from the SwiftUI source: VoltWake hasn&#x27;t been captured on a device yet.</em></p>
<p>There&#x27;s one thing VoltWake doesn&#x27;t do, and it&#x27;s on purpose that I say so: it can&#x27;t get louder. Apps can&#x27;t raise or override the alarm volume. So a Power Alarm escalates by being more insistent, with more insistent sounds and more stages, not by blowing out your eardrums.</p>
<h2>Training in rounds, on iPhone and Apple Watch</h2>
<p>Now for the other half of the name. The <strong>Training</strong> tab has seven interval templates: Boxing (10 rounds), HIIT 40/20, Tabata, EMOM 10, AMRAP 12, Strength (5 sets) and Custom. Each one gets warm-up, work, rest, sets, cool-down, a final warning, 3-2-1 cues and a sound per phase.</p>
<p>The active workout screen keeps it simple: the phase, the round, a large countdown inside a glowing ring and the next interval, with <strong>Pause</strong>, <strong>Skip</strong> and <strong>End</strong> below. Work is amber, rest is teal, and the screen flips between them on its own.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/voltwake/workout-phase-flip.webp" alt="Left: an active boxing round in the amber work phase. Right: round 4 flipping from the amber work ring to the teal rest ring"/></p>
<p><em>Both recreated in Montage from the SwiftUI source (<code>ActiveWorkoutView.swift</code>).</em></p>
<p>Here&#x27;s that phase flip as a toy: HIIT 40/20, sped up ten times so you don&#x27;t have to actually do burpees to see it work.</p>
<pre><code class="language-html-live">&lt;style&gt;
  :root { color-scheme: dark; --work: #ffa51f; --rest: #3ec8c8; --dim: #8a8a99; }
  body { margin: 0; min-height: 230px; display: grid; place-items: center; background: #000; color: #f4f4f5; font: 13px/1.4 system-ui, sans-serif; transition: background .4s; }
  body.work { background: radial-gradient(circle at 50% 40%, #2a1a05, #000 70%); }
  body.rest { background: radial-gradient(circle at 50% 40%, #062424, #000 70%); }
  .card { display: grid; justify-items: center; gap: 6px; }
  .ring { position: relative; width: 150px; height: 150px; }
  svg { width: 150px; height: 150px; transform: rotate(-90deg); }
  circle { fill: none; stroke-width: 9; }
  .track { stroke: #222; }
  #arc { stroke: var(--c, var(--work)); stroke-linecap: round; filter: drop-shadow(0 0 6px var(--c, var(--work))); }
  .center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
  #phase { font-weight: 700; letter-spacing: .12em; color: var(--c, var(--work)); }
  #time { font-size: 34px; font-variant-numeric: tabular-nums; font-weight: 300; }
  #cue { font-size: 46px; font-weight: 700; color: var(--c, var(--work)); }
  #meta { color: var(--dim); }
  button { background: #1a1a1a; color: #fff; border: 1px solid #333; border-radius: 999px; padding: 5px 16px; font: inherit; cursor: pointer; }
&lt;/style&gt;
&lt;div class=&quot;card&quot;&gt;
  &lt;div id=&quot;meta&quot;&gt;HIIT 40/20 · Round 1 of 4 · 10x speed&lt;/div&gt;
  &lt;div class=&quot;ring&quot;&gt;
    &lt;svg viewBox=&quot;0 0 150 150&quot; aria-hidden=&quot;true&quot;&gt;&lt;circle class=&quot;track&quot; cx=&quot;75&quot; cy=&quot;75&quot; r=&quot;64&quot;/&gt;&lt;circle id=&quot;arc&quot; cx=&quot;75&quot; cy=&quot;75&quot; r=&quot;64&quot;/&gt;&lt;/svg&gt;
    &lt;div class=&quot;center&quot;&gt;&lt;div id=&quot;phase&quot;&gt;WORK&lt;/div&gt;&lt;div id=&quot;time&quot;&gt;00:40&lt;/div&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;button id=&quot;toggle&quot;&gt;Pause&lt;/button&gt;
&lt;/div&gt;
&lt;script&gt;
  const SPEED = 10, ROUNDS = 4, C = 2 * Math.PI * 64;
  const plan = []; for (let r = 1; r &lt;= ROUNDS; r++) { plan.push({ name: &quot;WORK&quot;, len: 40, r }); plan.push({ name: &quot;REST&quot;, len: 20, r }); }
  const arc = document.getElementById(&quot;arc&quot;); arc.style.strokeDasharray = C;
  let i = 0, left = plan[0].len, last = performance.now(), running = true;
  const $ = (id) =&gt; document.getElementById(id);
  function paint() {
    const p = plan[i], work = p.name === &quot;WORK&quot;;
    document.body.className = work ? &quot;work&quot; : &quot;rest&quot;;
    document.documentElement.style.setProperty(&quot;--c&quot;, work ? &quot;var(--work)&quot; : &quot;var(--rest)&quot;);
    $(&quot;phase&quot;).textContent = p.name;
    const s = Math.ceil(left);
    $(&quot;time&quot;).innerHTML = s &lt;= 3 &amp;&amp; s &gt; 0 ? &#x27;&lt;span id=&quot;cue&quot;&gt;&#x27; + s + &quot;&lt;/span&gt;&quot; : &quot;00:&quot; + String(s).padStart(2, &quot;0&quot;);
    $(&quot;meta&quot;).textContent = &quot;HIIT 40/20 · Round &quot; + p.r + &quot; of &quot; + ROUNDS + &quot; · 10x speed&quot;;
    arc.style.strokeDashoffset = C * (1 - left / p.len);
  }
  function frame(now) {
    const dt = (now - last) / 1000 * SPEED; last = now;
    if (running) { left -= dt; if (left &lt;= 0) { i = (i + 1) % plan.length; left = plan[i].len; } }
    paint(); requestAnimationFrame(frame);
  }
  $(&quot;toggle&quot;).onclick = () =&gt; { running = !running; $(&quot;toggle&quot;).textContent = running ? &quot;Pause&quot; : &quot;Resume&quot;; };
  requestAnimationFrame(frame);
&lt;/script&gt;
</code></pre>
<p>The <strong>Apple Watch</strong> app runs on its own, without your iPhone nearby. It has timers with a crown-driven quick timer, interval workouts as HealthKit workout sessions with heart rate and haptic phase changes, one quick alarm through watchOS&#x27;s smart-alarm session, and complications in circular, rectangular, inline and corner sizes. Your iPhone alarms show up on the watch through iOS itself, read-only, and timer and workout presets plus shared preferences sync both ways over WatchConnectivity.</p>
<h2>The rest of the toolbox</h2>
<p>A few more things live in the app, because once you have a reliable clock you start wanting it everywhere:</p>
<ul>
<li><strong>Concurrent timers.</strong> Any number of AlarmKit timers that ring with the app closed, with pause, resume, add time and restart. Five presets come with the app: Power Nap, Rest, Tea, Cooking and Focus.</li>
<li><strong>Sound library.</strong> Import MP3, M4A, AAC, WAV, AIFF, CAF and FLAC from Files, the Share Sheet or an HTTPS link, up to 250 MB and 2 hours. Trim with a waveform and fade in or out. 12 sounds are bundled.</li>
<li><strong>Widgets and Shortcuts.</strong> <strong>Next Alarm</strong> and <strong>Quick Start</strong> widgets for the Home Screen, Lock Screen and StandBy, and eight App Shortcuts for Siri, the Shortcuts app and the Action Button.</li>
<li><strong>Nightstand Mode.</strong> A dim, true-black bedside clock with the next alarm, an optional red display and keep-screen-on while VoltWake is open. Pure black at 3 a.m. is a kindness.</li>
</ul>
<p>The shortcuts read exactly how you&#x27;d say them half asleep:</p>
<table><thead><tr><th>Shortcut</th><th>Action</th></tr></thead><tbody><tr><td>&quot;Start Couch Mode with VoltWake&quot;</td><td>Starts Couch Mode</td></tr><tr><td>&quot;Start a VoltWake smart alarm&quot;</td><td>Starts one of your smart alarms</td></tr><tr><td>&quot;Create an alarm in VoltWake&quot;</td><td>Creates a new alarm</td></tr><tr><td>&quot;Turn on (alarm) in VoltWake&quot;</td><td>Switches an alarm on or off</td></tr><tr><td>&quot;Start a VoltWake timer&quot;</td><td>Starts a timer preset</td></tr><tr><td>&quot;Start boxing in VoltWake&quot;</td><td>Starts the boxing workout</td></tr><tr><td>&quot;Start a VoltWake workout&quot;</td><td>Starts a workout preset</td></tr><tr><td>&quot;Show my VoltWake alarms&quot;</td><td>Opens the Alarms tab</td></tr></tbody></table>
<p>And because an alarm app is something you look at every single night, you get to pick its face in <strong>Settings › App Icon</strong>:</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/voltwake/app-icons.webp" alt="The four VoltWake app icons: Midnight, Ember, Glass and Bronze"/></p>
<p><em>Midnight (the default), Ember, Glass and Bronze.</em></p>
<h2>How it works: plan, then reconcile</h2>
<p>This is the part I&#x27;m proudest of, and it&#x27;s the least visible. Scheduling in VoltWake is declarative. The app doesn&#x27;t schedule alarms one call at a time. Instead:</p>
<ol>
<li><strong>Plan.</strong> <code>AlarmPlanner</code> in the <code>VoltWakeCore</code> Swift package expands alarms, Power Alarms, smart alarms and naps into dated stages, with DST-aware occurrences. Follow-ups are planned about a week ahead.</li>
<li><strong>Reconcile.</strong> <code>AlarmCoordinator</code> hands that plan to <code>AlarmReconciler</code>, which diffs it against what AlarmKit already holds and applies only the changes through <code>AlarmKitSystem</code>. It never silences an alarm that&#x27;s ringing or counting down. UI tests swap in an in-memory alarm system.</li>
<li><strong>Show.</strong> AlarmKit rings the alarm and drives the alarm Live Activity. The widgets read a <code>WidgetSnapshot</code> from the App Group.</li>
<li><strong>Confirm.</strong> <strong>I&#x27;m Up</strong> runs an App Intent from <code>Shared/AlarmIntents.swift</code> that opens the Wake Check or, with one-tap confirmation, cancels the remaining stages directly.</li>
<li><strong>Sync.</strong> <code>PhoneSyncService</code> and <code>WatchSyncService</code> exchange presets and preferences over WatchConnectivity, and <code>SyncMerge</code> resolves conflicts.</li>
</ol>
<pre><code class="language-text">SwiftUI screens ──▶ VoltWakeStore (SwiftData) ──▶ AlarmCoordinator ──▶ AlarmPlanner (VoltWakeCore)
App Intents (Shortcuts, Live Activity buttons) ──▶ AlarmCoordinator ──▶ AlarmReconciler ──▶ AlarmKit
AlarmKit ──▶ Lock Screen and Dynamic Island (Live Activity)
AlarmKit ──▶ paired Apple Watch
VoltWakeStore ◀── WatchConnectivity ──▶ watchOS app ──▶ workout engine, countdowns, sync merge
</code></pre>
<p>Why bother? Because &quot;what should exist&quot; is easy to test, and &quot;what did I already tell the system three edits ago&quot; is where alarm apps go to die. The reconciler only ever applies a diff. Play with the idea below: toggle alarms in the plan, mark one as ringing, and see what the reconciler would do.</p>
<pre><code class="language-html-live">&lt;style&gt;
  :root { color-scheme: dark; --amber: #ffa51f; --teal: #3ec8c8; --red: #ff5a52; --dim: #8a8a99; }
  * { box-sizing: border-box; }
  body { margin: 0; padding: 14px; background: #000; color: #f4f4f5; font: 13px/1.4 system-ui, sans-serif; }
  .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  h3 { margin: 0 0 6px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
  label { display: flex; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 8px; background: #111; margin-bottom: 4px; }
  ul { list-style: none; margin: 0; padding: 0; }
  li { padding: 5px 8px; border-radius: 8px; background: #111; margin-bottom: 4px; display: flex; justify-content: space-between; gap: 8px; }
  .add { color: var(--teal); } .del { color: var(--red); } .keep { color: var(--dim); } .safe { color: var(--amber); }
  small { color: var(--dim); }
&lt;/style&gt;
&lt;div class=&quot;cols&quot;&gt;
  &lt;div&gt;
    &lt;h3&gt;The plan (what should exist)&lt;/h3&gt;
    &lt;div id=&quot;plan&quot;&gt;&lt;/div&gt;
    &lt;h3 style=&quot;margin-top:10px&quot;&gt;Ringing right now&lt;/h3&gt;
    &lt;select id=&quot;ringing&quot; style=&quot;width:100%;background:#111;color:#fff;border:1px solid #333;border-radius:6px;padding:4px&quot;&gt;&lt;/select&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;h3&gt;Reconciler&#x27;s diff&lt;/h3&gt;
    &lt;ul id=&quot;diff&quot;&gt;&lt;/ul&gt;
    &lt;small&gt;AlarmKit currently holds the alarms marked &quot;held&quot;.&lt;/small&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;script&gt;
  const all = [&quot;Wake Up 06:45&quot;, &quot;Couch Mode 21:00&quot;, &quot;Follow-up 21:30&quot;, &quot;Follow-up 22:00&quot;, &quot;Power Nap timer&quot;];
  const want = new Set([&quot;Wake Up 06:45&quot;, &quot;Couch Mode 21:00&quot;, &quot;Follow-up 21:30&quot;]);
  const held = new Set([&quot;Wake Up 06:45&quot;, &quot;Couch Mode 21:00&quot;, &quot;Follow-up 22:00&quot;, &quot;Power Nap timer&quot;]);
  const $ = (id) =&gt; document.getElementById(id);
  $(&quot;plan&quot;).innerHTML = all.map((a) =&gt; &#x27;&lt;label&gt;&lt;input type=&quot;checkbox&quot; value=&quot;&#x27; + a + &#x27;&quot;&#x27; + (want.has(a) ? &quot; checked&quot; : &quot;&quot;) + &quot;&gt; &quot; + a + (held.has(a) ? &quot; &lt;small&gt;(held)&lt;/small&gt;&quot; : &quot;&quot;) + &quot;&lt;/label&gt;&quot;).join(&quot;&quot;);
  $(&quot;ringing&quot;).innerHTML = &#x27;&lt;option value=&quot;&quot;&gt;Nothing&lt;/option&gt;&#x27; + [...held].map((a) =&gt; &quot;&lt;option&gt;&quot; + a + &quot;&lt;/option&gt;&quot;).join(&quot;&quot;);
  $(&quot;ringing&quot;).value = &quot;Follow-up 22:00&quot;;
  function render() {
    const ringing = $(&quot;ringing&quot;).value;
    const rows = [];
    for (const a of all) {
      const w = want.has(a), h = held.has(a);
      if (w &amp;&amp; !h) rows.push([&quot;add&quot;, &quot;schedule&quot;, a]);
      else if (!w &amp;&amp; h &amp;&amp; a === ringing) rows.push([&quot;safe&quot;, &quot;leave alone (ringing)&quot;, a]);
      else if (!w &amp;&amp; h) rows.push([&quot;del&quot;, &quot;cancel&quot;, a]);
      else if (w &amp;&amp; h) rows.push([&quot;keep&quot;, &quot;no change&quot;, a]);
    }
    $(&quot;diff&quot;).innerHTML = rows.map(([c, verb, a]) =&gt; &#x27;&lt;li&gt;&lt;span&gt;&#x27; + a + &#x27;&lt;/span&gt;&lt;span class=&quot;&#x27; + c + &#x27;&quot;&gt;&#x27; + verb + &quot;&lt;/span&gt;&lt;/li&gt;&quot;).join(&quot;&quot;);
  }
  $(&quot;plan&quot;).addEventListener(&quot;change&quot;, (e) =&gt; { e.target.checked ? want.add(e.target.value) : want.delete(e.target.value); render(); });
  $(&quot;ringing&quot;).addEventListener(&quot;change&quot;, render);
  render();
&lt;/script&gt;
</code></pre>
<p><em>A toy model of the rule in the README, not the Swift reconciler. The real one diffs the plan against what AlarmKit already holds.</em></p>
<p>The code is split the same way:</p>
<pre><code class="language-text">voltwake/
├── Packages/VoltWakeCore/   domain logic: alarm planning, smart alarms, countdowns, workouts, sync, audio rules
├── VoltWake/                iOS app: SwiftUI features, SwiftData store, AlarmKit services, App Intents
├── Shared/                  code shared with the widgets: brand tokens, alarm intents, widget snapshot
├── VoltWakeWidgets/         alarm and workout Live Activities, Home Screen, Lock Screen and StandBy widgets
├── VoltWakeWatch/           independent watchOS app: timers, HealthKit workouts, quick alarm, sync
├── VoltWakeWatchWidgets/    watch complications
├── VoltWakeTests/           integration tests hosted in the app
├── VoltWakeUITests/         UI journeys, the screenshot tour and the real-AlarmKit smoke test
├── Design/                  logo marks, the four app icons, sound scripts and credits
├── docs/                    product scope, platform notes, testing report, README media
└── project.yml              XcodeGen spec
</code></pre>
<p>Keeping the domain logic in a Swift package pays off in testing. <code>VoltWakeCore</code> has 78 Swift Testing tests for alarm planning, smart alarms, occurrences, countdowns, workouts, sync and audio rules, and they run on the Mac. The app hosts 46 integration tests covering the alarm coordinator, timers, the sound library, persistence and sync. <code>VoltWakeUITests</code> drives the core journeys (alarms, Power Alarms, Couch Mode, smart alarms, audio import, concurrent timers, workouts and the Wake Check) against in-memory storage and an in-memory alarm system, and <code>AlarmKitSmokeUITests</code> runs against the real AlarmKit on purpose.</p>
<h2>Nothing leaves your devices</h2>
<p>An alarm clock has no business knowing who you are, so VoltWake doesn&#x27;t ask:</p>
<ul>
<li><strong>No accounts and no backend.</strong> Alarms, presets, sounds and settings stay on your devices, in SwiftData and an App Group.</li>
<li><strong>No analytics.</strong> There is no analytics, telemetry or third-party SDK in the code.</li>
<li><strong>One network call, and only when you ask.</strong> Importing a sound from a link fetches that one HTTPS file. Nothing is uploaded.</li>
<li><strong>Your watch, not a server.</strong> Presets and preferences sync between your iPhone and Apple Watch over WatchConnectivity.</li>
<li><strong>Health stays in Health.</strong> On the watch, heart rate is read during a workout and the workout is saved to Health. VoltWake sends it nowhere else.</li>
</ul>
<h2>Under the hood</h2>
<p>Swift 6 · SwiftUI with Liquid Glass · AlarmKit · ActivityKit and WidgetKit · SwiftData · App Intents · HealthKit · WatchConnectivity. It runs on iOS 26+ and watchOS 26+, there are no third-party dependencies, and the Xcode project is generated with <a href="https://github.com/yonaskolb/XcodeGen">XcodeGen</a>.</p>
<p>If you have access to the source, building it from source looks like this (Xcode 27 with the iOS 27 and watchOS 27 SDKs):</p>
<pre><code class="language-sh">brew install xcodegen             # once
xcodegen generate                 # only needed after adding or removing files
open VoltWake.xcodeproj
</code></pre>
<p>Pick the <strong>VoltWake</strong> scheme for iPhone (it embeds the watch app) or <strong>VoltWakeWatch</strong> for the watch. The simulator runs without a development team.</p>
<h2>What&#x27;s not there yet</h2>
<p>VoltWake is in development, and the biggest caveat is a big one, so here it is plainly: <strong>it hasn&#x27;t been tested on a real iPhone or Apple Watch yet.</strong> All testing so far ran in the simulator, and a simulator can&#x27;t prove that an alarm rings on a locked, silenced phone. The physical-device checklist in the repo comes before any reliability claim, and version 1.0.0 stays a pre-release until it passes. For an app whose whole job is to not let you oversleep, I&#x27;m not going to pretend otherwise.</p>
<p>The other limits, straight from the README:</p>
<ul>
<li><strong>Custom alarm sounds.</strong> Alarms play up to 29 seconds of a sound, prepared as a separate clip. Some iOS 26 builds are reported to fall back to the system sound, so test yours once.</li>
<li><strong>Follow-ups need a weekly visit.</strong> Power Alarm follow-ups are scheduled about a week ahead and topped up whenever VoltWake or one of its alarms runs. Main alarms repeat on their own.</li>
<li><strong>Workout Live Activity.</strong> It&#x27;s display-only. Pause and skip need the app open, and background cues play bundled sounds.</li>
<li><strong>No Share Extension.</strong> Audio arrives through Open in, Files and links, so apps that only share through extensions don&#x27;t list VoltWake.</li>
<li><strong>English only and no iPad layout.</strong> The iPad runs the iPhone layout scaled up.</li>
<li><strong>Streaming services.</strong> Music from streaming services can&#x27;t be used for alarms. Sounds come from files you import.</li>
</ul>
<p>And what&#x27;s next on the roadmap:</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" disabled=""/> Run the physical-device checklist and drop the pre-release label.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Skip the next occurrence of a repeating alarm.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Optional wake challenges as a stronger confirmation, with the 2-second hold staying the default.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Workout cue audio synced to Apple Watch.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Interval workout history read back from HealthKit.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Shared presets as a <code>.voltwake</code> file through the Share Sheet.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> An iPad layout with timers and the workout side by side.</li>
</ul>
<p>It sits next to the other things I&#x27;ve built on the <a href="https://www.0x1ad2.dev/projects?project=voltwake">projects page</a>.</p>
<blockquote>
<p>Curious about the source? It&#x27;s private, but access can be granted to anyone interested in contributing. <a href="https://www.0x1ad2.dev/contact">Get in touch</a>.</p>
</blockquote>]]></content:encoded>
    </item>
    <item>
      <title>✍️ Jot: a notepad that finishes your sentence when you pause</title>
      <link>https://www.0x1ad2.dev/blog/jot</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/jot</guid>
      <pubDate>Wed, 25 Nov 2026 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>Jot is a macOS Markdown notepad that keeps every note a plain .md file, Obsidian vaults included. Pause, and Claude suggests how your sentence continues in ghost text. Select text, and one keystroke polishes, shortens or rewrites it.</description>
      <category>projects</category>
      <category>agent-tools</category>
      <category>macos</category>
      <category>tauri</category>
      <category>rust</category>
      <category>swiftui</category>
      <category>codemirror</category>
      <content:encoded><![CDATA[<p>Most writing assistants want to be part of the conversation the whole time. Jot sits quietly until you stop typing or ask it something, and that is the whole idea. Your notes stay plain <code>.md</code> files in a folder you choose, an existing Obsidian vault included, and <strong>the AI only speaks when you pause or ask.</strong></p>
<p><a href="https://www.0x1ad2.dev/images/projects/jot/explainer.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/jot/explainer-poster.webp" alt="Watch the 31-second Jot explainer"/></a></p>
<p><em>Watch the 31-second explainer (MP4, no audio, captions burned in).</em></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/jot/hero.webp" alt="Jot&#x27;s main window: a sidebar of notes and a Product launch plan note whose task list ends in an italic ghost-text continuation waiting for Tab"/></p>
<p><em>Every screen in this post is a mockup rebuilt from source with Montage (React rebuilds of the Tauri window), filled with synthetic notes and a synthetic masked key. None of them are screen recordings of the running app.</em></p>
<h2>Pause, and Claude finishes the sentence</h2>
<p>Write a few words and stop. After <strong>650 ms</strong> (you can set anything from 250 to 1,500 ms, in steps of 50), Jot sends Claude the note title, up to 1,500 characters before the caret and up to 400 after it, and asks for a short continuation of 80 tokens at most. The editor header says <strong>Thinking...</strong> while it waits. Then the rest of your sentence fades in after the caret in gray italics, with a small <strong>Tab</strong> badge next to it.</p>
<ul>
<li><code>Tab</code> accepts it and it becomes normal text.</li>
<li><code>Esc</code> or an arrow key dismisses it.</li>
<li>Keep typing and it never happened.</li>
</ul>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/jot/demo-ghost-text.gif" alt="A sentence is typed, the editor pauses, the header shows Thinking..., an italic ghost continuation fades in with a Tab badge, and Tab turns it into normal text"/></p>
<p><em>Type, pause, accept with Tab. Animated Montage mockup; the keycaps and pause ring are annotations.</em></p>
<h3>Never in the document early</h3>
<p>The suggestion is a CodeMirror widget decoration, drawn next to the text rather than inserted into it. Nothing in the note changes until you press <code>Tab</code>, so undo, autosave and search never see a suggestion you didn&#x27;t take. And when no suggestion is showing, <code>Tab</code> just indents, like it always did.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/jot/screenshot-1.webp" alt="A narrow Jot window with the sidebar collapsed and an italic gray continuation after the caret, followed by a small Tab badge"/></p>
<p><em>Ghost text at the minimum window size (720×480), sidebar collapsed. Montage mockup.</em></p>
<h3>Stale answers get dropped</h3>
<p>This is the subtle part. A network reply can arrive after you&#x27;ve already moved on, and a suggestion for a sentence you&#x27;ve since changed is worse than no suggestion at all. So every request carries a request ID, the caret position and a document revision. Typing, moving the caret or composing with an input method cancels the pending request, and any reply that no longer matches the current state is thrown away. The Rust backend keeps the latest autocomplete request in an <code>AtomicU64</code>, so an older reply can&#x27;t sneak in behind a newer one.</p>
<p>Here&#x27;s a toy version you can poke at. The &quot;model&quot; is a handful of canned sentences with a random delay, because this sandbox can&#x27;t reach any network (and shouldn&#x27;t). Type at the end of the line, pause, and watch the log. Then type again while it says <strong>Thinking...</strong> and see the stale reply get dropped.</p>
<pre><code class="language-html-live">&lt;style&gt;
  :root { color-scheme: dark; }
  body { margin: 0; padding: 16px; background: #000; color: #e8e8ee; font: 15px/1.6 ui-sans-serif, system-ui, -apple-system, sans-serif; }
  .bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 12px; color: #8a8aa0; margin-bottom: 8px; }
  .bar label { display: flex; align-items: center; gap: 6px; }
  #st { color: #a5a4ff; min-width: 6em; text-align: right; }
  .wrap { position: relative; background: #0b0b10; border-radius: 10px; }
  .wrap textarea, .wrap .mir { box-sizing: border-box; width: 100%; height: 8.5rem; margin: 0; padding: 12px 14px; font: inherit; line-height: 1.6; white-space: pre-wrap; overflow-wrap: break-word; overflow: hidden; border: 1px solid transparent; border-radius: 10px; }
  .mir { position: absolute; inset: 0; pointer-events: none; color: transparent; }
  textarea { position: relative; display: block; background: transparent; color: #e8e8ee; caret-color: #a5a4ff; resize: none; outline: none; border-color: #2a2a35 !important; }
  textarea:focus { border-color: #5856d6 !important; }
  .ghost { color: rgb(232 232 238 / 0.38); font-style: italic; }
  .tab { display: inline-block; margin-left: 6px; padding: 0 5px; border: 1px solid #5856d6; border-radius: 4px; color: #a5a4ff; font: 600 10px/1.5 ui-monospace, monospace; vertical-align: 1px; }
  #log { margin-top: 10px; max-height: 7.5rem; overflow: auto; font: 12px/1.5 ui-monospace, monospace; color: #8a8aa0; }
  .drop { color: #ff8a8a; } .ok { color: #8affc1; }
&lt;/style&gt;
&lt;div class=&quot;bar&quot;&gt;
  &lt;label&gt;Pause &lt;input id=&quot;d&quot; type=&quot;range&quot; min=&quot;250&quot; max=&quot;1500&quot; step=&quot;50&quot; value=&quot;650&quot;&gt; &lt;span id=&quot;dv&quot;&gt;650 ms&lt;/span&gt;&lt;/label&gt;
  &lt;span id=&quot;st&quot;&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;wrap&quot;&gt;
  &lt;div class=&quot;mir&quot; id=&quot;mir&quot; aria-hidden=&quot;true&quot;&gt;&lt;/div&gt;
  &lt;textarea id=&quot;ta&quot; spellcheck=&quot;false&quot; aria-label=&quot;Type here, then pause&quot;&gt;The spring release is about&lt;/textarea&gt;
&lt;/div&gt;
&lt;div id=&quot;log&quot; aria-live=&quot;polite&quot;&gt;&lt;/div&gt;
&lt;script&gt;
  const ta = document.getElementById(&quot;ta&quot;), mir = document.getElementById(&quot;mir&quot;);
  const st = document.getElementById(&quot;st&quot;), log = document.getElementById(&quot;log&quot;);
  const d = document.getElementById(&quot;d&quot;), dv = document.getElementById(&quot;dv&quot;);
  const canned = [
    &quot; and nothing touches the note until you press Tab.&quot;,
    &quot; faster capture and fewer clicks between a thought and a note.&quot;,
    &quot; so the draft is ready before the Friday review.&quot;,
    &quot; which keeps every note a plain Markdown file.&quot;,
    &quot; and the rest can wait until Monday.&quot;
  ];
  let rev = 0, req = 0, latest = 0, timer = 0, ghost = &quot;&quot;;
  const esc = (s) =&gt; s.replace(/&amp;/g, &quot;&amp;amp;&quot;).replace(/&lt;/g, &quot;&amp;lt;&quot;);
  function paint() {
    mir.innerHTML = esc(ta.value) + (ghost ? &#x27;&lt;span class=&quot;ghost&quot;&gt;&#x27; + esc(ghost) + &#x27;&lt;/span&gt;&lt;span class=&quot;tab&quot;&gt;Tab&lt;/span&gt;&#x27; : &quot;&quot;) + &quot;​&quot;;
  }
  function note(cls, msg) {
    const p = document.createElement(&quot;div&quot;);
    p.className = cls; p.textContent = msg; log.prepend(p);
  }
  function cancel(why) {
    clearTimeout(timer);
    if (latest) { note(&quot;drop&quot;, &quot;#&quot; + latest + &quot; cancelled: &quot; + why); latest = 0; st.textContent = &quot;&quot;; }
  }
  function ask() {
    if (ta.selectionStart !== ta.value.length || ta.value.trim().length &lt; 3) return;
    const id = ++req, r = rev;
    latest = id; st.textContent = &quot;Thinking...&quot;;
    note(&quot;&quot;, &quot;#&quot; + id + &quot; sent at revision &quot; + r);
    setTimeout(() =&gt; {
      if (id !== latest || r !== rev) { note(&quot;drop&quot;, &quot;#&quot; + id + &quot; reply dropped: it was for revision &quot; + r + &quot;, the note is at &quot; + rev); return; }
      latest = 0; st.textContent = &quot;&quot;;
      let g = canned[id % canned.length];
      if (/\s$/.test(ta.value)) g = g.trimStart();
      ghost = g; paint();
      note(&quot;ok&quot;, &quot;#&quot; + id + &quot; shown as ghost text&quot;);
    }, 300 + Math.random() * 900);
  }
  d.addEventListener(&quot;input&quot;, () =&gt; { dv.textContent = d.value + &quot; ms&quot;; });
  ta.addEventListener(&quot;input&quot;, () =&gt; {
    rev++; ghost = &quot;&quot;; paint();
    cancel(&quot;you kept typing&quot;);
    timer = setTimeout(ask, +d.value);
  });
  ta.addEventListener(&quot;keydown&quot;, (e) =&gt; {
    if (e.key === &quot;Tab&quot;) {
      e.preventDefault();
      if (ghost) {
        ta.value += ghost; ghost = &quot;&quot;; rev++; paint();
        ta.setSelectionRange(ta.value.length, ta.value.length);
        note(&quot;ok&quot;, &quot;accepted with Tab&quot;);
      } else {
        ta.setRangeText(&quot;  &quot;, ta.selectionStart, ta.selectionEnd, &quot;end&quot;); rev++; paint();
      }
    } else if (e.key === &quot;Escape&quot; || e.key.startsWith(&quot;Arrow&quot;)) {
      cancel(&quot;the caret moved&quot;);
      if (ghost) { ghost = &quot;&quot;; paint(); note(&quot;&quot;, &quot;ghost text dismissed&quot;); }
    }
  });
  ta.addEventListener(&quot;scroll&quot;, () =&gt; { mir.scrollTop = ta.scrollTop; });
  ta.setSelectionRange(ta.value.length, ta.value.length);
  paint();
  timer = setTimeout(ask, 900);
&lt;/script&gt;
</code></pre>
<h2>⌘J: six ways to say it better</h2>
<p>Select some text and a <strong>Rewrite with AI</strong> toolbar appears next to it. <code>⌘J</code> opens it for the current selection too. Pick an action and Jot sends Claude the selection, the instruction and up to 600 characters of the surrounding text, then shows the replacement as a preview right where the original sits.</p>
<table><thead><tr><th>Action</th><th>What Claude is asked to do</th></tr></thead><tbody><tr><td><strong>Polish</strong></td><td>Improve clarity, flow and readability</td></tr><tr><td><strong>Fix grammar</strong></td><td>Correct grammar, spelling and punctuation</td></tr><tr><td><strong>Shorter</strong></td><td>Make the text more concise</td></tr><tr><td><strong>Professional</strong></td><td>Shift to a polished, formal tone</td></tr><tr><td><strong>Casual</strong></td><td>Shift to a warm, conversational tone</td></tr><tr><td><strong>Custom</strong></td><td>Follow an instruction you type</td></tr></tbody></table>
<p><code>Enter</code> accepts, <code>Esc</code> rejects. Accepting replaces the original selection in a single CodeMirror transaction, which means one <code>⌘Z</code> brings your original words back. No archaeology through a dozen tiny undo steps.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/jot/screenshot-2.webp" alt="A selected paragraph with the Rewrite with AI toolbar, Shorter highlighted and an Accept and Reject preview of the shorter text"/></p>
<p><em>The rewrite toolbar with Shorter picked and the preview waiting. Montage mockup.</em></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/jot/demo-rewrite.gif" alt="A wordy paragraph is selected, Command J opens the rewrite toolbar, Shorter is clicked, the preview loads, Return accepts it and Command Z restores the original"/></p>
<p><em>Select, ⌘J, Shorter, Return, then ⌘Z. Animated Montage mockup.</em></p>
<p>Try the flow below. Again, the rewrites are canned so the playground works offline: in Jot, each of these buttons is a call to Claude. Pick one, accept it, then hit Undo (or <code>⌘Z</code>) and watch the whole rewrite come back as one step.</p>
<pre><code class="language-html-live">&lt;style&gt;
  :root { color-scheme: dark; }
  body { margin: 0; padding: 16px; background: #000; color: #e8e8ee; font: 15px/1.6 ui-sans-serif, system-ui, -apple-system, sans-serif; }
  #txt { padding: 12px 14px; border: 1px solid #2a2a35; border-radius: 10px; background: #0b0b10; }
  #txt mark { background: rgb(88 86 214 / 0.35); color: inherit; border-radius: 3px; }
  .tools { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
  button { font: 13px system-ui, sans-serif; color: #e8e8ee; background: #15151d; border: 1px solid #2a2a35; border-radius: 7px; padding: 5px 10px; cursor: pointer; }
  button:hover:not(:disabled) { border-color: #5856d6; }
  button.on { background: #5856d6; border-color: #5856d6; }
  button:disabled { opacity: 0.4; cursor: default; }
  #prev { display: none; padding: 10px 14px; border: 1px dashed #5856d6; border-radius: 10px; color: #c9c8ff; }
  #prev .row { display: flex; gap: 6px; margin-top: 8px; }
  #log { margin-top: 10px; font: 12px/1.5 ui-monospace, monospace; color: #8a8aa0; }
&lt;/style&gt;
&lt;div id=&quot;txt&quot;&gt;&lt;mark id=&quot;sel&quot;&gt;&lt;/mark&gt;&lt;/div&gt;
&lt;div class=&quot;tools&quot; id=&quot;tools&quot;&gt;&lt;/div&gt;
&lt;div id=&quot;prev&quot;&gt;&lt;div id=&quot;out&quot;&gt;&lt;/div&gt;&lt;div class=&quot;row&quot;&gt;&lt;button id=&quot;acc&quot;&gt;Accept ↩&lt;/button&gt;&lt;button id=&quot;rej&quot;&gt;Reject esc&lt;/button&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class=&quot;tools&quot;&gt;&lt;button id=&quot;undo&quot; disabled&gt;Undo ⌘Z&lt;/button&gt;&lt;/div&gt;
&lt;div id=&quot;log&quot; aria-live=&quot;polite&quot;&gt;Pick a rewrite for the highlighted text.&lt;/div&gt;
&lt;script&gt;
  const original = &quot;So basically what we want to do in this next sprint is to try to make sure that the onboarding flow is a lot simpler than it currently is right now, because at the moment a lot of people seem to get kind of lost somewhere around the second step.&quot;;
  const rewrites = {
    &quot;Polish&quot;: &quot;In the next sprint, we want to make the onboarding flow much simpler. Right now, many people get lost around the second step.&quot;,
    &quot;Fix grammar&quot;: &quot;So basically, what we want to do in this next sprint is try to make sure the onboarding flow is a lot simpler than it is right now, because at the moment a lot of people seem to get lost somewhere around the second step.&quot;,
    &quot;Shorter&quot;: &quot;Next sprint: simplify onboarding. People get lost at step two.&quot;,
    &quot;Professional&quot;: &quot;In the upcoming sprint, we will simplify the onboarding flow, as many users currently lose their way at the second step.&quot;,
    &quot;Casual&quot;: &quot;Next sprint, let&#x27;s make onboarding way simpler. Right now folks keep getting lost around step two.&quot;
  };
  const sel = document.getElementById(&quot;sel&quot;), tools = document.getElementById(&quot;tools&quot;);
  const prev = document.getElementById(&quot;prev&quot;), out = document.getElementById(&quot;out&quot;);
  const undo = document.getElementById(&quot;undo&quot;), log = document.getElementById(&quot;log&quot;);
  const history = [original];
  let pending = null;
  const current = () =&gt; history[history.length - 1];
  function render() {
    sel.textContent = current();
    undo.disabled = history.length &lt; 2;
    for (const b of tools.children) b.disabled = history.length &gt; 1 || pending !== null;
  }
  for (const name of Object.keys(rewrites)) {
    const b = document.createElement(&quot;button&quot;);
    b.textContent = name;
    b.onclick = () =&gt; {
      for (const x of tools.children) x.classList.remove(&quot;on&quot;);
      b.classList.add(&quot;on&quot;);
      pending = name; render();
      prev.style.display = &quot;block&quot;; out.textContent = &quot;Rewriting...&quot;;
      log.textContent = &quot;Sent: the selection, \&quot;&quot; + name + &quot;\&quot; and the surrounding text.&quot;;
      setTimeout(() =&gt; { if (pending === name) out.textContent = rewrites[name]; }, 500);
    };
    tools.appendChild(b);
  }
  function close() { pending = null; prev.style.display = &quot;none&quot;; for (const x of tools.children) x.classList.remove(&quot;on&quot;); render(); }
  function accept() {
    if (!pending || out.textContent === &quot;Rewriting...&quot;) return;
    history.push(rewrites[pending]);
    log.textContent = &quot;Accepted &quot; + pending + &quot; as one transaction. One undo brings the original back.&quot;;
    close();
  }
  function reject() { if (!pending) return; log.textContent = &quot;Rejected. The note never changed.&quot;; close(); }
  function doUndo() {
    if (history.length &lt; 2) return;
    history.pop(); log.textContent = &quot;Undone in one step: the original text is back.&quot;; render();
  }
  document.getElementById(&quot;acc&quot;).onclick = accept;
  document.getElementById(&quot;rej&quot;).onclick = reject;
  undo.onclick = doUndo;
  document.addEventListener(&quot;keydown&quot;, (e) =&gt; {
    if (e.key === &quot;Enter&quot; &amp;&amp; pending) { e.preventDefault(); accept(); }
    else if (e.key === &quot;Escape&quot;) reject();
    else if ((e.metaKey || e.ctrlKey) &amp;&amp; e.key.toLowerCase() === &quot;z&quot;) { e.preventDefault(); doUndo(); }
  });
  render();
&lt;/script&gt;
</code></pre>
<h2>Your key stays in the Keychain, your notes stay Markdown</h2>
<p>Two promises sit underneath the AI features.</p>
<h3>The key never leaves the Keychain</h3>
<p>Your Anthropic API key lives in the macOS Keychain (service <code>com.jot.app</code>, account <code>claude-api-key</code>), read and written through <code>/usr/bin/security</code>. It is never sent back to the interface, logged, or written to <code>localStorage</code> or the settings file. Settings only ever shows a masked form such as <code>sk-ant-•••a1b2</code>.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/jot/settings.webp" alt="The Settings sheet with a masked API key stored in the Keychain, model pickers, a 650 ms autocomplete delay, the notes folder and the appearance choice"/></p>
<p><em>Settings: key, models, delay, folder and theme. The key shown is synthetic. Montage mockup.</em></p>
<p>The privacy story is short because there&#x27;s not much to tell:</p>
<ul>
<li><strong>Notes stay on your Mac.</strong> Notes, settings and the key are stored locally. There is no account, sync, analytics or telemetry.</li>
<li><strong>Text goes to Anthropic only when the AI runs.</strong> With a key set and autocomplete on, each pause sends the note title and up to 1,900 characters around the caret. Each rewrite sends the selection, your instruction and up to 600 characters of context. Requests go straight from your Mac to <code>api.anthropic.com</code> with your own key, and Anthropic&#x27;s terms apply to that data.</li>
<li><strong>No key, no traffic.</strong> With no API key set, Jot is a plain local Markdown notepad and makes no network requests at all.</li>
</ul>
<h3>Every note is a plain .md file</h3>
<p>Notes live as <code>.md</code> files in a folder you pick, <code>~/Documents/Jot</code> by default. On first launch Jot creates that folder with a <strong>Welcome to Jot</strong> note. Point it at an existing folder or an Obsidian vault and it opens it in place, without importing, converting or touching the files already there.</p>
<p>Because those are your files, Jot is careful with them:</p>
<ul>
<li><strong>Safe saves.</strong> Edits autosave 300 ms after you stop typing. Each write goes to a temporary <code>.jot-tmp-*</code> file in the same folder and is renamed into place, so a crash never leaves half a note.</li>
<li><strong>No overwrites.</strong> A new or renamed note whose title is taken gets a numbered name (<code>Untitled.md</code>, <code>Untitled 2.md</code>).</li>
<li><strong>A fenced-in file layer.</strong> File commands reject <code>..</code>, slashes, dotfiles and anything that isn&#x27;t <code>.md</code>.</li>
</ul>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/jot/editor.webp" alt="Jot&#x27;s editor with the notes sidebar on the left and a Markdown note with headings, a task list and indigo syntax marks"/></p>
<p><em>The editor: source Markdown in a 680 px CodeMirror 6 column with indigo syntax marks. Montage mockup.</em></p>
<p>The editor itself is deliberately plain. You see the Markdown source, with headings, emphasis, links, code, quotes, lists and tasks highlighted. Click a <code>[ ]</code> marker or press <code>⌘↩</code> to toggle a task. <code>⌘K</code> searches titles, filenames and note bodies, with title matches first and then the most recently edited notes. The theme switches instantly between Light, Dark and System from Settings. Light is the default.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/jot/search-dark.webp" alt="The sidebar filtered by a search for onboarding in the dark theme, showing three notes whose bodies match"/></p>
<p><em>⌘K search matching note bodies, in the dark theme. Montage mockup.</em></p>
<h2>Two builds, one notes folder</h2>
<p>Here&#x27;s the slightly unusual bit: the repo holds <strong>two</strong> Mac apps that read and write the same files. The Tauri app has the full shortcut set. JotMac is a native SwiftUI and AppKit port with ghost text, rewrites and search.</p>
<table><thead><tr><th></th><th>Jot (Tauri)</th><th>JotMac (native)</th></tr></thead><tbody><tr><td><strong>Stack</strong></td><td>Tauri 2.5, Rust backend, React 19, CodeMirror 6, Tailwind CSS 4</td><td>Swift 6 package, SwiftUI <code>NavigationSplitView</code>, AppKit <code>NSTextView</code></td></tr><tr><td><strong>Ghost text and rewrites</strong></td><td>Yes</td><td>Yes</td></tr><tr><td><strong>Search</strong></td><td>Sidebar search field and ⌘K</td><td>Sidebar search field</td></tr><tr><td><strong>Shared</strong></td><td><code>~/Documents/Jot</code>, <code>~/.jot/settings.json</code>, the Keychain item</td><td>The same</td></tr></tbody></table>
<p>JotMac needs macOS 14 or later. Both apps share the notes folder, the settings file and the Keychain entry, so you can switch between them and your notes and key come with you.</p>
<h2>Under the hood</h2>
<p>The Tauri app is a React frontend talking to a Rust backend over Tauri IPC. The backend owns the files, the Keychain and the network.</p>
<pre><code class="language-text">Editor (React 19 · CodeMirror 6)
   │  Tauri IPC
   ▼
Rust backend (notes.rs · ai.rs)
   ├──► Notes folder      plain .md files
   ├──► macOS Keychain    API key
   └──► Anthropic         Messages API over HTTPS
</code></pre>
<ul>
<li><strong>Editor.</strong> <code>src/App.tsx</code> holds the app state, the autosave queue, global shortcuts and theme sync. <code>src/editor/autocomplete.ts</code> owns the ghost-text state field, the debounce and the revision guard, and <code>src/editor/markdown.ts</code> the highlighting, theme and keymap.</li>
<li><strong>IPC boundary.</strong> <code>src/services/notes.ts</code> and <code>src/services/ai.ts</code> are the only places that call Tauri commands. The frontend never sees the API key.</li>
<li><strong>Files.</strong> <code>src-tauri/src/notes.rs</code> canonicalizes the notes folder, validates every filename, writes through a temp file and an atomic rename, and runs the search.</li>
<li><strong>AI.</strong> <code>src-tauri/src/ai.rs</code> reads the key from the Keychain and calls the Anthropic Messages API with <code>reqwest</code>, with a 12 s timeout for completions.</li>
<li><strong>Native port.</strong> <code>macos/Sources/JotCore</code> reimplements the note store, Keychain store and Claude client in Swift, and <code>macos/Sources/JotMac</code> draws the SwiftUI window with an AppKit text view that renders the ghost text.</li>
</ul>
<p>Autocomplete and rewrites each get their own model: Claude Haiku 4.5, Claude Sonnet 4.5 or Claude Sonnet 4. Out of the box, the fast one writes ghost text and the bigger one does rewrites. These are the defaults the README lists for the settings in <code>~/.jot/settings.json</code> (the key is never part of that file):</p>
<pre><code class="language-json">{
  &quot;notesDir&quot;: &quot;~/Documents/Jot&quot;,
  &quot;autocompleteEnabled&quot;: true,
  &quot;autocompleteDelayMs&quot;: 650,
  &quot;autocompleteModel&quot;: &quot;claude-haiku-4-5-20251001&quot;,
  &quot;rewriteModel&quot;: &quot;claude-sonnet-4-5-20250929&quot;,
  &quot;appearance&quot;: &quot;light&quot;
}
</code></pre>
<p>The keyboard does most of the work:</p>
<table><thead><tr><th>Shortcut</th><th>Action</th></tr></thead><tbody><tr><td><code>⌘N</code></td><td>New note</td></tr><tr><td><code>⌘K</code></td><td>Search notes by title or content</td></tr><tr><td><code>⌘J</code></td><td>Rewrite the selection</td></tr><tr><td><code>Tab</code></td><td>Accept ghost text (indent otherwise)</td></tr><tr><td><code>Esc</code></td><td>Dismiss ghost text, the rewrite toolbar or a dialog</td></tr><tr><td><code>⌘B</code> / <code>⌘I</code></td><td>Toggle bold or italic on the selection</td></tr><tr><td><code>⌘↩</code></td><td>Toggle the task checkbox on the current line</td></tr><tr><td><code>⌘,</code></td><td>Open or close Settings</td></tr><tr><td><code>⌘Z</code> / <code>⇧⌘Z</code></td><td>Undo and redo, including accepted suggestions and rewrites</td></tr></tbody></table>
<p>It&#x27;s tested on all three layers: 11 Vitest tests for the frontend (the 650 ms wait, Tab and Escape, stale replies, note CRUD, search, the rewrite preview and undo after a rewrite), 6 Rust tests for the sandboxed file layer, settings that never store the key, key masking and UTF-8 safe context truncation, and 3 XCTest cases for the Swift note store, settings and key masking, and completion cleanup.</p>
<p>Jot is built from source. If you have access, it&#x27;s a handful of commands:</p>
<pre><code class="language-sh">pnpm install              # frontend and Tauri CLI dependencies
pnpm tauri dev            # Vite dev server with hot reload inside the Tauri window
pnpm macos:build          # build Jot.app and a DMG
pnpm macos:native:build   # build and sign macos/build/JotMac.app
pnpm test                 # Vitest suites
cargo test --manifest-path src-tauri/Cargo.toml
pnpm macos:native:test    # XCTest suite for JotCore
</code></pre>
<p>You&#x27;ll need a Mac, Node.js 20 or later, pnpm 11 or later, Rust with <code>cargo</code>, and the Xcode command line tools with Swift 6 for JotMac.</p>
<h2>What&#x27;s not there yet</h2>
<p>Jot is in development, and the README is upfront about the rough edges:</p>
<ul>
<li><strong>Not notarized.</strong> Builds are signed ad hoc, so Gatekeeper asks for confirmation on first launch.</li>
<li><strong>Apple silicon only, for now.</strong> The DMG is built for <code>aarch64</code>. Intel Macs need a local build.</li>
<li><strong>A fixed model list.</strong> The pickers offer three hard-coded Claude model IDs, so retiring one means a code change.</li>
<li><strong>Two builds to keep in step.</strong> The Tauri app and JotMac are separate implementations, and JotMac has no ⌘K yet.</li>
<li><strong>Placeholder identifiers.</strong> The bundle and Keychain IDs (<code>com.jot.*</code>) are placeholders, and the name Jot is shared with other notes apps.</li>
</ul>
<p>What&#x27;s next, straight from the roadmap:</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" disabled=""/> Sign with a Developer ID and notarize the builds</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> A universal DMG for Intel and Apple silicon</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Load the model list from settings instead of hard-coding it</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Bring JotMac&#x27;s shortcuts in line with the Tauri app, starting with ⌘K</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Pick final bundle and Keychain identifiers before any public release</li>
</ul>
<p><em>Jot is unofficial and not affiliated with or endorsed by Anthropic. Claude is a trademark of Anthropic. Jot opens Obsidian vaults as plain folders and is not affiliated with or endorsed by Obsidian.</em></p>
<p>Jot has its own card on the <a href="https://www.0x1ad2.dev/projects?project=jot">projects page</a>, with the demo loop, the explainer and the stack at a glance.</p>
<blockquote>
<p>Curious about the source? It&#x27;s private, but access can be granted to anyone interested in contributing. <a href="https://www.0x1ad2.dev/contact">Get in touch</a>.</p>
</blockquote>]]></content:encoded>
    </item>
    <item>
      <title>💪 Muscle Mirror: 22 muscles, live, over your camera</title>
      <link>https://www.0x1ad2.dev/blog/muscle-mirror</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/muscle-mirror</guid>
      <pubDate>Wed, 25 Nov 2026 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>Muscle Mirror turns your Mac's camera into an anatomical mirror. Apple Vision tracks your body and 22 color-coded muscle overlays move with you, so people who train, rehab or study anatomy can see each muscle and compare their left and right sides.</description>
      <category>projects</category>
      <category>apple</category>
      <category>macos</category>
      <category>swift</category>
      <category>swiftui</category>
      <category>apple-vision</category>
      <content:encoded><![CDATA[<p>Anatomy books are great until you try to find your infraspinatus with your own eyes. So I built a mirror that knows the map: you step in front of the camera, raise an arm, and the deltoids, biceps and forearm flexors raise with it, each in its own color, with fiber lines and a little label. Turn around and the back set takes over. It all runs on your Mac, and there is no network code in the app.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/muscle-mirror/hero.webp" alt="The Muscle Mirror window with the sidebar controls on the left and a mannequin on the black mirror pane, covered in translucent color-coded front muscles, white fibers, pill labels and a green skeleton"/></p>
<p><a href="https://www.0x1ad2.dev/images/projects/muscle-mirror/explainer.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/muscle-mirror/explainer-poster.webp" alt="Watch the 30-second Muscle Mirror explainer"/></a></p>
<p><em>The explainer runs 30 seconds: keypoints, the 22 muscles blooming by group, live tracking, the turn-around, calibration, left and right peaks and recording. Mockup rebuilt from source with Montage.</em></p>
<h2>Vision body pose on every frame, with optical flow so the overlays slip less</h2>
<p>Every camera frame goes through <code>VNDetectHumanBodyPoseRequest</code>. The app follows 15 joints (nose, neck, hip center, shoulders, elbows, wrists, hips, knees and ankles) and ignores any joint below 0.3 confidence. From those 15 points it draws 22 muscles in 5 regions, each one a translucent shape with an outline, fiber lines and a short label. The shapes live in body-relative coordinates, so they follow you instead of sticking to the screen.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/muscle-mirror/screenshot-1.webp" alt="Front view of a mannequin with all front muscles filled in color, white fiber lines, labels such as Pec major, Biceps, Obliques and Quads, the green skeleton and live values in the Compare left / right grid"/></p>
<p><em>Front view, all muscles. Mockup rebuilt from source with Montage.</em></p>
<p>The front view draws 11 muscles and the back view 13. The upper trapezius and middle deltoid are in both, which is how 11 + 13 adds up to 22 without anybody growing a spare shoulder.</p>
<table><thead><tr><th>Region</th><th>Front view</th><th>Back view</th></tr></thead><tbody><tr><td>Shoulders &amp; chest</td><td>Pectoralis major, anterior deltoid, middle deltoid, serratus anterior</td><td>Middle deltoid, posterior deltoid</td></tr><tr><td>Arms</td><td>Biceps brachii, forearm flexors</td><td>Triceps brachii, forearm extensors</td></tr><tr><td>Back</td><td>Upper trapezius</td><td>Upper trapezius, middle trapezius, lower trapezius, rhomboids, infraspinatus &amp; teres, latissimus dorsi</td></tr><tr><td>Core</td><td>Rectus abdominis, external oblique</td><td></td></tr><tr><td>Legs</td><td>Quadriceps, adductors</td><td>Gluteus maximus, hamstrings, gastrocnemius</td></tr></tbody></table>
<h3>How the mirror knows you turned around</h3>
<p>There&#x27;s no magic: on <strong>Auto</strong>, it checks whether Vision can see your nose or an eye. No face means you&#x27;re showing your back. The trick is not flipping the moment you blink or tilt your head, so the facing signal is averaged and only switches above 0.7 or below 0.3. This is the actual code from <code>Pose.swift</code>:</p>
<pre><code class="language-swift">// Hysteresis so the front/back view doesn&#x27;t flicker when the face is briefly lost.
if let pose {
    frontness += ((pose.facesCamera ? 1 : 0) - frontness) * 0.15
    if frontness &gt; 0.7 { facesCamera = true } else if frontness &lt; 0.3 { facesCamera = false }
}
</code></pre>
<p>Here it is in a box, using the same numbers. One tick is one frame with a pose. Hide the face for a few frames and watch the bar dip without the view flipping; hide it for good and it switches to the back set.</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; padding: 16px; background: #000; color: #fff; font: 14px/1.4 system-ui, sans-serif; }
  .row { display: flex; gap: 8px; flex-wrap: wrap; }
  button { background: #111; color: #fff; border: 1px solid #333; border-radius: 8px; padding: 6px 12px; font: inherit; cursor: pointer; }
  button[aria-pressed=&quot;false&quot;] { border-color: #f05138; }
  .bar { position: relative; height: 14px; margin: 16px 0 6px; border: 1px solid #333; border-radius: 7px; overflow: hidden; }
  .fill { position: absolute; inset: 0 auto 0 0; background: #3d85f2; }
  .tick { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; opacity: .6; }
  small { color: #888; }
  .view { margin: 14px 0 0; font-size: 20px; font-weight: 600; }
&lt;/style&gt;
&lt;div class=&quot;row&quot;&gt;
  &lt;button id=&quot;face&quot; aria-pressed=&quot;true&quot;&gt;Face visible&lt;/button&gt;
  &lt;button id=&quot;blink&quot;&gt;Look away for 3 frames&lt;/button&gt;
&lt;/div&gt;
&lt;div class=&quot;bar&quot;&gt;&lt;div class=&quot;fill&quot; id=&quot;fill&quot;&gt;&lt;/div&gt;&lt;div class=&quot;tick&quot; style=&quot;left:30%&quot;&gt;&lt;/div&gt;&lt;div class=&quot;tick&quot; style=&quot;left:70%&quot;&gt;&lt;/div&gt;&lt;/div&gt;
&lt;small&gt;frontness &lt;span id=&quot;val&quot;&gt;1.00&lt;/span&gt; · front above 0.7 · back below 0.3&lt;/small&gt;
&lt;p class=&quot;view&quot;&gt;View: &lt;span id=&quot;view&quot;&gt;Auto (front)&lt;/span&gt;&lt;/p&gt;
&lt;script&gt;
  const $ = (id) =&gt; document.getElementById(id);
  let frontness = 1, facesCamera = true, face = true, blink = 0;
  $(&#x27;face&#x27;).onclick = () =&gt; {
    face = !face;
    $(&#x27;face&#x27;).setAttribute(&#x27;aria-pressed&#x27;, String(face));
    $(&#x27;face&#x27;).textContent = face ? &#x27;Face visible&#x27; : &#x27;Face hidden&#x27;;
  };
  $(&#x27;blink&#x27;).onclick = () =&gt; { blink = 3; };
  setInterval(() =&gt; {
    const seen = face &amp;&amp; blink === 0;
    if (blink &gt; 0) blink--;
    frontness += ((seen ? 1 : 0) - frontness) * 0.15;
    if (frontness &gt; 0.7) facesCamera = true; else if (frontness &lt; 0.3) facesCamera = false;
    $(&#x27;fill&#x27;).style.width = (frontness * 100) + &#x27;%&#x27;;
    $(&#x27;val&#x27;).textContent = frontness.toFixed(2);
    $(&#x27;view&#x27;).textContent = facesCamera ? &#x27;Auto (front)&#x27; : &#x27;Auto (back)&#x27;;
  }, 1000 / 30);
&lt;/script&gt;
</code></pre>
<p>Three frames without a face only take the value from 1.00 down to about 0.61, so the view stays put. It takes eight frames in a row before it drops under 0.3 and the back muscles are drawn in:</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/muscle-mirror/demo-turn-around.webp" alt="The mannequin turns away from the camera, the front muscles fade out, View changes to Auto (back) and the back muscles are drawn in, then the mannequin turns back and the front set returns"/></p>
<p><em>Turning around and back again, 8 seconds. Mockup rebuilt from source with Montage.</em></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/muscle-mirror/screenshot-back.webp" alt="Back view of the mannequin with the trapezius in purples, rhomboids in magenta, lats in green, glutes and hamstrings in warm tones and calves in green, with View set to Auto (back)"/></p>
<p><em>The back set, picked automatically. Mockup rebuilt from source with Montage.</em></p>
<p>If you&#x27;d rather not be second-guessed by your own nose, set <strong>View</strong> to <strong>Front</strong> or <strong>Back</strong> and it stays there.</p>
<h3>Why the overlays don&#x27;t wobble</h3>
<p>Detections alone let the overlays slip, and a slipping pectoral is not a good look. So with <strong>Optical-flow tracking</strong> on, Vision also computes dense optical flow on a 384 px wide copy of each frame. Every joint first moves with the image motion, then goes 35% of the way toward the fresh detection:</p>
<pre><code class="language-swift">/// How far each frame moves a flow-predicted joint toward its detection.
private let detectionGain: CGFloat = 0.35

track.point = predicted.lerp(to: detected, detectionGain)
</code></pre>
<p>A joint the detector misses is held for 1 second with flow, or 0.25 seconds without. Turn flow off and each joint goes through a One Euro filter instead.</p>
<h2>Per-muscle calibration, saved per side</h2>
<p>The muscle templates are averages, and nobody is average. So any single muscle can be fitted to you:</p>
<ol>
<li>Pick one muscle under <strong>Show</strong> (the sidebar then shows its origin and insertion).</li>
<li>Press <strong>Space</strong> to freeze the frame.</li>
<li>Turn on <strong>Adjust outline</strong> and drag the handles onto your own anatomy.</li>
</ol>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/muscle-mirror/screenshot-calibration.webp" alt="Calibration with Show set to Biceps brachii, Adjust outline on, the biceps outline drawn with drag handles, one handle being dragged and a Frozen badge in the corner"/></p>
<p><em>Dragging the biceps handles on a frozen frame. Mockup rebuilt from source with Montage.</em></p>
<p>The nice part is where the offsets live. They are stored per side, in the local space of the body part the muscle belongs to (neck, shoulder, a torso patch or a limb segment, scaled by shoulder width). That means the adjusted outline keeps following you after you unfreeze, instead of staying glued to where you dragged it. <strong>Reset Biceps brachii</strong> (the button is named after the muscle you picked) clears one, <strong>Reset All Muscles</strong> clears the lot.</p>
<p>Calibration is the only thing the app keeps between sessions, in <code>UserDefaults</code> under <code>calibrationOffsets</code>. Every other control starts at its default each time you open it.</p>
<h2>Five joint metrics, left versus right, and ⌘R to record it</h2>
<p>This is the bit for anyone who suspects one side is lazier than the other. The <strong>Compare left / right</strong> grid measures 5 metrics on each side, live (<strong>Now</strong>) and as the highest value since you last pressed <strong>Reset Peaks</strong> (<strong>Peak</strong>). The <strong>L − R</strong> column shows the difference. Left and right are your own sides, not the sides of the image.</p>
<table><thead><tr><th>Metric</th><th>What it measures</th></tr></thead><tbody><tr><td>Arm elevation</td><td>Angle between the upper arm and the trunk. 0° is the arm at your side, 180° is overhead.</td></tr><tr><td>Elbow flexion</td><td>Angle at the elbow. 0° is a straight arm.</td></tr><tr><td>Shoulder height</td><td>Shoulder height above the neck along the trunk, as a percentage of shoulder width. Shows shrugging and tilt.</td></tr><tr><td>Leg elevation</td><td>Angle between the thigh and the trunk. 0° is standing straight.</td></tr><tr><td>Knee flexion</td><td>Angle at the knee. 0° is a straight leg.</td></tr></tbody></table>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/muscle-mirror/screenshot-2.webp" alt="A lateral raise with joint-angle tags at the shoulders and elbows, the Compare left / right grid filled with Now and Peak values and a REC 00:42 badge in the corner of the mirror"/></p>
<p><em>A lateral raise with joint-angle tags and a recording in progress. Mockup rebuilt from source with Montage.</em></p>
<p>The math is pleasantly small. <code>Comparison.swift</code> takes two vectors, normalizes them and takes the arc cosine of their dot product. Arm elevation compares the trunk (neck to mid-hip) with the upper arm; elbow flexion compares the upper arm with the forearm. Drag the elbow or the wrist below, then hit <strong>Reset Peaks</strong> and do it again:</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; padding: 12px; background: #000; color: #fff; font: 14px/1.4 system-ui, sans-serif; }
  canvas { display: block; width: 100%; max-width: 420px; height: auto; background: #050505; border: 1px solid #222; border-radius: 10px; touch-action: none; cursor: grab; }
  table { border-collapse: collapse; margin-top: 10px; font-variant-numeric: tabular-nums; }
  th, td { padding: 2px 14px 2px 0; text-align: left; }
  th { color: #888; font-weight: 400; }
  button { margin-top: 10px; background: #111; color: #fff; border: 1px solid #333; border-radius: 8px; padding: 6px 12px; font: inherit; cursor: pointer; }
&lt;/style&gt;
&lt;canvas id=&quot;c&quot; width=&quot;420&quot; height=&quot;320&quot;&gt;&lt;/canvas&gt;
&lt;table&gt;
  &lt;tr&gt;&lt;th&gt;&lt;/th&gt;&lt;th&gt;Now&lt;/th&gt;&lt;th&gt;Peak&lt;/th&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;Arm elevation&lt;/td&gt;&lt;td id=&quot;aNow&quot;&gt;&lt;/td&gt;&lt;td id=&quot;aPeak&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;Elbow flexion&lt;/td&gt;&lt;td id=&quot;eNow&quot;&gt;&lt;/td&gt;&lt;td id=&quot;ePeak&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;button id=&quot;reset&quot;&gt;Reset Peaks&lt;/button&gt;
&lt;script&gt;
  const c = document.getElementById(&#x27;c&#x27;), g = c.getContext(&#x27;2d&#x27;);
  const neck = { x: 150, y: 50 }, hip = { x: 150, y: 270 }, shoulder = { x: 200, y: 62 };
  const UPPER = 95, FORE = 85;
  let elbow = { x: 200, y: 62 + UPPER }, wrist = { x: 200, y: 62 + UPPER + FORE };
  let peakA = 0, peakE = 0, drag = null;
  const sub = (a, b) =&gt; ({ x: a.x - b.x, y: a.y - b.y });
  const len = (v) =&gt; Math.hypot(v.x, v.y);
  // Same idea as angle(_:_:) in Comparison.swift: acos of the dot of two unit vectors, in degrees.
  const angle = (a, b) =&gt; Math.acos(Math.max(-1, Math.min(1, (a.x * b.x + a.y * b.y) / (len(a) * len(b))))) * 180 / Math.PI;
  const toward = (from, to, r) =&gt; { const d = sub(to, from), l = len(d) || 1; return { x: from.x + d.x / l * r, y: from.y + d.y / l * r }; };
  const deg = (v) =&gt; Math.round(v) + &#x27;°&#x27;;
  function line(a, b, color, width) { g.strokeStyle = color; g.lineWidth = width; g.lineCap = &#x27;round&#x27;; g.beginPath(); g.moveTo(a.x, a.y); g.lineTo(b.x, b.y); g.stroke(); }
  function dot(p) { g.fillStyle = &#x27;#2ea44f&#x27;; g.beginPath(); g.arc(p.x, p.y, 6, 0, Math.PI * 2); g.fill(); }
  function render() {
    const trunkDown = sub(hip, neck);
    const a = angle(trunkDown, sub(elbow, shoulder));
    const e = angle(sub(elbow, shoulder), sub(wrist, elbow));
    peakA = Math.max(peakA, a); peakE = Math.max(peakE, e);
    g.clearRect(0, 0, c.width, c.height);
    line(neck, hip, &#x27;#333&#x27;, 3);
    line(neck, shoulder, &#x27;#2ea44f&#x27;, 2);
    line(shoulder, elbow, &#x27;rgba(61,133,242,.55)&#x27;, 22);
    line(elbow, wrist, &#x27;rgba(240,81,56,.45)&#x27;, 16);
    line(shoulder, elbow, &#x27;#2ea44f&#x27;, 2);
    line(elbow, wrist, &#x27;#2ea44f&#x27;, 2);
    [neck, shoulder, elbow, wrist].forEach(dot);
    g.fillStyle = &#x27;#fff&#x27;; g.font = &#x27;13px system-ui, sans-serif&#x27;;
    g.fillText(deg(e), elbow.x + 12, elbow.y - 8);
    g.fillText(deg(a), shoulder.x + 12, shoulder.y - 6);
    document.getElementById(&#x27;aNow&#x27;).textContent = deg(a);
    document.getElementById(&#x27;eNow&#x27;).textContent = deg(e);
    document.getElementById(&#x27;aPeak&#x27;).textContent = deg(peakA);
    document.getElementById(&#x27;ePeak&#x27;).textContent = deg(peakE);
  }
  function point(ev) { const r = c.getBoundingClientRect(); return { x: (ev.clientX - r.left) * c.width / r.width, y: (ev.clientY - r.top) * c.height / r.height }; }
  c.addEventListener(&#x27;pointerdown&#x27;, (ev) =&gt; {
    const p = point(ev);
    drag = len(sub(p, elbow)) &lt; len(sub(p, wrist)) ? &#x27;elbow&#x27; : &#x27;wrist&#x27;;
    c.setPointerCapture(ev.pointerId);
  });
  c.addEventListener(&#x27;pointermove&#x27;, (ev) =&gt; {
    if (!drag) return;
    const p = point(ev);
    if (drag === &#x27;elbow&#x27;) {
      const forearm = sub(wrist, elbow);
      elbow = toward(shoulder, p, UPPER);
      wrist = { x: elbow.x + forearm.x, y: elbow.y + forearm.y };
    } else {
      wrist = toward(elbow, p, FORE);
    }
    render();
  });
  c.addEventListener(&#x27;pointerup&#x27;, () =&gt; { drag = null; });
  document.getElementById(&#x27;reset&#x27;).onclick = () =&gt; { peakA = 0; peakE = 0; render(); };
  render();
&lt;/script&gt;
</code></pre>
<p>Turn on <strong>Joint angles</strong> and the app draws arm elevation, elbow flexion and knee flexion right next to the joints on the video. A biceps curl reads from about 8° to about 138° and back:</p>
<p><a href="https://www.0x1ad2.dev/images/projects/muscle-mirror/demo.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/muscle-mirror/demo-poster.webp" alt="Watch one biceps curl: the arm muscles bend with the forearms while the elbow-flexion tags and the left and right readouts count up and back down"/></a></p>
<p><em>One biceps curl with live elbow flexion on both sides, 6 seconds. Mockup rebuilt from source with Montage.</em></p>
<p>And when you want proof for later: <strong>⌘R</strong> records the mirror exactly as you see it, overlays and all, to an H.264 <code>.mov</code> in <code>~/Movies</code>. Press <strong>⌘R</strong> again to stop, and <strong>Show in Finder</strong> takes you to the file. Each frame is re-rendered at camera resolution with <code>ImageRenderer</code>, minus the calibration handles, and appended to an <code>AVAssetWriter</code>. Nothing is written unless you press the shortcut.</p>
<h2>Under the hood</h2>
<p>Muscle Mirror is a single Swift package with one executable target, written in SwiftUI. It builds with a Swift 6 toolchain and runs on macOS 15 or later.</p>
<table><thead><tr><th>Piece</th><th>What it does</th></tr></thead><tbody><tr><td>AVFoundation</td><td><code>CameraModel</code> runs an <code>AVCaptureSession</code> at 1920×1080 when the camera supports it: the built-in camera, an external webcam or Continuity Camera.</td></tr><tr><td>Apple Vision</td><td>Body pose on every frame, plus dense optical flow on a 384 px copy.</td></tr><tr><td>SwiftUI <code>Canvas</code></td><td><code>MirrorView</code> draws the frame, fills, outlines, fibers, labels, skeleton, angle tags and calibration handles.</td></tr><tr><td><code>AVAssetWriter</code></td><td>The H.264 recording.</td></tr><tr><td>Swift Package Manager</td><td>The build, wrapped into an app bundle by a script.</td></tr></tbody></table>
<p>Here is the whole pipeline, camera to movie file:</p>
<pre><code class="language-text">Camera ──┬──&gt; Vision body pose ──┐
         └──&gt; Optical flow ──────┴──&gt; PoseSmoother ──┬──&gt; MuscleTemplates ──&gt; MirrorView (Canvas) ──&gt; Recorder (.mov)
                                                     └──&gt; ComparisonModel (angles and peaks)
</code></pre>
<p>Each muscle in <code>MuscleTemplates</code> is a set of outline points in a local body space, scaled by shoulder width. Most limb muscles are spindles, widest at the belly, which is roughly how muscles feel about themselves too.</p>
<pre><code class="language-text">Sources/MuscleMirror/
├── ContentView.swift    app entry, window, toolbar, sidebar and comparison grid
├── MirrorView.swift     overlay style and the Canvas renderer
├── Muscles.swift        the 22 muscles, regions, colors and front/back templates
├── CameraModel.swift    AVFoundation capture and the frame processor
├── Pose.swift           Vision pose detection, smoothing and the One Euro filter
├── OpticalFlow.swift    downscaled Vision optical flow
├── Calibration.swift    per-side outline offsets in UserDefaults
├── Comparison.swift     2D joint-angle metrics and peaks
├── Recorder.swift       H.264 recording to ~/Movies
└── Geometry.swift       point and vector helpers
</code></pre>
<p>One small gotcha worth knowing: <code>swift run</code> doesn&#x27;t work. macOS only grants camera access to an app that has a camera usage description, so a script builds the binary, wraps it with <code>Support/Info.plist</code> into <code>build/MuscleMirror.app</code> and signs it ad hoc. Building from source looks like this:</p>
<pre><code class="language-sh">scripts/build-app.sh release --open   # build, bundle as build/MuscleMirror.app, sign ad hoc and open
scripts/build-app.sh debug --open     # faster, unoptimized build
</code></pre>
<h2>About those screenshots</h2>
<p>You may have noticed nobody in this post has a face. That&#x27;s on purpose: no image here is a camera capture. The window, the overlays and the readouts are rebuilt in Montage, my shared Remotion studio, from the app&#x27;s Swift sources. The muscle geometry and angle math are ported from <code>Muscles.swift</code>, <code>Geometry.swift</code> and <code>Comparison.swift</code>, and the body is a synthetic, faceless mannequin posed from joint positions.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/muscle-mirror/icon.webp" alt="The Muscle Mirror icon: a silver mirror ellipse with a green skeleton and the pec, deltoid and biceps from the app&#x27;s own templates, filled on the left half and outlined on the right"/></p>
<p>The icon comes from the same templates: a silver mirror ellipse, a green skeleton, and the pec, deltoid and biceps drawn by the app&#x27;s own shapes, filled on one half and outlined on the other. Left versus right, even in the icon.</p>
<h2>What&#x27;s not there yet</h2>
<p>Muscle Mirror is at v1.0.0. It&#x27;s honest about what a webcam can and can&#x27;t do:</p>
<ul>
<li><strong>Estimates only.</strong> Muscle positions come from 15 tracked joints and average templates. They&#x27;re approximate, even after calibration.</li>
<li><strong>2D angles.</strong> Angles are measured in the image plane, so they&#x27;re most accurate when you move parallel to the camera. Turning toward or away from it foreshortens the limbs.</li>
<li><strong>No activation.</strong> A camera can&#x27;t tell whether a muscle is working. The overlays show where a muscle is, not how hard it&#x27;s contracting.</li>
<li><strong>Front or back from your face.</strong> A side-on stance can show the wrong set. <strong>View</strong> set to <strong>Front</strong> or <strong>Back</strong> overrides it.</li>
<li><strong>One person.</strong> Only the first person Vision detects is tracked.</li>
<li><strong>Video only.</strong> Recordings have no audio track.</li>
<li><strong>Ad-hoc signed.</strong> The build is signed for your own Mac and isn&#x27;t notarized.</li>
</ul>
<p>There are no automated tests yet either; changes are checked by standing in front of a camera and checking that the overlays follow, <strong>Auto</strong> flips when you turn away, and elbow and knee flexion read close to 0° when your arms and legs are straight. On the roadmap:</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" disabled=""/> Unit tests for the angle metrics, the smoother and the template geometry</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Move the package to Swift 6 language mode</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Save the sidebar settings between sessions, the way calibration already is</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Sign with a Developer ID and notarize, so the app can be shared</li>
</ul>
<p>The other things I&#x27;ve built are on the <a href="https://www.0x1ad2.dev/projects?project=muscle-mirror">projects page</a>.</p>
<blockquote>
<p>Curious about the source? It&#x27;s private, but access can be granted to anyone interested in contributing. <a href="https://www.0x1ad2.dev/contact">Get in touch</a>.</p>
</blockquote>]]></content:encoded>
    </item>
    <item>
      <title>⏱️ Tempo: drag a task onto your week</title>
      <link>https://www.0x1ad2.dev/blog/tempo</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/tempo</guid>
      <pubDate>Wed, 25 Nov 2026 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>Tempo puts a kanban board and a time-blocking calendar in one workspace: capture a task, sort it on the board, drag it onto your week and finish it. Its two-way sync engine for Google Calendar and Google Tasks runs against simulated APIs for now.</description>
      <category>projects</category>
      <category>web-apps</category>
      <category>typescript</category>
      <category>react</category>
      <category>hono</category>
      <category>postgresql</category>
      <content:encoded><![CDATA[<p>A to-do list knows <em>what</em> you have to do. A calendar knows <em>when</em> you&#x27;re free. Neither one is very good at the other&#x27;s job, and the gap between them is where tasks go to quietly age. Tempo is for people who plan their day in time blocks, and its whole idea fits in one gesture: pick up a card, drop it on Tuesday at 08:00, done.</p>
<p>Fittingly for something called Tempo, the explainer is cut to a 100 BPM metronome. It&#x27;s 28 seconds, has no audio, and keeps time with a little four-dot beat pill.</p>
<p><a href="https://www.0x1ad2.dev/images/projects/tempo/explainer.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/tempo/explainer-poster.webp" alt="Watch the 28-second Tempo explainer"/></a></p>
<p><em>Mockups rebuilt from source with Montage, not captures. Google sync runs against simulated APIs.</em></p>
<p>Before the tour, one honest line up front: the sync logic is real, but the Google Calendar and Google Tasks on the other end are simulated. I&#x27;ll come back to exactly what that means. First, the fun part.</p>
<h2>Drop a card, get a work session</h2>
<p>Drop a card on the time grid and Tempo creates a work session that starts at the slot under the pointer and lasts the task&#x27;s estimate. A 60-minute task dropped on 08:00 becomes 08:00 to 09:00.</p>
<p>The detail I like most: the task itself is <strong>not copied</strong>. A session points at its task, so one task can have zero, one or several sessions. Split a big job across three mornings and it&#x27;s still one card on the board. Mark it done and its sessions stay attached, so the calendar keeps a record of the time you actually spent.</p>
<p><a href="https://www.0x1ad2.dev/images/projects/tempo/demo.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/tempo/demo-poster.webp" alt="Watch the drag-to-calendar loop: an Inbox card lands as a one-hour session on Tuesday 08:00"/></a></p>
<p><em>Drag a task onto the week to schedule it (6-second loop). Mockup rebuilt from source with Montage.</em></p>
<h3>How the drag bridge works</h3>
<p>Two drag systems share the screen. <code>@dnd-kit</code> handles sorting cards on the board, inside and across columns. Dragging <em>to the calendar</em> uses FullCalendar&#x27;s <code>Draggable</code> on <code>[data-fc-draggable=&quot;true&quot;]</code>, plus an HTML5 drop bridge. On drop, the bridge reads the <code>.fc-timegrid-col[data-date]</code> and <code>.fc-timegrid-slot-lane[data-time]</code> under the pointer and posts a <code>scheduled_task_sessions</code> row with <code>endTime = startTime + estimatedMinutes</code>.</p>
<p>That&#x27;s a nice, small idea, so here&#x27;s a toy version of it in a few lines. It isn&#x27;t Tempo&#x27;s code, just the same trick: each column carries a <code>data-date</code>, each slot a <code>data-time</code>, and on drop we look at what&#x27;s under the pointer. Drag a card onto the grid, a few times if you like, and watch the session count on the card go up while the task stays put.</p>
<pre><code class="language-html-live">&lt;style&gt;
  :root { color-scheme: dark; }
  body { margin: 0; padding: 12px; background: #000; color: #e5e5e5; font: 13px/1.4 system-ui, sans-serif; }
  .wrap { display: grid; grid-template-columns: 120px 1fr; gap: 10px; }
  .card { background: #111; border: 1px solid #333; border-radius: 8px; padding: 8px; margin-bottom: 6px;
          cursor: grab; touch-action: none; user-select: none; }
  .card small { display: block; color: #888; }
  .ghost { position: fixed; pointer-events: none; opacity: .85; width: 110px; z-index: 9; border-color: #2563eb; }
  .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .col h4 { margin: 0 0 4px; font: 500 12px system-ui; color: #888; }
  .slot { height: 22px; border-top: 1px dashed #222; position: relative; font-size: 10px; color: #444; }
  .slot.hot { background: rgb(37 99 235 / .3); }
  .session { position: absolute; left: 2px; right: 2px; top: 1px; z-index: 1; pointer-events: none;
             background: #2563eb; color: #fff; border-radius: 4px; padding: 2px 4px; overflow: hidden; }
  pre { background: #0a0a0a; border: 1px solid #222; border-radius: 8px; padding: 8px; margin: 10px 0 0;
        white-space: pre-wrap; color: #9ca3af; font-size: 11px; }
&lt;/style&gt;
&lt;div class=&quot;wrap&quot;&gt;
  &lt;div&gt;
    &lt;div class=&quot;card&quot; data-task=&quot;t1&quot; data-title=&quot;Write release notes&quot; data-estimate=&quot;60&quot;&gt;&lt;/div&gt;
    &lt;div class=&quot;card&quot; data-task=&quot;t2&quot; data-title=&quot;Reply to review&quot; data-estimate=&quot;30&quot;&gt;&lt;/div&gt;
    &lt;div class=&quot;card&quot; data-task=&quot;t3&quot; data-title=&quot;Sync tests&quot; data-estimate=&quot;90&quot;&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;grid&quot; id=&quot;grid&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre id=&quot;out&quot;&gt;Drag a card onto a slot.&lt;/pre&gt;
&lt;script&gt;
  const hhmm = (m) =&gt; String(Math.floor(m / 60)).padStart(2, &quot;0&quot;) + &quot;:&quot; + String(m % 60).padStart(2, &quot;0&quot;);
  const toMin = (t) =&gt; +t.slice(0, 2) * 60 + +t.slice(3);
  const sessions = {};
  const label = (c) =&gt; (c.innerHTML = c.dataset.title + &quot;&lt;small&gt;&quot; + c.dataset.estimate + &quot; min · &quot; +
    (sessions[c.dataset.task] || 0) + &quot; sessions&lt;/small&gt;&quot;);
  document.querySelectorAll(&quot;.card&quot;).forEach(label);

  for (const [date, day] of [[&quot;2026-11-23&quot;, &quot;Mon&quot;], [&quot;2026-11-24&quot;, &quot;Tue&quot;], [&quot;2026-11-25&quot;, &quot;Wed&quot;]]) {
    const col = document.createElement(&quot;div&quot;);
    col.className = &quot;col&quot;; col.dataset.date = date; col.innerHTML = &quot;&lt;h4&gt;&quot; + day + &quot;&lt;/h4&gt;&quot;;
    for (let m = 8 * 60; m &lt; 12 * 60; m += 30) {
      const slot = document.createElement(&quot;div&quot;);
      slot.className = &quot;slot&quot;; slot.dataset.time = hhmm(m); slot.textContent = hhmm(m);
      col.append(slot);
    }
    document.getElementById(&quot;grid&quot;).append(col);
  }

  let ghost = null, card = null, hot = null;
  const under = (e) =&gt; document.elementFromPoint(e.clientX, e.clientY)?.closest(&quot;[data-time]&quot;);
  document.addEventListener(&quot;pointerdown&quot;, (e) =&gt; {
    card = e.target.closest(&quot;.card&quot;); if (!card) return;
    ghost = card.cloneNode(true); ghost.classList.add(&quot;ghost&quot;); document.body.append(ghost);
    card.setPointerCapture(e.pointerId); move(e);
  });
  const move = (e) =&gt; {
    if (!ghost) return;
    ghost.style.left = e.clientX + 8 + &quot;px&quot;; ghost.style.top = e.clientY + 8 + &quot;px&quot;;
    hot?.classList.remove(&quot;hot&quot;); hot = under(e); hot?.classList.add(&quot;hot&quot;);
  };
  document.addEventListener(&quot;pointermove&quot;, move);
  document.addEventListener(&quot;pointerup&quot;, (e) =&gt; {
    if (!ghost) return;
    ghost.remove(); ghost = null; hot?.classList.remove(&quot;hot&quot;);
    const slot = under(e), col = slot?.closest(&quot;[data-date]&quot;);
    if (!slot || !col) return;
    const est = +card.dataset.estimate, start = toMin(slot.dataset.time);
    const s = document.createElement(&quot;div&quot;);
    s.className = &quot;session&quot;; s.style.height = (est / 30) * 22 - 3 + &quot;px&quot;; s.textContent = card.dataset.title;
    slot.append(s);
    sessions[card.dataset.task] = (sessions[card.dataset.task] || 0) + 1; label(card);
    document.getElementById(&quot;out&quot;).textContent = &quot;scheduled_task_sessions row\n&quot; + JSON.stringify({
      taskId: card.dataset.task,
      startTime: col.dataset.date + &quot;T&quot; + slot.dataset.time,
      endTime: col.dataset.date + &quot;T&quot; + hhmm(start + est),
    }, null, 2);
  });
&lt;/script&gt;
</code></pre>
<h2>Find free time, without squinting at the week</h2>
<p>Dragging is great when you already know where a task goes. When you don&#x27;t, open the task: the inspector suggests <strong>up to 3 free slots</strong> for the task&#x27;s estimate. It looks <strong>14 days ahead</strong>, stays inside your working hours (09:00 to 18:00, Monday to Friday by default) and steps around the sessions and events already on the calendar.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/tempo/screenshot-2.webp" alt="Calendar First layout with a Ready to Schedule drawer on the left, a wide week calendar and a task inspector showing smart schedule suggestions"/></p>
<p><em>Calendar First, with Time Blocking &amp; Smart Schedule in the inspector. Mockup rebuilt from source with Montage.</em></p>
<p>The scheduler lives in <code>packages/shared</code>, next to <code>detectSessionConflicts</code> and <code>computeDailyFocusStats</code>, as <code>findFreeTimeSlots</code>. The API and the web app import the same package, so they can&#x27;t disagree about what &quot;free&quot; means.</p>
<p>Here&#x27;s the shape of the rule as a toy. The week below is made up: a fully booked Monday, a choppy Tuesday and Wednesday, an open Thursday afternoon, a packed Friday and a weekend the finder skips on purpose. Change the estimate and see where the three suggestions land. (The real scheduler is in Tempo&#x27;s source; this one only takes the first gap that fits on each day, to keep it short.)</p>
<pre><code class="language-html-live">&lt;style&gt;
  :root { color-scheme: dark; }
  body { margin: 0; padding: 12px; background: #000; color: #e5e5e5; font: 13px/1.4 system-ui, sans-serif; }
  select { background: #111; color: #e5e5e5; border: 1px solid #333; border-radius: 6px; padding: 2px 6px; font: inherit; }
  .row { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 8px; margin: 3px 0; font-size: 11px; color: #888; }
  .bar { position: relative; height: 12px; background: #0d0d0d; border: 1px solid #1f1f1f; border-radius: 4px; overflow: hidden; }
  .off .bar { opacity: .25; }
  .seg { position: absolute; top: 0; bottom: 0; }
  .busy { background: #3f3f46; }
  .pick { background: #2563eb; }
  ol { margin: 10px 0 0; padding-left: 20px; }
  li { margin: 2px 0; }
&lt;/style&gt;
&lt;label&gt;Task estimate
  &lt;select id=&quot;est&quot;&gt;
    &lt;option value=&quot;30&quot;&gt;30 min&lt;/option&gt;&lt;option value=&quot;60&quot; selected&gt;60 min&lt;/option&gt;
    &lt;option value=&quot;120&quot;&gt;2 h&lt;/option&gt;&lt;option value=&quot;240&quot;&gt;4 h&lt;/option&gt;
  &lt;/select&gt;
&lt;/label&gt;
&lt;div id=&quot;days&quot;&gt;&lt;/div&gt;
&lt;ol id=&quot;out&quot;&gt;&lt;/ol&gt;
&lt;script&gt;
  const START = 9 * 60, END = 18 * 60, NAMES = [&quot;Mon&quot;, &quot;Tue&quot;, &quot;Wed&quot;, &quot;Thu&quot;, &quot;Fri&quot;, &quot;Sat&quot;, &quot;Sun&quot;];
  // [day, start, end] in minutes; day 0 is a Monday, days 7 to 13 are the next week
  const busy = [[0, 540, 1080], [1, 540, 750], [1, 780, 1080], [2, 540, 600], [2, 630, 1020], [3, 540, 900], [4, 540, 1080]];
  const hhmm = (m) =&gt; String(Math.floor(m / 60)).padStart(2, &quot;0&quot;) + &quot;:&quot; + String(m % 60).padStart(2, &quot;0&quot;);
  const dayName = (d) =&gt; NAMES[d % 7] + (d &gt; 6 ? &quot; (wk 2)&quot; : &quot;&quot;);

  function findFree(est) {
    const found = [];
    for (let d = 0; d &lt; 14 &amp;&amp; found.length &lt; 3; d++) {
      if (d % 7 &gt; 4) continue; // working days only
      let t = START, fit = null;
      for (const [, s, e] of busy.filter((b) =&gt; b[0] === d).sort((a, b) =&gt; a[1] - b[1])) {
        if (s - t &gt;= est) { fit = t; break; }
        t = Math.max(t, e);
      }
      if (fit === null &amp;&amp; END - t &gt;= est) fit = t;
      if (fit !== null) found.push([d, fit]);
    }
    return found;
  }

  const pct = (m) =&gt; ((m - START) / (END - START)) * 100 + &quot;%&quot;;
  function render() {
    const est = +document.getElementById(&quot;est&quot;).value, picks = findFree(est);
    let html = &quot;&quot;;
    for (let d = 0; d &lt; 14; d++) {
      const segs = busy.filter((b) =&gt; b[0] === d).map(([, s, e]) =&gt;
        &#x27;&lt;i class=&quot;seg busy&quot; style=&quot;left:&#x27; + pct(s) + &quot;;width:calc(&quot; + pct(e) + &quot; - &quot; + pct(s) + &#x27;)&quot;&gt;&lt;/i&gt;&#x27;).join(&quot;&quot;) +
        picks.filter((p) =&gt; p[0] === d).map(([, s]) =&gt;
        &#x27;&lt;i class=&quot;seg pick&quot; style=&quot;left:&#x27; + pct(s) + &quot;;width:calc(&quot; + pct(s + est) + &quot; - &quot; + pct(s) + &#x27;)&quot;&gt;&lt;/i&gt;&#x27;).join(&quot;&quot;);
      html += &#x27;&lt;div class=&quot;row&#x27; + (d % 7 &gt; 4 ? &quot; off&quot; : &quot;&quot;) + &#x27;&quot;&gt;&lt;span&gt;&#x27; + dayName(d) + &#x27;&lt;/span&gt;&lt;div class=&quot;bar&quot;&gt;&#x27; + segs + &quot;&lt;/div&gt;&lt;/div&gt;&quot;;
    }
    document.getElementById(&quot;days&quot;).innerHTML = html;
    document.getElementById(&quot;out&quot;).innerHTML = picks.length
      ? picks.map(([d, s]) =&gt; &quot;&lt;li&gt;&quot; + dayName(d) + &quot; &quot; + hhmm(s) + &quot; to &quot; + hhmm(s + est) + &quot;&lt;/li&gt;&quot;).join(&quot;&quot;)
      : &quot;&lt;li&gt;No room in the next 14 days&lt;/li&gt;&quot;;
  }
  document.getElementById(&quot;est&quot;).addEventListener(&quot;change&quot;, render);
  render();
&lt;/script&gt;
</code></pre>
<h2>A real sync engine, pointed at a simulated Google</h2>
<p>This is the part I want to be precise about, because it&#x27;s the easiest one to oversell.</p>
<p>Tempo works without any Google credentials. Out of the box, <strong>Connect</strong> in <strong>Integrations</strong> links a demo account, and sync runs against wire-compatible Google Calendar v3 and Google Tasks v1 stores inside the API process (<code>GoogleCalendarWireStore</code> and <code>GoogleTasksWireStore</code>). Set <code>GOOGLE_CLIENT_ID</code> and <code>GOOGLE_CLIENT_SECRET</code> and <strong>Connect</strong> runs the real Google OAuth flow instead. Even then, only the OAuth token exchange and the <code>userinfo</code> call reach Google; Calendar and Tasks calls still go to those in-process stores, which live in memory and reset when the API restarts.</p>
<p>So: the plumbing is real, the far end of the pipe is a very convincing stand-in. Here&#x27;s what the plumbing does.</p>
<table><thead><tr><th>Piece</th><th>What Tempo does</th></tr></thead><tbody><tr><td>Sign-in</td><td>Authorization code flow with PKCE (S256), scopes <code>openid</code>, <code>email</code>, <code>profile</code>, Calendar and Tasks</td></tr><tr><td>Tokens</td><td>Access and refresh tokens encrypted with AES-256-GCM using <code>TOKEN_ENCRYPTION_KEY</code> before they&#x27;re stored</td></tr><tr><td>Calendar events</td><td>One event per Tempo session. Moving the event in Google moves the session in Tempo</td></tr><tr><td>Incremental sync</td><td><code>syncToken</code> and <code>etag</code> per calendar in <code>integration_sync_state</code>; a <code>410 Gone</code> drops the token and runs a full reconciliation</td></tr><tr><td>Tasks import</td><td>A unique mapping on <code>(user_id, source, external_id)</code> prevents duplicates</td></tr><tr><td>Tasks conflicts</td><td>Last-write-wins on title, description, due date and status, comparing Google&#x27;s <code>updated</code> with Tempo&#x27;s <code>updatedAt</code></td></tr><tr><td>Tempo-only fields</td><td>Estimate, priority, category, project and sessions are never overwritten</td></tr><tr><td>Offline</td><td>A <code>503</code> or network error keeps the change in Postgres as <code>pending_retry</code>; the next sync pushes it</td></tr></tbody></table>
<h3>Only touching its own events</h3>
<p>The rule I&#x27;d want from any app with write access to my calendar: Tempo only ever edits or deletes the events it created. Every session&#x27;s event carries a private tag in <code>extendedProperties.private</code>:</p>
<pre><code class="language-json">{
  &quot;extendedProperties&quot;: {
    &quot;private&quot;: {
      &quot;tempoSessionId&quot;: &quot;…&quot;,
      &quot;tempoTaskId&quot;: &quot;…&quot;,
      &quot;tempoManaged&quot;: &quot;true&quot;
    }
  }
}
</code></pre>
<p>Unscheduling or deleting a task removes only its Tempo-managed events, never your other ones. And a Google Tasks due date is never treated as a calendar time slot, which is exactly the kind of thing you only notice when an app gets it wrong.</p>
<h3>When Google has a bad day</h3>
<p>When Google Calendar is unavailable, edits are saved locally, the session is marked <code>pending_retry</code>, the top bar says <strong>Sync Pending Retry</strong>, and the next sync pushes the change. <strong>Integrations</strong> can even simulate an outage so you can watch it happen. Here&#x27;s the same loop as a toy you can break on purpose: take Calendar down, move the session, then bring it back and sync.</p>
<pre><code class="language-html-live">&lt;style&gt;
  :root { color-scheme: dark; }
  body { margin: 0; padding: 12px; background: #000; color: #e5e5e5; font: 13px/1.4 system-ui, sans-serif; }
  .bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
  button { background: #111; color: #e5e5e5; border: 1px solid #333; border-radius: 6px; padding: 5px 10px; font: inherit; cursor: pointer; }
  button:hover { border-color: #2563eb; }
  .pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid #333; }
  .up { color: #4ade80; } .down { color: #f87171; }
  #banner { display: none; background: rgb(234 179 8 / .15); color: #facc15; border: 1px solid rgb(234 179 8 / .4);
            border-radius: 6px; padding: 4px 8px; margin-bottom: 10px; font-size: 12px; }
  .session { background: #2563eb; color: #fff; border-radius: 6px; padding: 6px 8px; display: inline-block; }
  .session small { opacity: .8; margin-left: 6px; }
  #log { margin: 10px 0 0; padding: 8px; background: #0a0a0a; border: 1px solid #222; border-radius: 8px;
         font: 11px ui-monospace, monospace; color: #9ca3af; white-space: pre-wrap; min-height: 4em; }
&lt;/style&gt;
&lt;div id=&quot;banner&quot;&gt;Sync Pending Retry&lt;/div&gt;
&lt;div class=&quot;bar&quot;&gt;
  &lt;span&gt;Google Calendar&lt;/span&gt;&lt;span id=&quot;api&quot; class=&quot;pill up&quot;&gt;reachable&lt;/span&gt;
  &lt;button id=&quot;toggle&quot;&gt;Simulate outage&lt;/button&gt;
  &lt;button id=&quot;move&quot;&gt;Move session +30 min&lt;/button&gt;
  &lt;button id=&quot;sync&quot;&gt;Sync now&lt;/button&gt;
&lt;/div&gt;
&lt;div class=&quot;session&quot; id=&quot;session&quot;&gt;&lt;/div&gt;
&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
&lt;script&gt;
  let up = true, start = 8 * 60, status = &quot;synced&quot;;
  const $ = (id) =&gt; document.getElementById(id);
  const hhmm = (m) =&gt; String(Math.floor(m / 60)).padStart(2, &quot;0&quot;) + &quot;:&quot; + String(m % 60).padStart(2, &quot;0&quot;);
  const log = (line) =&gt; ($(&quot;log&quot;).textContent = line + &quot;\n&quot; + $(&quot;log&quot;).textContent);
  function render() {
    $(&quot;session&quot;).innerHTML = &quot;Write release notes, Tue &quot; + hhmm(start) + &quot;&lt;small&gt;syncStatus: &quot; + status + &quot;&lt;/small&gt;&quot;;
    $(&quot;banner&quot;).style.display = status === &quot;pending_retry&quot; ? &quot;block&quot; : &quot;none&quot;;
    $(&quot;api&quot;).textContent = up ? &quot;reachable&quot; : &quot;503&quot;;
    $(&quot;api&quot;).className = &quot;pill &quot; + (up ? &quot;up&quot; : &quot;down&quot;);
    $(&quot;toggle&quot;).textContent = up ? &quot;Simulate outage&quot; : &quot;End outage&quot;;
  }
  $(&quot;toggle&quot;).onclick = () =&gt; { up = !up; log(up ? &quot;Calendar is back.&quot; : &quot;Calendar now answers 503.&quot;); render(); };
  $(&quot;move&quot;).onclick = () =&gt; {
    start += 30;
    if (up) { status = &quot;synced&quot;; log(&quot;Moved to &quot; + hhmm(start) + &quot;. The event follows.&quot;); }
    else { status = &quot;pending_retry&quot;; log(&quot;Moved to &quot; + hhmm(start) + &quot;. Calendar failed, kept locally as pending_retry.&quot;); }
    render();
  };
  $(&quot;sync&quot;).onclick = () =&gt; {
    if (status !== &quot;pending_retry&quot;) log(&quot;Nothing pending.&quot;);
    else if (!up) log(&quot;Still down. The change stays pending_retry.&quot;);
    else { status = &quot;synced&quot;; log(&quot;Pushed the pending change. Event now at &quot; + hhmm(start) + &quot;.&quot;); }
    render();
  };
  render();
&lt;/script&gt;
</code></pre>
<h2>Four layouts, two themes</h2>
<p>Different days want different screens, so Tempo has four layouts, each in light and dark. Switch from the segmented control in the top bar, the sidebar, the command palette or a shortcut. The choice lands in <code>user_preferences</code> in the database, together with the theme and panel widths, so it survives a reload. The animations respect <code>prefers-reduced-motion</code>.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/tempo/demo-layout-switcher.webp" alt="The cursor clicks through the top bar layout switcher from Balanced to Calendar, Today Focus and Power Pro, then the theme toggle switches the window to dark mode and back"/></p>
<p><em>The layout switcher and the theme toggle (8-second loop). Mockup rebuilt from source with Montage.</em></p>
<table><thead><tr><th>Layout</th><th>Top bar label</th><th>Web shortcut</th><th>Tempo.app</th><th>What it&#x27;s for</th></tr></thead><tbody><tr><td>Balanced Workspace</td><td>Balanced</td><td><code>B</code></td><td><code>⌘1</code></td><td>Board and calendar side by side, with a resizable split</td></tr><tr><td>Calendar First</td><td>Calendar</td><td><code>C</code></td><td><code>⌘2</code></td><td>Planning the week, with a compact task drawer and an inline inspector</td></tr><tr><td>Daily Focus</td><td>Today Focus</td><td><code>T</code></td><td><code>⌘3</code></td><td>Getting through today: focus progress, priorities and a day timeline</td></tr><tr><td>Power User</td><td>Power Pro</td><td>command palette</td><td><code>⌘4</code></td><td>High-density kanban with a docked inspector and a weekly time grid</td></tr></tbody></table>
<p><strong>Balanced Workspace</strong> is the default: sidebar with categories and projects, the task center (board, categories or list) and the calendar, with a handle between the last two to resize them.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/tempo/screenshot-1.webp" alt="Balanced layout with the sidebar, a four-column kanban board and a week calendar holding Tempo sessions and synced calendar events"/></p>
<p><strong>Daily Focus</strong> is the calm one. A ring tracks focus time against a daily goal (420 minutes by default), the quick-capture bar adds a <strong>Task</strong>, <strong>Event</strong>, <strong>Focus block</strong> or <strong>Habit</strong>, and today&#x27;s tasks are grouped by category next to a one-day timeline.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/tempo/screenshot-daily-focus.webp" alt="Daily Focus layout with a quick-capture bar, a focus-time progress ring, today&#x27;s tasks grouped by category and a one-day timeline"/></p>
<p><strong>Power User</strong> is the opposite: compact kanban cards, a task inspector docked at the bottom and a time grid, with as many tasks on screen as possible. It looks particularly good in the dark.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/tempo/screenshot-power-user-dark.webp" alt="Power User layout in dark mode with compact kanban columns, a docked task inspector and a three-day time grid"/></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/tempo/screenshot-calendar-first-dark.webp" alt="Calendar First layout in dark mode with a Ready to Schedule drawer, a wide week calendar and the task inspector"/></p>
<p><em>All screens are mockups rebuilt from source with Montage, with synthetic demo data.</em></p>
<h2>The small things that add up</h2>
<ul>
<li><strong>Board, grid or list.</strong> Four default columns (<strong>Inbox</strong>, <strong>To Do</strong>, <strong>In Progress</strong>, <strong>Done</strong>) with drag-and-drop inside and across columns. Add, rename, reorder and delete columns, or see the same tasks as a <strong>Categories</strong> grid or a <strong>List</strong>.</li>
<li><strong>One calendar for everything.</strong> <strong>Day</strong>, <strong>3-Day</strong>, <strong>Week</strong>, <strong>Month</strong> and <strong>Agenda</strong> views show Tempo sessions next to synced calendar events.</li>
<li><strong>Real task details.</strong> 7 categories, 5 priorities (Urgent to None), projects, estimates, due dates, subtasks, attachments, duplicate and bulk actions.</li>
<li><strong>Trello import.</strong> Paste a Trello board&#x27;s JSON export in <strong>Integrations</strong> and Tempo creates the project, columns, tasks, labels and subtasks.</li>
<li><strong>Keyboard first.</strong> A command palette on <code>⌘K</code> / <code>Ctrl K</code>, plus single-key shortcuts: <code>N</code> for a new task, <code>/</code> to search, <code>B</code>, <code>C</code> and <code>T</code> for layouts. They&#x27;re ignored while you type in a field, as they should be.</li>
<li><strong>Zero-setup database.</strong> It uses PostgreSQL 16 from Docker when it&#x27;s running, and quietly falls back to embedded PostgreSQL (PGlite) when it isn&#x27;t.</li>
<li><strong>Tempo.app for macOS.</strong> A thin AppKit and <code>WKWebView</code> wrapper with a native menu bar, a status bar menu and its own copy of the local server, plus menu shortcuts like <code>⇧⌘R</code> to sync now and <code>⇧⌘D</code> to flip the theme.</li>
</ul>
<h2>Under the hood</h2>
<p>A TypeScript monorepo on pnpm workspaces and Turborepo, with three apps and a handful of packages:</p>
<pre><code class="language-text">tempo/
├── apps/
│   ├── api/                    Hono REST API and static server (port 4000)
│   ├── web/                    React 18 web app (port 5175)
│   └── macos/                  Tempo.app wrapper in Swift, and its build script
├── packages/
│   ├── config/                 shared strict tsconfigs
│   ├── database/               Drizzle schema, migrations, seed and the PGlite fallback
│   ├── shared/                 types, Zod schemas, smart scheduler, Trello import
│   ├── ui/                     TempoLogo, Kbd and the cn helper
│   └── integrations/
│       ├── google-calendar/    OAuth PKCE, token encryption, incremental calendar sync
│       └── google-tasks/       Google Tasks import, two-way sync, conflict resolution
└── tests/
    ├── unit/                   Vitest suite (scenarios A–G)
    └── e2e/                    Playwright suite
</code></pre>
<table><thead><tr><th>Layer</th><th>Choice</th></tr></thead><tbody><tr><td>Web app</td><td>Vite and React 18, Tailwind CSS, FullCalendar 6, <code>@dnd-kit</code>, TanStack Query and a Zustand store</td></tr><tr><td>API</td><td>One Hono 4 app that serves the REST routes and the built web app</td></tr><tr><td>Data</td><td>Drizzle ORM over 19 tables, PostgreSQL 16 or PGlite</td></tr><tr><td>Shared rules</td><td>Types, Zod schemas, the smart scheduler and the Trello parser in <code>packages/shared</code></td></tr><tr><td>Mac app</td><td>Swift, AppKit and <code>WKWebView</code>, macOS 13 or later</td></tr></tbody></table>
<p>Requests flow from the web app (or Tempo.app, which just loads it) to <code>/api</code> on the Hono app, which talks to Postgres and to the Google sync packages. Every request resolves to the single local user.</p>
<p>The tests are my favorite kind: scenario-shaped. The Vitest suite runs the API against an in-memory PGlite database and covers PKCE and AES-256-GCM, the smart scheduler, the Trello parser, and scenarios A to G: scheduling a task without duplicating it, rescheduling, Calendar sync and remote moves, completing a task, Tasks conflicts, the offline retry path and saved preferences. The Playwright suite starts both servers, drags a task onto Thursday 14:00 in a real browser and checks that it survives a reload.</p>
<p>Building from source is short, once you have access:</p>
<pre><code class="language-sh">cp .env.example .env              # copy the settings template
set -a; source .env; set +a       # export it: nothing loads .env automatically
docker compose up -d              # optional: PostgreSQL 16 on port 54329
pnpm install                      # install the workspace
pnpm db:migrate                   # apply the Drizzle migrations
pnpm db:seed                      # load the demo workspace
pnpm dev                          # API on :4000, web app on :5175
</code></pre>
<p>On privacy: Tempo is local and single-user. Tasks, sessions and preferences live in your own PostgreSQL or PGlite database, there are no accounts, and there&#x27;s no telemetry, tracking or crash reporting. Without Google credentials nothing leaves your machine for sync; with them, the API only talks to Google to sign in, refresh tokens and read your name and email from <code>userinfo</code>. One request goes out either way: the web app loads Inter from Google Fonts.</p>
<h2>What&#x27;s not there yet</h2>
<p>Tempo is in development, and its README is upfront about the edges:</p>
<ul>
<li><strong>Calendar and Tasks calls are simulated.</strong> The next step is calling the real Google Calendar v3 and Google Tasks v1 APIs when live credentials are set, and keeping the wire stores for tests.</li>
<li><strong>One user, no sign-in.</strong> Every browser session maps to the same default user, so it shouldn&#x27;t be exposed beyond <code>localhost</code>. Sign-in and per-user data are on the roadmap.</li>
<li><strong><code>.env</code> isn&#x27;t loaded for you.</strong> You export it yourself for now. Loading it automatically, and aligning <code>WEB_URL</code> in <code>.env.example</code> with the dev server port, are next.</li>
<li><strong>Tempo.app needs the checkout.</strong> It starts the server from the repo path written at build time, needs <code>pnpm</code> and Node on the <code>PATH</code>, and is ad-hoc signed, not notarized. A standalone app that bundles the server is planned.</li>
<li><strong>Power User has no single-key shortcut.</strong> Use the top bar, the command palette or <code>⌘4</code> in Tempo.app, until it gets one.</li>
</ul>
<p>Tasks. Time. Tempo.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/tempo/icon.webp" alt="Tempo app icon: white task cards sliding onto colored calendar blocks on a blue-to-violet tile"/></p>
<p>Tempo has its own card on the <a href="https://www.0x1ad2.dev/projects?project=tempo">projects page</a>, with the demo loop, the explainer and the stack at a glance.</p>
<blockquote>
<p>Curious about the source? It&#x27;s private, but access can be granted to anyone interested in contributing. <a href="https://www.0x1ad2.dev/contact">Get in touch</a>.</p>
</blockquote>]]></content:encoded>
    </item>
    <item>
      <title>📸 fetch-screenshots: every page, light and dark, in one command</title>
      <link>https://www.0x1ad2.dev/blog/fetch-screenshots</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/fetch-screenshots</guid>
      <pubDate>Wed, 25 Nov 2026 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>fetch-screenshots points a headless Chromium at a website, crawls its links and sitemaps, folds repeated detail pages into one, and saves numbered full-page PNGs in light and dark with a manifest. Run it before a release, after a redesign or for review.</description>
      <category>projects</category>
      <category>agent-tools</category>
      <category>python</category>
      <category>playwright</category>
      <category>cli</category>
      <content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/fetch-screenshots/hero.webp" alt="A contact sheet of one run against www.0x1ad2.dev: six pages captured in light mode on the top row and the same six in dark mode below, with an amber viewfinder and a mint tick on the dark blog page"/></p>
<p><em>Real output from a run against <a href="http://www.0x1ad2.dev">www.0x1ad2.dev</a>, with contact details blurred.</em></p>
<p>You know the ritual. A redesign is nearly done, someone asks &quot;did you check it in dark mode?&quot;, and you open every page, flip the theme, scroll to the bottom so the lazy images show up, take a screenshot, flip the theme back, and do it all again for the next page. Then you realize you forgot the 404 page. And the blog is a pile of posts that all use the same template, so which one do you even pick?</p>
<p>I got tired of that ritual, so I wrote a command that does it for me:</p>
<pre><code class="language-sh">fetch-screenshots shoot --url example.com
</code></pre>
<p>No config, no setup for a first run. It finds the pages, captures each one in every color scheme you ask for, and drops them in a folder with a <code>manifest.json</code> that says what it saw. Here&#x27;s the 31-second version, made with Montage, my shared Remotion studio:</p>
<p><a href="https://www.0x1ad2.dev/images/projects/fetch-screenshots/explainer.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/fetch-screenshots/explainer-poster.webp" alt="Watch the 31-second fetch-screenshots explainer"/></a></p>
<h2>It finds every page, so you don&#x27;t have to list them</h2>
<p>You give it a site. It starts from your <code>routes</code> (just <code>/</code> by default), then goes looking for the rest:</p>
<ul>
<li><strong>Links.</strong> Every link that stays on the same site joins the queue, up to 3 hops away and 100 pages in total by default. <code>www.example.com</code> and <code>example.com</code> count as the same site.</li>
<li><strong>Sitemaps.</strong> It reads the <code>Sitemap:</code> lines in <code>robots.txt</code> (or falls back to <code>/sitemap.xml</code>), follows sitemap indexes, and queues every page it finds there.</li>
<li><strong>Everything else stays out.</strong> Links to other hosts and to files such as <code>.pdf</code>, <code>.png</code> or <code>.js</code> are dropped.</li>
</ul>
<p>Not sure what it&#x27;ll pick up? Ask first. <code>--dry-run</code> crawls the site and lists the pages it would capture without saving a single PNG:</p>
<pre><code class="language-sh">fetch-screenshots shoot 0x1ad2 --dry-run
</code></pre>
<p>A real run, without the dry run, looks like this:</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/fetch-screenshots/screenshot-1.webp" alt="A terminal running fetch-screenshots shoot 0x1ad2: the sitemap line with 16 URLs, a light pass of six pages, a dark pass of the same six and saved 12 screenshots"/></p>
<p><em>A terminal mockup made with Montage that reproduces the CLI&#x27;s real print format.</em></p>
<p>One line per page: a tick, the route (with <code>-&gt;</code> and the final route after a redirect) and the file it saved. The light pass finds the pages, and the dark pass captures the same list again. If any page fails, the command exits with status 1, so it slots into a script without drama.</p>
<p><a href="https://www.0x1ad2.dev/images/projects/fetch-screenshots/demo.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/fetch-screenshots/demo-poster.webp" alt="One run, light pass then dark pass, streaming in line by line"/></a></p>
<h2>A pile of blog posts, one screenshot</h2>
<p>This is the part I&#x27;m proudest of. A site with a blog, a changelog or a list of runs has dozens of pages that are really the same page with different data. Screenshotting all of them is a waste of disk and of your attention.</p>
<p>So fetch-screenshots collapses them. <code>/runs/974</code>, <code>/runs/973</code> and the rest count as one detail type and get 1 screenshot. Numbers, commit SHAs, UUIDs and long IDs in a path are detected on their own, and anything matching a glob you list in <code>detail_patterns</code> (say <code>/blog/*</code>) counts too. When the sitemap has dates, the newest page is the one kept, and skipped detail pages don&#x27;t count toward <code>max_pages</code>.</p>
<p>Play with it. This is a small JavaScript sketch of the collapse rule and the file naming from the README, not the tool itself (that&#x27;s Python and lives in <code>shooter.py</code>). Edit the routes or the patterns and watch the run folder change:</p>
<pre><code class="language-html-live">&lt;style&gt;
  :root { color-scheme: dark; --amber: #ffb224; --violet: #8b7bff; --mint: #3ddc97; --dim: #8a8a99; }
  * { box-sizing: border-box; }
  body { margin: 0; padding: 16px; background: #0b0b10; color: #e8e8f0; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
  .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  @media (max-width: 560px) { .grid { grid-template-columns: 1fr; } }
  label { display: block; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 4px; }
  textarea, input { width: 100%; background: #14141c; color: inherit; border: 1px solid #2a2a36; border-radius: 8px; padding: 8px; font: inherit; }
  textarea { height: 188px; resize: vertical; }
  .row { display: flex; gap: 8px; margin-top: 8px; }
  .row &gt; div { flex: 1; }
  pre { margin: 0; background: #14141c; border: 1px solid #2a2a36; border-radius: 8px; padding: 8px; min-height: 248px; white-space: pre-wrap; }
  .ok { color: var(--mint); } .skip { color: var(--dim); text-decoration: line-through; }
  .pat { color: var(--amber); } .dark { color: var(--violet); } .sum { color: var(--amber); }
&lt;/style&gt;
&lt;div class=&quot;grid&quot;&gt;
  &lt;div&gt;
    &lt;label for=&quot;routes&quot;&gt;Queue, in crawl order&lt;/label&gt;
    &lt;textarea id=&quot;routes&quot;&gt;/
/experience
/blog
/blog/how-i-build-my-website
/blog/fingerprint-end-to-end-encryption
/blog/gdg-devfest-2017
/runs/974
/runs/973
/commits/3f9a2c1
/about&lt;/textarea&gt;
    &lt;div class=&quot;row&quot;&gt;
      &lt;div&gt;&lt;label for=&quot;pats&quot;&gt;detail_patterns&lt;/label&gt;&lt;input id=&quot;pats&quot; value=&quot;/blog/*&quot;&gt;&lt;/div&gt;
      &lt;div&gt;&lt;label for=&quot;per&quot;&gt;max_per_pattern&lt;/label&gt;&lt;input id=&quot;per&quot; type=&quot;number&quot; min=&quot;1&quot; value=&quot;1&quot;&gt;&lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;label&gt;Run folder&lt;/label&gt;
    &lt;pre id=&quot;out&quot;&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;script&gt;
  // The ID rule from shooter.py: numbers, UUIDs, hex SHAs of 7+ chars, long mixed IDs.
  const ID = /^(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|(?=[0-9a-f]*\d)[0-9a-f]{7,}|(?=\w*\d)(?=\w*[a-z])\w{16,})$/i;
  const glob = (p) =&gt; new RegExp(&quot;^&quot; + p.replace(/[.+^${}()|[\]\\]/g, &quot;\\$&amp;&quot;).replace(/\*/g, &quot;.*&quot;).replace(/\?/g, &quot;.&quot;) + &quot;$&quot;);
  const esc = (s) =&gt; s.replace(/[&amp;&lt;&gt;]/g, (c) =&gt; ({ &quot;&amp;&quot;: &quot;&amp;amp;&quot;, &quot;&lt;&quot;: &quot;&amp;lt;&quot;, &quot;&gt;&quot;: &quot;&amp;gt;&quot; })[c]);

  function detailPattern(route, patterns) {
    const path = route.split(&quot;?&quot;)[0];
    for (const p of patterns) if (glob(p).test(path)) return p;
    const segs = path.split(&quot;/&quot;);
    if (segs.some((s) =&gt; ID.test(s))) return segs.map((s) =&gt; (ID.test(s) ? &quot;:id&quot; : s)).join(&quot;/&quot;);
    return null;
  }
  const slug = (r) =&gt; r.replace(/^\/+|\/+$/g, &quot;&quot;).replace(/[^A-Za-z0-9._-]+/g, &quot;-&quot;).replace(/^-+|-+$/g, &quot;&quot;).slice(0, 120) || &quot;home&quot;;

  function run() {
    const routes = document.getElementById(&quot;routes&quot;).value.split(&quot;\n&quot;).map((s) =&gt; s.trim()).filter(Boolean);
    const patterns = document.getElementById(&quot;pats&quot;).value.split(&quot;,&quot;).map((s) =&gt; s.trim()).filter(Boolean);
    const per = Math.max(1, parseInt(document.getElementById(&quot;per&quot;).value, 10) || 1);
    const width = Math.max(2, String(100).length); // max_pages = 100, so 3 digits
    const seen = {}, files = [], lines = [];
    for (const route of routes) {
      const p = detailPattern(route, patterns);
      if (p &amp;&amp; (seen[p] || 0) &gt;= per) { lines.push(`&lt;span class=&quot;skip&quot;&gt;${esc(route)}&lt;/span&gt;  &lt;span class=&quot;pat&quot;&gt;${esc(p)}&lt;/span&gt; is full`); continue; }
      if (p) seen[p] = (seen[p] || 0) + 1;
      const file = `${String(files.length + 1).padStart(width, &quot;0&quot;)}-${slug(route)}.png`;
      files.push(file);
      lines.push(`&lt;span class=&quot;ok&quot;&gt;✓&lt;/span&gt; ${esc(route)}  light/${esc(file)}`);
    }
    files.forEach((f) =&gt; lines.push(`&lt;span class=&quot;ok&quot;&gt;✓&lt;/span&gt; &lt;span class=&quot;dark&quot;&gt;dark/${esc(f)}&lt;/span&gt;`));
    lines.push(`&lt;span class=&quot;sum&quot;&gt;saved ${files.length * 2} screenshots&lt;/span&gt;`);
    document.getElementById(&quot;out&quot;).innerHTML = lines.join(&quot;\n&quot;);
  }
  document.querySelectorAll(&quot;textarea, input&quot;).forEach((el) =&gt; el.addEventListener(&quot;input&quot;, run));
  run();
&lt;/script&gt;
</code></pre>
<p>Notice <code>/blog</code> itself survives (it doesn&#x27;t match <code>/blog/*</code>), <code>/runs/974</code> becomes the <code>/runs/:id</code> type, and <code>3f9a2c1</code> gets caught as a commit SHA without any pattern at all. In the real thing the queue order comes from your routes, then the sitemaps (dated pages newest first), then the links it finds, which is why the newest post is the one you keep.</p>
<h2>Light and dark, lined up</h2>
<p>Every page is captured once per color scheme you list: <code>light</code>, <code>dark</code> or <code>no-preference</code>. Each scheme gets its own folder with the same numbered file names, so <code>light/004-blog.png</code> and <code>dark/004-blog.png</code> are always the same page. Flip between the two folders and the differences jump out.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/fetch-screenshots/terminal-light.webp" alt="The same fetch-screenshots terminal run, this time in a light theme"/></p>
<p><em>The terminal mockup from above, in light mode.</em></p>
<p>Some sites ignore the system theme and keep their own setting in localStorage. For those, <code>local_storage</code> writes a value before every page loads, with <code>{scheme}</code> swapped for the scheme being captured:</p>
<pre><code class="language-toml">[sites.crow-control]
base_url = &quot;http://127.0.0.1:5190&quot;
color_schemes = [&quot;light&quot;, &quot;dark&quot;]
local_storage = { &quot;crow.control.preferences&quot; = &#x27;{&quot;theme&quot;:&quot;{scheme}&quot;}&#x27; }
</code></pre>
<p>The run folder looks like this, one timestamped folder per run:</p>
<pre><code class="language-text">results/
└── 0x1ad2/
    └── 2026-11-24_21-30-00/
        ├── light/
        │   ├── 001-home.png
        │   ├── 002-experience.png
        │   └── …
        ├── dark/
        │   └── … (the same files, in dark mode)
        └── manifest.json
</code></pre>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/fetch-screenshots/screenshot-2.webp" alt="A Finder window showing results/0x1ad2/ with a timestamped run folder that holds light and dark folders of numbered page screenshots and a manifest.json file"/></p>
<p><em>A Finder mockup made with Montage.</em></p>
<p>The contents of <code>results/</code> are in <code>.gitignore</code>, so screenshots never end up in a commit by accident. And the manifest lists every page visited, including the ones that redirected to a page it already had:</p>
<pre><code class="language-json">{
  &quot;site&quot;: &quot;0x1ad2&quot;,
  &quot;base_url&quot;: &quot;https://www.0x1ad2.dev&quot;,
  &quot;captured_at&quot;: &quot;2026-11-24T21:30:00&quot;,
  &quot;color_schemes&quot;: [&quot;light&quot;, &quot;dark&quot;],
  &quot;pages&quot;: [
    {
      &quot;route&quot;: &quot;/&quot;,
      &quot;url&quot;: &quot;https://www.0x1ad2.dev/&quot;,
      &quot;title&quot;: &quot;…&quot;,
      &quot;file&quot;: &quot;001-home.png&quot;,
      &quot;duplicate_of&quot;: null,
      &quot;error&quot;: null
    }
  ]
}
</code></pre>
<h2>Pages that fight back</h2>
<p>Not every page wants to be photographed.</p>
<p><strong>WebGL and scroll-driven pages.</strong> If a page draws into a fixed canvas, a full-page capture comes out blank. My own home page is one of them. With <code>capture = &quot;scroll&quot;</code> the tool shoots one screen at a time (up to 60 frames) and stitches them together with Pillow into one tall PNG under the usual file name.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/fetch-screenshots/scroll-stitch.webp" alt="On the left, capture full gives a blank WebGL canvas and is struck through. On the right, capture scroll shoots three screens of a dark home page and stitches them into dark/001-home.png"/></p>
<p><em>Full-page capture versus scroll and stitch, rendered with Montage from real captures.</em></p>
<pre><code class="language-toml">[sites.kite-interactive]
base_url = &quot;https://www.kite-interactive.online&quot;
capture = &quot;scroll&quot;
frame_ms = 1200
</code></pre>
<p><strong>Lazy-loaded images.</strong> <code>scroll = true</code> scrolls to the bottom and back before a full-page capture, so lazy images and scroll-in animations are actually on the page. CSS animations are switched off while it captures.</p>
<p><strong>Pages behind a login.</strong> Set a <code>storage_state</code> file for the site and run:</p>
<pre><code class="language-sh">fetch-screenshots login dashboard
</code></pre>
<p>A real browser window opens. You log in once, press Enter in the terminal, and later runs reuse that session until it expires. That file holds cookies and local storage, so treat it like a password; <code>.auth/</code> is in <code>.gitignore</code> for exactly that reason.</p>
<p><strong>Apps with a live event stream.</strong> Leave <code>wait_until</code> at <code>&quot;load&quot;</code> and raise <code>settle_ms</code>. The <code>&quot;networkidle&quot;</code> state never arrives on those, so every page would just sit there until it timed out. Ask me how I know.</p>
<p><strong>Everything is crisp.</strong> A 1440×900 window at device scale 2 gives PNGs 2,880 pixels wide. Both are settings, if you&#x27;d rather not fill your disk.</p>
<h2>Under the hood</h2>
<p>It&#x27;s Python 3.10+ with Playwright driving Chromium and Pillow doing the stitching, installed and run with uv, and it works on macOS, Linux and Windows. The core is three modules:</p>
<table><thead><tr><th>File</th><th>What it does</th></tr></thead><tbody><tr><td><code>cli.py</code></td><td>The <code>list</code>, <code>shoot</code> and <code>login</code> commands</td></tr><tr><td><code>config.py</code></td><td><code>sites.toml</code> lookup, the site settings and their validation</td></tr><tr><td><code>shooter.py</code></td><td>Crawl queue, sitemaps, detail collapse, capture and stitching</td></tr></tbody></table>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/fetch-screenshots/how-it-works.webp" alt="The pipeline in five steps: routes, discover links and sitemaps, collapse detail pages, dedupe redirects, then capture every theme and write the manifest"/></p>
<p>The pipeline, step by step:</p>
<ol>
<li><strong>Routes.</strong> Your <code>routes</code> are queued first, in order. That&#x27;s how you set the order of the screenshots and include pages nothing links to.</li>
<li><strong>Discover.</strong> Sitemap URLs join the queue after the routes (undated pages in sitemap order, then dated pages newest first), followed by the same-site links each page turns up.</li>
<li><strong>Collapse.</strong> Detail pages are capped at <code>max_per_pattern</code> each.</li>
<li><strong>Dedupe.</strong> A URL that redirects to a page it already captured is recorded as a duplicate, not saved again. Query strings are ignored unless <code>keep_query = true</code>.</li>
<li><strong>Capture.</strong> In the first color scheme each page is loaded, given <code>settle_ms</code> to settle, searched for links and captured. Every other scheme then gets a fresh browser context that captures the same list, without crawling again.</li>
</ol>
<p>Sites you capture often get a profile in <code>sites.toml</code>. Settings under <code>[defaults]</code> apply to every site, a site&#x27;s own settings win, and an unknown setting is an error rather than a silent typo. Here&#x27;s the profile I use for this site:</p>
<pre><code class="language-toml">[sites.0x1ad2]
base_url = &quot;https://www.0x1ad2.dev&quot;
color_schemes = [&quot;light&quot;, &quot;dark&quot;]
detail_patterns = [&quot;/blog/*&quot;]
scroll = true
</code></pre>
<p>The exit status tells your scripts what happened: 0 when every page was captured, 1 when any page failed, 2 for a config error and 130 when you press ⌃C.</p>
<p>The tests live in <code>tests/test_routes.py</code>: 12 test functions, two of them parametrized, covering URL normalization and the <code>www</code> rule, ID and glob detection of detail pages, file name slugs, site validation, sitemap indexes with newest-first ordering and frame stitching. The sitemap test uses a fake request object, so the suite needs no browser and no network.</p>
<pre><code class="language-sh">uv run --with pytest pytest
</code></pre>
<p>On privacy: it only loads the sites you name, plus their <code>robots.txt</code> and sitemaps, and the crawler never follows a link to another host. (The browser does load whatever a page loads itself, such as fonts, scripts and analytics, as any visitor&#x27;s browser would.) Screenshots and the manifest are written to your disk and nowhere else. There&#x27;s no telemetry and no account. One thing to keep in mind: it reads only the <code>Sitemap:</code> lines of <code>robots.txt</code>, not the <code>Disallow</code> rules, so point it only at sites you&#x27;re allowed to capture.</p>
<h2>What&#x27;s not there yet</h2>
<p>It&#x27;s in development (the README says 1.0.0, but there&#x27;s no tagged release yet), and the roadmap is honest about the gaps:</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" disabled=""/> A <code>--version</code> flag that prints the installed version.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Compare two runs of the same site and flag the pages that changed. There&#x27;s no diffing today.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Capture pages in parallel tabs to shorten long runs.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Firefox and WebKit as alternatives to Chromium.</li>
</ul>
<p>There are also no end-to-end tests that launch Chromium yet; the unit tests stop at the browser&#x27;s edge.</p>
<h2>Getting access</h2>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/fetch-screenshots/icon.webp" alt="The fetch-screenshots icon: an amber viewfinder around three stacked page cards"/></p>
<p>The source is private, so you build it from source once you have access. With Python 3.10 or later, <a href="https://docs.astral.sh/uv/">uv</a> and Playwright&#x27;s Chromium, it&#x27;s four commands:</p>
<pre><code class="language-sh">git clone https://github.com/0x1ad2/fetch-screenshots &amp;&amp; cd fetch-screenshots
uv tool install --editable . --with-executables-from playwright
playwright install chromium
fetch-screenshots shoot --url example.com
</code></pre>
<p>The install is editable, so changes to <code>sites.toml</code> and the source apply on the next run.</p>
<p>It sits next to the other things I&#x27;ve built on the <a href="https://www.0x1ad2.dev/projects?project=fetch-screenshots">projects page</a>.</p>
<blockquote>
<p>Curious about the source? It&#x27;s private, but access can be granted to anyone interested in contributing. <a href="https://www.0x1ad2.dev/contact">Get in touch</a>.</p>
</blockquote>]]></content:encoded>
    </item>
    <item>
      <title>🃏 Card Ledger: what did I actually spend on cards?</title>
      <link>https://www.0x1ad2.dev/blog/card-ledger</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/card-ledger</guid>
      <pubDate>Wed, 25 Nov 2026 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>Card Ledger turns a spreadsheet of trading card purchases into one private page: spend KPIs, a monthly chart, a per-vendor breakdown and searchable order and line-item grids. Unknown prices stay unknown, and unverified entries are flagged instead of guessed.</description>
      <category>projects</category>
      <category>web-apps</category>
      <category>react</category>
      <category>echarts</category>
      <category>ag-grid</category>
      <category>vite</category>
      <content:encoded><![CDATA[<p>Every Magic player has a question they&#x27;d rather not answer out loud. Mine sat in a Google Sheet with a tab per vendor, a Line Items tab and a Summary Overview, and it was thorough but no fun to read. So I gave it a front end. It&#x27;s one page, it has no backend, and it&#x27;s careful to say when it doesn&#x27;t know something.</p>
<p><a href="https://www.0x1ad2.dev/images/projects/card-ledger/explainer.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/card-ledger/explainer-poster.webp" alt="Watch the 31-second Card Ledger explainer"/></a></p>
<p><em>Brand graphics and React mockups rebuilt in Montage, filled with a synthetic demo ledger. No real orders, amounts or names appear anywhere in this post.</em></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/card-ledger/screenshot-1.webp" alt="The Card Ledger purchase overview with four KPI cards, a monthly Spend over time bar chart, the By vendor list with five colored tracks and the collapsed Review notes panel"/></p>
<h2>Spend over time, by vendor, under one filter</h2>
<p>Four KPIs sit at the top of the page: <strong>Purchase spend</strong>, <strong>Orders</strong>, <strong>Sales revenue</strong> and <strong>Net spend</strong>. Below them, an Apache ECharts bar chart draws one bar per month in brand violet <code>#6854d9</code>, with an axis tooltip in euros and a <code>ResizeObserver</code> that keeps it the size of its card. Next to it, <strong>By vendor</strong> lists the five vendors in their own colors, each with its spend and a track showing its share of the filtered total.</p>
<p>One vendor select drives all of it. Pick a vendor and the KPIs, the chart, the vendor list and both grids narrow to that vendor. The chart re-lays its months and axis for that vendor&#x27;s orders.</p>
<p><a href="https://www.0x1ad2.dev/images/projects/card-ledger/demo.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/card-ledger/demo-poster.webp" alt="Cycling through the five vendors while the KPIs, the monthly bars and the vendor tracks re-animate on each pick"/></a></p>
<p><em>Cycling through the five vendors, with synthetic data (8 seconds). Mockup rebuilt from source with Montage.</em></p>
<p>Then there&#x27;s the toggle I&#x27;m fondest of: <strong>Exclude unverified legacy entries</strong>. Any order or line item whose ID starts with <code>BOM-</code> is an old Bazaar of Magic entry that was never checked against an order email. They&#x27;re in by default. Tick the box and every number on the page recalculates without them.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/card-ledger/legacy-toggle.gif" alt="The cursor ticks Exclude unverified legacy entries, the legacy share of the bars drops out and the order count falls, then the box is unticked and the bars grow back"/></p>
<p><em>The hatched gray share and the amber chip are there to explain the GIF. The app just recalculates.</em></p>
<p>The filtering is plain React state. Every render filters the orders, then sums what&#x27;s left for the KPIs, the vendor tracks and the monthly chart. Here it is in miniature, with made-up orders and a CSS bar chart standing in for ECharts. Edit the list and see what happens:</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; padding: 16px; font: 14px/1.4 system-ui, sans-serif; background: #f6f5fb; color: #1d1b2a; }
  .bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
  select { font: inherit; padding: 4px 6px; }
  .kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
  .kpi { background: #fff; border-radius: 10px; padding: 10px 12px; box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
  .kpi span { color: #6b6880; font-size: 12px; }
  .kpi b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
  .chart { display: flex; align-items: flex-end; gap: 8px; height: 120px; background: #fff; border-radius: 10px; padding: 12px 12px 26px; }
  .col { flex: 1; min-height: 2px; background: #6854d9; border-radius: 4px 4px 0 0; position: relative; transition: height .3s; }
  .col i { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font: 11px system-ui; color: #6b6880; }
&lt;/style&gt;
&lt;div class=&quot;bar&quot;&gt;
  &lt;select id=&quot;vendor&quot;&gt;&lt;/select&gt;
  &lt;label&gt;&lt;input type=&quot;checkbox&quot; id=&quot;legacy&quot;&gt; Exclude unverified legacy entries&lt;/label&gt;
&lt;/div&gt;
&lt;div class=&quot;kpis&quot;&gt;
  &lt;div class=&quot;kpi&quot;&gt;&lt;span&gt;Purchase spend&lt;/span&gt;&lt;b id=&quot;spend&quot;&gt;&lt;/b&gt;&lt;/div&gt;
  &lt;div class=&quot;kpi&quot;&gt;&lt;span&gt;Orders&lt;/span&gt;&lt;b id=&quot;orders&quot;&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;chart&quot; id=&quot;chart&quot;&gt;&lt;/div&gt;
&lt;script&gt;
  // Made-up orders. The real ledger stays in its private repo.
  const orders = [
    { id: &quot;BOM-0001&quot;, vendor: &quot;Bazaar of Magic&quot;, month: &quot;2025-12&quot;, amount: 64 },
    { id: &quot;BOM-0002&quot;, vendor: &quot;Bazaar of Magic&quot;, month: &quot;2026-01&quot;, amount: 38.5 },
    { id: &quot;BAZ-1001&quot;, vendor: &quot;Bazaar of Magic&quot;, month: &quot;2026-02&quot;, amount: 21.9 },
    { id: &quot;SL-2001&quot;, vendor: &quot;Secret Lair&quot;, month: &quot;2025-12&quot;, amount: 29.99 },
    { id: &quot;SL-2002&quot;, vendor: &quot;Secret Lair&quot;, month: &quot;2026-03&quot;, amount: 59.98 },
    { id: &quot;CT-3001&quot;, vendor: &quot;CardTrader&quot;, month: &quot;2026-01&quot;, amount: 17.4 },
    { id: &quot;CT-3002&quot;, vendor: &quot;CardTrader&quot;, month: &quot;2026-02&quot;, amount: 46.25 },
    { id: &quot;CT-3003&quot;, vendor: &quot;CardTrader&quot;, month: &quot;2026-03&quot;, amount: 12.8 },
    { id: &quot;EV-4001&quot;, vendor: &quot;Magic Con &amp; Events&quot;, month: &quot;2026-02&quot;, amount: 75 },
    { id: &quot;PO-5001&quot;, vendor: &quot;Private &amp; Other&quot;, month: &quot;2026-01&quot;, amount: 20 },
  ];
  const vendors = [&quot;Bazaar of Magic&quot;, &quot;Secret Lair&quot;, &quot;CardTrader&quot;, &quot;Magic Con &amp; Events&quot;, &quot;Private &amp; Other&quot;];
  const names = [&quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot;, &quot;May&quot;, &quot;Jun&quot;, &quot;Jul&quot;, &quot;Aug&quot;, &quot;Sep&quot;, &quot;Oct&quot;, &quot;Nov&quot;, &quot;Dec&quot;];
  const eur = new Intl.NumberFormat(&quot;en-NL&quot;, { style: &quot;currency&quot;, currency: &quot;EUR&quot; });
  const $ = (id) =&gt; document.getElementById(id);
  $(&quot;vendor&quot;).innerHTML = [&quot;All vendors&quot;, ...vendors].map((v) =&gt; `&lt;option&gt;${v}&lt;/option&gt;`).join(&quot;&quot;);

  function render() {
    const vendor = $(&quot;vendor&quot;).value;
    const hideLegacy = $(&quot;legacy&quot;).checked;
    const rows = orders.filter((o) =&gt;
      (vendor === &quot;All vendors&quot; || o.vendor === vendor) &amp;&amp; !(hideLegacy &amp;&amp; o.id.startsWith(&quot;BOM-&quot;)));
    $(&quot;spend&quot;).textContent = eur.format(rows.reduce((sum, o) =&gt; sum + o.amount, 0));
    $(&quot;orders&quot;).textContent = rows.length;
    const byMonth = {};
    for (const o of rows) byMonth[o.month] = (byMonth[o.month] || 0) + o.amount;
    const max = Math.max(1, ...Object.values(byMonth));
    $(&quot;chart&quot;).innerHTML = Object.keys(byMonth).sort().map((m) =&gt;
      `&lt;div class=&quot;col&quot; style=&quot;height:${(byMonth[m] / max) * 100}%&quot; title=&quot;${m}: ${eur.format(byMonth[m])}&quot;&gt;&lt;i&gt;${names[+m.slice(5) - 1]}&lt;/i&gt;&lt;/div&gt;`
    ).join(&quot;&quot;) || &quot;&lt;p&gt;No orders left.&lt;/p&gt;&quot;;
  }
  $(&quot;vendor&quot;).onchange = $(&quot;legacy&quot;).onchange = render;
  render();
&lt;/script&gt;
</code></pre>
<p>One honest wrinkle: sales aren&#x27;t split by vendor, so with a single vendor selected <strong>Net spend</strong> still subtracts <em>all</em> recorded sales. For a small vendor it happily goes below zero. That&#x27;s a known limitation, not a bug.</p>
<h2>Two grids for the receipts</h2>
<p>Charts are nice. Receipts win arguments. Under the charts, an AG Grid Community view switches between <strong>Orders</strong> (7 columns) and <strong>Line items</strong> (6 columns), on the Quartz theme tinted violet. Every column sorts on click, filters from its menu and resizes by dragging its edge. A single field, <strong>Search orders, cards, vendors…</strong>, filters the current grid across all of its columns as you type, and pages hold 25, 50 or 100 rows.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/card-ledger/screenshot-2.webp" alt="The expanded Review notes panel above the Line items grid, filtered by the search term Collector and sorted by date, with an em dash in the Line total column for an unknown price"/></p>
<p><em>Searched for &quot;Collector&quot; and sorted by date, with synthetic data. Mockup rebuilt from source with Montage.</em></p>
<p>See that em dash in the <strong>Line total</strong> column? That&#x27;s the rule I care most about in this project.</p>
<h3>Unknown prices stay unknown</h3>
<p>Some order emails give only an order total, not a price per line. Spreading the total across the lines would look tidy and be made up. So Card Ledger doesn&#x27;t. A line total that isn&#x27;t a number is kept as <code>null</code> and shown as <code>—</code>. This is the actual mapping in <code>src/main.jsx</code>, reformatted for reading:</p>
<pre><code class="language-js">const money = (n) =&gt;
  new Intl.NumberFormat(&quot;en-NL&quot;, { style: &quot;currency&quot;, currency: &quot;EUR&quot; }).format(n)

// Spreadsheet dates are serial numbers: days since 1899-12-30.
const date = (n) =&gt;
  new Date(Date.UTC(1899, 11, 30) + n * 86400000).toISOString().slice(0, 10)

// In the Line Items mapping: no number, no price.
amount: typeof r[6] === &quot;number&quot; ? r[6] : null
</code></pre>
<p>Here&#x27;s the same idea with one made-up order. Give the last line a price, or set another one to <code>null</code>, and watch the note change its tune:</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; padding: 16px; font: 14px/1.4 system-ui, sans-serif; background: #f6f5fb; color: #1d1b2a; }
  table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; }
  th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #ecebf3; }
  th { font-size: 12px; color: #6b6880; font-weight: 600; }
  .num { text-align: right; font-variant-numeric: tabular-nums; }
  .note { margin: 12px 0 0; padding: 10px 12px; border-left: 3px solid #6854d9; background: #fff; border-radius: 0 8px 8px 0; }
&lt;/style&gt;
&lt;table&gt;
  &lt;thead&gt;&lt;tr&gt;&lt;th&gt;Qty&lt;/th&gt;&lt;th&gt;Product&lt;/th&gt;&lt;th class=&quot;num&quot;&gt;Line total&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
  &lt;tbody id=&quot;rows&quot;&gt;&lt;/tbody&gt;
&lt;/table&gt;
&lt;p class=&quot;note&quot; id=&quot;note&quot;&gt;&lt;/p&gt;
&lt;script&gt;
  // One made-up order whose email gave only an order total for the last line.
  const lines = [
    { quantity: 1, product: &quot;Collector booster&quot;, total: 24.95 },
    { quantity: 4, product: &quot;Sleeves, 100 count&quot;, total: 39.8 },
    { quantity: 2, product: &quot;Foil single&quot;, total: null },
  ];
  const eur = new Intl.NumberFormat(&quot;en-NL&quot;, { style: &quot;currency&quot;, currency: &quot;EUR&quot; });
  const show = (v) =&gt; (typeof v === &quot;number&quot; ? eur.format(v) : &quot;—&quot;);

  document.getElementById(&quot;rows&quot;).innerHTML = lines.map((l) =&gt;
    `&lt;tr&gt;&lt;td&gt;${l.quantity}&lt;/td&gt;&lt;td&gt;${l.product}&lt;/td&gt;&lt;td class=&quot;num&quot;&gt;${show(l.total)}&lt;/td&gt;&lt;/tr&gt;`).join(&quot;&quot;);

  const known = lines.filter((l) =&gt; typeof l.total === &quot;number&quot;);
  const sum = known.reduce((s, l) =&gt; s + l.total, 0);
  const unknown = lines.length - known.length;
  document.getElementById(&quot;note&quot;).textContent = unknown
    ? `${known.length} priced lines add up to ${eur.format(sum)}. ${unknown} line has no price, so that is not the order total, and nothing pretends it is.`
    : `Every line has a price, so ${eur.format(sum)} is the sum of the order.`;
&lt;/script&gt;
</code></pre>
<p>The same honesty runs through the rest of the page. <strong>Review notes</strong> is a collapsible panel that explains the unverified legacy entries, the two recorded subtotal discrepancies (two emails whose item sums come out above their stated totals) and how empty line prices come about. The ledger keeps the source figures with explicit reconciliation adjustments rather than quietly fixing them.</p>
<h2>A prompt instead of a sync</h2>
<p>Here&#x27;s the twist: Card Ledger never talks to Gmail or Google Sheets. Not once. It shows a snapshot, <code>src/data.json</code>, that Vite bundles in at build time. Nothing is fetched at runtime apart from the Inter font.</p>
<p>So how does it stay current? <strong>Generate update prompt</strong> opens a modal called <strong>Refresh your collection data</strong> with a ready-made prompt in a read-only text area. <strong>Copy update prompt</strong> puts it on the clipboard and flips to <strong>Copied ✓</strong>. You paste it into an assistant that has Gmail, Google Sheets and the project source (the modal names ChatGPT), and the assistant does the legwork.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/card-ledger/update-prompt.webp" alt="The Refresh your collection data modal over the dashboard, with the update prompt in a text area and the copy button reading Copied ✓"/></p>
<p><em>Mockup rebuilt from source with Montage, with synthetic data.</em></p>
<p>The prompt asks the assistant to:</p>
<ol>
<li>Search every page of the order-confirmation emails from Bazaar of Magic, Secret Lair and CardTrader, plus refunds, cancellations and shipment updates.</li>
<li>Read the live sheet first, reconcile by vendor and order ID, keep quantities, variants and original prices, count CardTrader merchandise and shipping once each, and keep unknown item prices <code>null</code>.</li>
<li>Leave the unverified legacy entries flagged and the two recorded discrepancies as they are.</li>
<li>Update the vendor tabs, <strong>Line Items</strong> and <strong>Summary Overview</strong>, then check rows, formulas, totals and duplicates and report what it couldn&#x27;t resolve.</li>
<li>Refresh <code>src/data.json</code> from all seven tabs, set the verification date, run <code>npm install</code> and <code>npm run build</code>, deploy the private Site and hand back the updated source as a ZIP.</li>
</ol>
<p>The whole loop, drawn the boring way:</p>
<pre><code class="language-text">Order emails (Gmail)
      │
      ▼
Google Sheet ──────────► src/data.json ──► src/main.jsx ──► Dashboard
vendor tabs, Line Items   snapshot, 7 tabs  orders, items    KPIs, ECharts, AG Grid
      ▲                                                          │
      │                                                   update prompt
      └──────────── Assistant with Gmail + Sheets ◄──────────────┘
</code></pre>
<p>One small detail I like: if the clipboard write fails, the button selects the text for you instead. Here&#x27;s that behavior with a shortened stand-in prompt (not the real one, which contains the sheet link). Sandboxed frames like this one can block the clipboard, so you may well get to see the fallback:</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; padding: 16px; font: 14px/1.4 system-ui, sans-serif; background: #f6f5fb; color: #1d1b2a; }
  .modal { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 8px 30px rgb(0 0 0 / .12); }
  h3 { margin: 0 0 10px; font-size: 16px; }
  textarea { width: 100%; box-sizing: border-box; font: 12px/1.5 ui-monospace, monospace; border: 1px solid #dcdae8; border-radius: 8px; padding: 8px; resize: none; }
  button { margin-top: 10px; font: inherit; color: #fff; background: #6854d9; border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; }
  small { display: block; margin-top: 8px; color: #6b6880; min-height: 1.4em; }
&lt;/style&gt;
&lt;div class=&quot;modal&quot;&gt;
  &lt;h3&gt;Refresh your collection data&lt;/h3&gt;
  &lt;textarea id=&quot;prompt&quot; rows=&quot;5&quot; readonly&gt;Stand-in prompt. Search the order-confirmation emails, read the live sheet first, reconcile by vendor and order ID, keep unknown item prices null, leave legacy entries flagged, then refresh src/data.json and rebuild.&lt;/textarea&gt;
  &lt;button id=&quot;copy&quot;&gt;Copy update prompt&lt;/button&gt;
  &lt;small id=&quot;hint&quot;&gt;&lt;/small&gt;
&lt;/div&gt;
&lt;script&gt;
  const button = document.getElementById(&quot;copy&quot;);
  const prompt = document.getElementById(&quot;prompt&quot;);
  const hint = document.getElementById(&quot;hint&quot;);
  button.onclick = async () =&gt; {
    try {
      await navigator.clipboard.writeText(prompt.value);
      button.textContent = &quot;Copied ✓&quot;;
      hint.textContent = &quot;&quot;;
    } catch {
      prompt.focus();
      prompt.select();
      hint.textContent = &quot;The clipboard said no, so the text is selected. Copy it yourself.&quot;;
    }
  };
&lt;/script&gt;
</code></pre>
<h2>Under the hood</h2>
<p>JavaScript · React 19 · Vite 7 · Apache ECharts 6 · AG Grid Community. That&#x27;s the list.</p>
<ul>
<li><strong>One file of app.</strong> <code>src/main.jsx</code> holds the whole app: data mapping, KPIs, chart, grid and update prompt. <code>src/style.css</code> has the layout, colors and two breakpoints: below 1000 px the charts stack, and below 650 px the sidebar folds into a top bar.</li>
<li><strong>The data.</strong> <code>src/data.json</code> is an array of sheet tabs read by position. Tabs 0 to 4 are the five vendors (the tab name <em>is</em> the vendor), tab 5 is Card Sales &amp; Income (not read by the UI yet) and tab 6 is Line Items. On load, the vendor tabs are flattened into one list of orders and <code>BOM-</code> IDs get flagged as legacy.</li>
<li><strong>The chart.</strong> <code>Chart</code> creates an ECharts instance on a <code>div</code>, groups the rows by <code>YYYY-MM</code> into monthly bars and disposes of the instance when the rows change or the component unmounts.</li>
<li><strong>The grid.</strong> <code>AgGridReact</code> registers <code>AllCommunityModule</code>, uses <code>themeQuartz</code> with the violet accent and Inter at 13 px, and gets its search straight from the <code>quickFilterText</code> prop.</li>
<li><strong>No config at all.</strong> There&#x27;s no <code>vite.config</code> and no environment variable, so <code>npm run build</code> produces plain static files that any static host can serve.</li>
</ul>
<p>The shape of one tab, with placeholder values:</p>
<pre><code class="language-json">[
  { &quot;name&quot;: &quot;CardTrader&quot;, &quot;values&quot;: [[&quot;&lt;order ID&gt;&quot;, 46000, &quot;&lt;purchase&gt;&quot;, &quot;&lt;category&gt;&quot;, 12.5, &quot;&lt;status&gt;&quot;]] }
]
</code></pre>
<p>And the whole developer workflow:</p>
<pre><code class="language-sh">npm install      # React, ECharts, AG Grid and Vite
npm run dev      # Vite dev server with the bundled snapshot
npm run build    # static files in dist/, the only build check there is
npm run preview  # serve dist/ locally
</code></pre>
<p>You need a current browser, npm and Node.js 22.12 or later.</p>
<h2>Privacy, because it&#x27;s my wallet</h2>
<p>The snapshot in the repo is real: <code>src/data.json</code> holds my actual purchase records, and the update prompt carries the sheet link and the hosting Site ID. All of it ends up in <code>dist/</code>, so anyone who can open the build can read it. That&#x27;s why the repo and the deployed Site are private. There&#x27;s no backend, no accounts and no analytics, and the app never signs in to Google. The clipboard is touched only when you click <strong>Copy update prompt</strong>. The one third-party request is the Inter font from Google Fonts.</p>
<p>Every image and video in this post is synthetic. None of them shows the real ledger.</p>
<h2>What&#x27;s not there yet</h2>
<p>Card Ledger is in development. The honest list:</p>
<ul>
<li><strong>It&#x27;s a snapshot, not live.</strong> New orders show up only after <code>src/data.json</code> is replaced and the app is rebuilt.</li>
<li><strong>Some text is hard-coded.</strong> The checked date, the <strong>Review notes</strong> copy, the figures quoted in the update prompt and the <strong>Sales revenue</strong> value are constants in <code>src/main.jsx</code>.</li>
<li><strong>Light theme only.</strong> The app has no dark mode yet. The pure-black variants in the README are designed, not real.</li>
<li><strong>No tests, no linter, no lockfile.</strong> A change is checked with <code>npm run build</code> and a look at the page. Each install resolves the <code>^</code> ranges fresh, and Vite warns that the single 2.4 MB JavaScript bundle is above its 500 kB chunk size hint.</li>
</ul>
<p>And the roadmap:</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" disabled=""/> Read <strong>Sales revenue</strong> from the Card Sales &amp; Income tab and split it by vendor.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Derive the checked date, the <strong>Review notes</strong> counts and the prompt&#x27;s figures from <code>src/data.json</code>.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Add a synthetic <code>src/data.demo.json</code> and a switch to load it, so the app can be shown and developed without personal data.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Commit a lockfile and run <code>npm run build</code> on every push.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> Show the parsed <code>category</code> field as a grid column and as a chart breakdown.</li>
</ul>
<p>So, what did I actually spend on cards? The dashboard knows. It&#x27;s private, and it&#x27;s staying that way.</p>
<p>Card Ledger has its own card on the <a href="https://www.0x1ad2.dev/projects?project=card-ledger">projects page</a>, with the demo loop, the explainer and the stack at a glance.</p>
<blockquote>
<p>Curious about the source? It&#x27;s private, but access can be granted to anyone interested in contributing. <a href="https://www.0x1ad2.dev/contact">Get in touch</a>.</p>
</blockquote>
<p><em>Unofficial. Not affiliated with or endorsed by Google, OpenAI, Wizards of the Coast or any of the vendors named here. Gmail and Google Sheets are trademarks of Google LLC. ChatGPT is a trademark of OpenAI. Magic: The Gathering and Secret Lair are trademarks of Wizards of the Coast LLC.</em></p>]]></content:encoded>
    </item>
    <item>
      <title>📽️ Montage: one Remotion studio for 16 READMEs</title>
      <link>https://www.0x1ad2.dev/blog/montage</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/montage</guid>
      <pubDate>Wed, 25 Nov 2026 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>Montage is the Remotion studio behind the icons, GIFs and explainers in every project README. One kit of device frames, motion blocks and seven templates gives all 16 projects the same rhythm and end card, and checks every render against the asset spec.</description>
      <category>projects</category>
      <category>agent-tools</category>
      <category>remotion</category>
      <category>typescript</category>
      <category>react</category>
      <category>ffmpeg</category>
      <content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/montage/icon.webp" alt="The Montage icon: a three by three sheet of project-colored tiles on a black rounded square, with a violet play frame in the center"/></p>
<p>Here&#x27;s the job. Fifteen project READMEs, and each one wants an app icon, a hero image, screenshots in light and dark, a couple of demo GIFs, a 30-second explainer video, a poster for that video and a social card. That&#x27;s a lot of files, and I know how it goes when you make them by hand: by the time you get to the last repo, the end cards don&#x27;t match, one GIF is too big for the page and one video is in a different font.</p>
<p>So I didn&#x27;t make them by hand. I wrote one studio that makes them all, from one config per project, and refuses to hand over a file that breaks the spec. It&#x27;s called Montage, and it&#x27;s also the 16th project in its own list: the icon above, the hero, the GIFs and the explainer below were all rendered by Montage, with the same templates every other project gets.</p>
<p><a href="https://www.0x1ad2.dev/images/projects/montage/explainer.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/montage/explainer-poster.webp" alt="Watch the Montage explainer (31.5 seconds, no audio)"/></a></p>
<p><em>Rendered with Montage itself. The Remotion Studio, terminal and editor windows in this post are Montage mockups built from real data: composition ids and sizes from the registry, terminal lines from a real render run, and the code from a real project&#x27;s brand config.</em></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/montage/hero.webp" alt="A contact sheet of the 15 projects Montage renders, five by three, each card on its own brand ground with the project&#x27;s icon and five palette swatches"/></p>
<h2>16 projects and 208 compositions, one folder each</h2>
<p>A project in Montage is a folder: <code>src/projects/&lt;slug&gt;/</code>, holding a brand config, an icon, its screens and its scenes. There&#x27;s no central list to edit. A build-time glob finds every folder, so a branch that adds one project never touches a file another project shares. That matters when 15 projects are each on their own <code>project/&lt;slug&gt;</code> branch at the same time.</p>
<p>Today that&#x27;s 16 projects (the 15 repos plus Montage) and the internal <code>_example</code> smoke test, for 208 compositions in total. Homey and Jot are the busiest with 17 each; Crow gets by on 8.</p>
<p>Everything starts with <code>brand.ts</code>. Here&#x27;s Montage&#x27;s own, which is deliberately boring, because a tool that renders everyone else&#x27;s media should keep its own look out of the way:</p>
<pre><code class="language-ts">export const brand: Brand = {
  slug: &quot;montage&quot;,
  repo: &quot;0x1ad2/montage&quot;,
  name: &quot;Montage&quot;,
  emoji: &quot;📽️&quot;,
  tagline: &quot;Remotion studio that renders icons, GIFs and explainer videos for every 0x1ad2 project from one config.&quot;,
  mode: &quot;dark&quot;,
  colors: {
    bg: &quot;#000000&quot;,
    surface: &quot;#0D0D10&quot;,
    surface2: &quot;#16161B&quot;,
    border: &quot;#26262E&quot;,
    text: &quot;#F4F4F6&quot;,
    muted: &quot;#8C8C99&quot;,
    accent: &quot;#8B6CFF&quot;,
    accent2: &quot;#C4B5FF&quot;,
    gradient: [&quot;#8B6CFF&quot;, &quot;#5B3FE0&quot;],
  },
  fonts: { display: spaceGrotesk(), body: inter(), mono: jetbrainsMono() },
  platforms: [&quot;Node 23.6+&quot;, &quot;macOS&quot;, &quot;Linux&quot;],
};
</code></pre>
<p>Name, repo, tagline, mode, palette, fonts and platform chips. Every template reads it, so the icon, the stills, the GIFs and the explainer all share the same colors and type without anyone copying a hex value twice.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/montage/brand-config.webp" alt="An editor on src/projects/halo/brand.ts with a color swatch before every hex value, beside a preview panel with the Halo icon, name, tagline, macOS 26+ chip and six palette colors"/></p>
<p>Here&#x27;s a small version you can try. The object at the bottom is a cut-down brand config, and three toy &quot;templates&quot; read it: an icon tile, a social card and a palette strip. Change the accent, rename the project or swap the tagline, and all three follow. It&#x27;s a sketch in plain DOM, not Remotion, but it&#x27;s the same deal: one object in, every output changes with it.</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; padding: 14px; background: #000; font: 13px/1.35 system-ui, sans-serif; }
  .row { display: flex; gap: 12px; align-items: stretch; max-width: 560px; margin: 0 auto; }
  .icon { flex: 0 0 96px; height: 96px; border-radius: 22px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 12px; box-sizing: border-box; position: relative; }
  .icon i { border-radius: 5px; }
  .icon b { position: absolute; inset: 36px; border: 3px solid; border-radius: 6px; }
  .social { flex: 1; aspect-ratio: 2 / 1; border-radius: 14px; padding: 14px 16px; box-sizing: border-box; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid; }
  .name { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
  .tag { font-size: 11.5px; margin-top: 4px; }
  .meta { display: flex; justify-content: space-between; align-items: center; font: 11px ui-monospace, monospace; }
  .chip { border: 1px solid; border-radius: 99px; padding: 1px 7px; margin-left: 4px; }
  .strip { display: flex; max-width: 560px; margin: 12px auto 0; border-radius: 10px; overflow: hidden; height: 42px; }
  .strip div { flex: 1; display: flex; align-items: flex-end; padding: 4px 6px; font: 10px ui-monospace, monospace; }
&lt;/style&gt;
&lt;div class=&quot;row&quot;&gt;&lt;div class=&quot;icon&quot; id=&quot;icon&quot;&gt;&lt;/div&gt;&lt;div class=&quot;social&quot; id=&quot;social&quot;&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class=&quot;strip&quot; id=&quot;strip&quot;&gt;&lt;/div&gt;
&lt;script&gt;
// Edit me: every &quot;template&quot; below reads this one object.
const brand = {
  name: &quot;Montage&quot;,
  repo: &quot;0x1ad2/montage&quot;,
  tagline: &quot;Remotion studio that renders icons, GIFs and explainer videos for every 0x1ad2 project from one config.&quot;,
  platforms: [&quot;Node 23.6+&quot;, &quot;macOS&quot;, &quot;Linux&quot;],
  colors: { bg: &quot;#000000&quot;, surface: &quot;#0D0D10&quot;, border: &quot;#26262E&quot;, text: &quot;#F4F4F6&quot;, muted: &quot;#8C8C99&quot;, accent: &quot;#8B6CFF&quot;, accent2: &quot;#C4B5FF&quot; },
};

const c = brand.colors;
const tiles = [c.accent, c.accent2, c.muted, c.border, c.accent, c.accent2, c.muted, c.border, c.accent];
const icon = document.getElementById(&quot;icon&quot;);
icon.style.background = c.surface;
icon.innerHTML = tiles.map((t) =&gt; `&lt;i style=&quot;background:${t}&quot;&gt;&lt;/i&gt;`).join(&quot;&quot;) + `&lt;b style=&quot;border-color:${c.accent};background:${c.bg}&quot;&gt;&lt;/b&gt;`;

const social = document.getElementById(&quot;social&quot;);
Object.assign(social.style, { background: `linear-gradient(135deg, ${c.surface}, ${c.bg})`, borderColor: c.border, color: c.text });
social.innerHTML = `
  &lt;div&gt;&lt;div class=&quot;name&quot;&gt;${brand.name}&lt;/div&gt;&lt;div class=&quot;tag&quot; style=&quot;color:${c.muted}&quot;&gt;${brand.tagline}&lt;/div&gt;&lt;/div&gt;
  &lt;div class=&quot;meta&quot;&gt;&lt;span style=&quot;color:${c.accent2}&quot;&gt;${brand.repo}&lt;/span&gt;
  &lt;span&gt;${brand.platforms.map((p) =&gt; `&lt;span class=&quot;chip&quot; style=&quot;border-color:${c.border};color:${c.muted}&quot;&gt;${p}&lt;/span&gt;`).join(&quot;&quot;)}&lt;/span&gt;&lt;/div&gt;`;

const swatches = [c.bg, c.surface, c.muted, c.accent, c.accent2];
document.getElementById(&quot;strip&quot;).innerHTML = swatches
  .map((s, i) =&gt; `&lt;div style=&quot;background:${s};color:${i &lt; 2 ? c.muted : c.bg}&quot;&gt;${s}&lt;/div&gt;`)
  .join(&quot;&quot;);
&lt;/script&gt;
</code></pre>
<p>From that one folder, seven templates do the rendering:</p>
<table><thead><tr><th>Template</th><th>What comes out</th></tr></thead><tbody><tr><td>Icon</td><td>1024 master, then a 512 PNG and an SVG</td></tr><tr><td>Hero</td><td>2400×1200</td></tr><tr><td>Screenshot</td><td>Light and dark twins</td></tr><tr><td>Demo GIF</td><td>960×540 at 15 fps</td></tr><tr><td>Explainer</td><td>1920×1080 at 30 fps</td></tr><tr><td>Poster</td><td>1600×900</td></tr><tr><td>Social card</td><td>1280×640</td></tr></tbody></table>
<p>The screens inside those templates sit in device and chrome frames: a macOS window with a menu bar, a menu bar popover, iPhone, iPad, Apple Watch, an Android phone, a browser and a terminal. They&#x27;re all pure CSS and SVG, so they stay sharp at 2x and 3x. On top of that sits a motion kit (icon tile, title card, tagline reveal, feature callouts, captions, an animated cursor with click ripples, a typewriter, a counter, glow backdrops, a logo sting and the standard end card) and exactly three transitions: crossfade, wipe and push. The standard allows those three and nothing else. No star wipes. Sorry.</p>
<p>Run <code>npm run studio</code> and Remotion Studio opens with a folder per project. Each composition is named <code>&lt;Template&gt;-&lt;slug&gt;[-item][-mode]</code>, with its output size beside the id, so you can find <code>Social-halo</code> without scrolling through everything else.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/montage/screenshot-1.webp" alt="Remotion Studio with a folder per project in the sidebar, the halo folder open on its nine compositions from Hero-halo to Social-halo, and the halo social card on the canvas"/></p>
<p>The same registry drives the GIFs. One pops every project icon in on its own brand color:</p>
<p><a href="https://www.0x1ad2.dev/images/projects/montage/demo.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/montage/demo-poster.webp" alt="The 15 project icons popping in one after another on their brand colors, with a strip of all icons below. Opens the 6-second loop"/></a></p>
<p>The other wipes in each project&#x27;s palette as five bars, hex values and all:</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/montage/palettes.webp" alt="Five palette bars per project wiping in with their hex values, under the project&#x27;s icon and name"/></p>
<h2>Every render gets checked, and one bad file fails the run</h2>
<p>This is the part I like most. When a render finishes, Montage doesn&#x27;t take its own word for it. <code>scripts/lib/checks.mjs</code> probes every file with ffprobe and compares it with <code>src/lib/spec.json</code>: pixel size, byte cap, fps, duration, codec, pixel format, <code>+faststart</code> and icon transparency. Any violation fails the command with a list of what went wrong. The same rules back <code>npm run check -- &lt;dir&gt;</code>, so you can point it at any folder of media, not just Montage&#x27;s own output.</p>
<p>The caps are decimal (1 MB is 1,000,000 bytes), and the templates read the same <code>spec.json</code> file as the checks, so the thing that draws a hero and the thing that judges it can&#x27;t disagree about how big a hero is:</p>
<table><thead><tr><th>File</th><th>Pixels</th><th>Cap</th></tr></thead><tbody><tr><td><code>icon.png</code></td><td>512×512, transparent</td><td>200 KB</td></tr><tr><td><code>hero.png</code></td><td>2400×1200</td><td>1.5 MB</td></tr><tr><td><code>demo-&lt;slug&gt;.gif</code></td><td>960×540 or 540×960, 15 fps, 4 to 8 s</td><td>5 MB</td></tr><tr><td><code>explainer.mp4</code></td><td>1920×1080, 30 fps, 60 s at most</td><td>10,000,000 bytes</td></tr><tr><td><code>explainer-poster.png</code></td><td>1600×900</td><td>600 KB</td></tr><tr><td><code>social.png</code></td><td>1280×640</td><td>1 MB</td></tr></tbody></table>
<p><code>npm run render</code> bundles once, renders every target the project declares, then runs the checks. This is the run that made Montage&#x27;s own icon, hero, GIFs and social card:</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/montage/screenshot-2.webp" alt="A terminal running npm run render -- montage --only icon,hero,gifs,social: five compositions rendered, six files checked with ok, and all files within the spec"/></p>
<p>Here&#x27;s a toy checker in the same spirit. The first seven rows are the real sizes of the media in Montage&#x27;s own <code>docs/assets/</code>. The last row is a render I made up to be bad. Delete it and the run goes green, or nudge a real file over its cap and watch it fail. (The real checker reads these numbers from ffprobe. This one trusts whatever you type, which is exactly why the real one doesn&#x27;t.)</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; padding: 14px; background: #000; color: #d4d4d8; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
  .ok { color: #7fd17f; } .bad { color: #ff7b72; } .dim { color: #71717a; } .sum { margin-top: 8px; }
&lt;/style&gt;
&lt;pre id=&quot;out&quot;&gt;&lt;/pre&gt;
&lt;script&gt;
const SPEC = {
  &quot;icon.png&quot;:             { size: [[512, 512]], cap: 200_000, alpha: true },
  &quot;hero.png&quot;:             { size: [[2400, 1200]], cap: 1_500_000 },
  &quot;explainer-poster.png&quot;: { size: [[1600, 900]], cap: 600_000 },
  &quot;social.png&quot;:           { size: [[1280, 640]], cap: 1_000_000 },
  gif:                    { size: [[960, 540], [540, 960]], fps: 15, min: 4, max: 8, cap: 5_000_000 },
  &quot;explainer.mp4&quot;:        { size: [[1920, 1080]], fps: 30, max: 60, cap: 10_000_000, codec: &quot;h264&quot;, pix: &quot;yuv420p&quot;, faststart: true },
};

const renders = [
  { file: &quot;icon.png&quot;, w: 512, h: 512, bytes: 64874, alpha: true },
  { file: &quot;hero.png&quot;, w: 2400, h: 1200, bytes: 926771 },
  { file: &quot;demo-icons.gif&quot;, w: 960, h: 540, fps: 15, seconds: 6, bytes: 2582622 },
  { file: &quot;demo-palettes.gif&quot;, w: 960, h: 540, fps: 15, seconds: 7.5, bytes: 631543 },
  { file: &quot;explainer.mp4&quot;, w: 1920, h: 1080, fps: 30, seconds: 31.5, bytes: 2391084, codec: &quot;h264&quot;, pix: &quot;yuv420p&quot;, faststart: true },
  { file: &quot;explainer-poster.png&quot;, w: 1600, h: 900, bytes: 478599 },
  { file: &quot;social.png&quot;, w: 1280, h: 640, bytes: 372195 },
  // A made-up bad render. Delete this line and the run passes.
  { file: &quot;demo-oops.gif&quot;, w: 1280, h: 720, fps: 12, seconds: 9, bytes: 6_200_000 },
];

const mb = (b) =&gt; (b / 1e6).toFixed(2) + &quot; MB&quot;;
function check(r) {
  const s = SPEC[r.file] || (r.file.endsWith(&quot;.gif&quot;) ? SPEC.gif : null);
  if (!s) return [&quot;no spec for this file name&quot;];
  const p = [];
  if (!s.size.some(([w, h]) =&gt; w === r.w &amp;&amp; h === r.h)) p.push(`${r.w}×${r.h}, expected ${s.size.map((x) =&gt; x.join(&quot;×&quot;)).join(&quot; or &quot;)}`);
  if (r.bytes &gt; s.cap) p.push(`${mb(r.bytes)} is over the ${mb(s.cap)} cap`);
  if (s.fps &amp;&amp; r.fps !== s.fps) p.push(`${r.fps} fps, expected ${s.fps}`);
  if (s.min &amp;&amp; r.seconds &lt; s.min) p.push(`${r.seconds} s is shorter than ${s.min} s`);
  if (s.max &amp;&amp; r.seconds &gt; s.max) p.push(`${r.seconds} s is longer than ${s.max} s`);
  if (s.codec &amp;&amp; r.codec !== s.codec) p.push(`codec ${r.codec}, expected ${s.codec}`);
  if (s.pix &amp;&amp; r.pix !== s.pix) p.push(`pixel format ${r.pix}, expected ${s.pix}`);
  if (s.faststart &amp;&amp; !r.faststart) p.push(&quot;missing +faststart&quot;);
  if (s.alpha &amp;&amp; !r.alpha) p.push(&quot;icon has no transparency&quot;);
  return p;
}

let failed = 0, html = &#x27;&lt;span class=&quot;dim&quot;&gt;$ npm run check -- docs/assets&lt;/span&gt;\n&#x27;;
for (const r of renders) {
  const p = check(r);
  if (p.length) { failed++; html += `&lt;span class=&quot;bad&quot;&gt;✗ ${r.file}&lt;/span&gt;\n` + p.map((x) =&gt; `&lt;span class=&quot;bad&quot;&gt;    ${x}&lt;/span&gt;`).join(&quot;\n&quot;) + &quot;\n&quot;; }
  else html += `&lt;span class=&quot;ok&quot;&gt;ok&lt;/span&gt; ${r.file.padEnd(22)}&lt;span class=&quot;dim&quot;&gt;${mb(r.bytes)}&lt;/span&gt;\n`;
}
html += failed
  ? `&lt;div class=&quot;sum bad&quot;&gt;${renders.length} files checked, ${failed} failed. exit 1&lt;/div&gt;`
  : `&lt;div class=&quot;sum ok&quot;&gt;${renders.length} files checked, all within the spec. exit 0&lt;/div&gt;`;
document.getElementById(&quot;out&quot;).innerHTML = html;
&lt;/script&gt;
</code></pre>
<p>There&#x27;s no unit test suite yet. The smoke test is <code>_example</code>: it uses every template, every frame family and every building block, and <code>render</code> exits 1 the moment any of its 11 files breaks the spec. The house rule before merging project branches: render one still per project (each <code>Social-&lt;slug&gt;</code>, say) to catch a missing synced file or a broken import early.</p>
<h2>GIFs under 5 MB, explainers under 10 MB</h2>
<p>Caps are easy to write down and annoying to hit, so Montage does the fitting itself.</p>
<p><strong>GIFs.</strong> Demo scenes render as PNG frames, and ffmpeg turns them into a GIF with a two-pass <code>palettegen</code>/<code>paletteuse</code>. If a GIF lands over the 5 MB cap, Montage steps the palette down and tries again, and only then. A GIF that already fits keeps its full palette.</p>
<p><strong>Explainers.</strong> H.264 at CRF 23 in yuv420p with <code>+faststart</code>, so the video starts playing before it has finished loading. If a cut runs over 10,000,000 bytes, Montage re-encodes it in two passes at a computed bitrate instead of giving up.</p>
<p><strong>PNGs.</strong> Recompressed losslessly with <code>oxipng -o 4</code> when it&#x27;s installed (ImageMagick at zlib level 9 otherwise). <code>pngquant --quality 80-95</code> only runs on a file that&#x27;s still over its cap.</p>
<p>Explainer length is worked out, not eyeballed. <code>src/lib/timeline.ts</code> lays the scenes out at 30 fps, and every transition overlaps two scenes, so the length is the sum of the scenes, plus the 2-second end card, minus one transition per scene. Here&#x27;s that sum with the seven scenes of Montage&#x27;s own explainer, which comes out at the 31.5 seconds you&#x27;ll find in its README. Make a scene longer, set one to <code>&quot;none&quot;</code>, or add a scene and see where you land against the 30-second target and the 60-second ceiling.</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; padding: 14px; background: #000; color: #e4e4e7; font: 12px/1.4 system-ui, sans-serif; }
  .track { position: relative; height: 34px; margin: 6px 0 10px; }
  .seg { position: absolute; top: 0; height: 34px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font: 10px ui-monospace, monospace; color: #000; overflow: hidden; white-space: nowrap; opacity: .92; }
  .lap { position: absolute; top: -4px; height: 42px; background: repeating-linear-gradient(45deg, #fff6, #fff6 3px, transparent 3px, transparent 6px); border-radius: 3px; }
  .total { font: 600 15px ui-monospace, monospace; }
  .ok { color: #7fd17f; } .warn { color: #f5c26b; } .bad { color: #ff7b72; } .dim { color: #8c8c99; }
&lt;/style&gt;
&lt;div class=&quot;total&quot; id=&quot;total&quot;&gt;&lt;/div&gt;
&lt;div class=&quot;track&quot; id=&quot;track&quot;&gt;&lt;/div&gt;
&lt;div class=&quot;dim&quot;&gt;Hatched bars are transitions: two scenes on screen at once.&lt;/div&gt;
&lt;script&gt;
const FPS = 30;
const TRANSITION_FRAMES = 15;   // what Montage&#x27;s own cut uses
const END_CARD_SECONDS = 2;

// Montage&#x27;s own explainer. Edit the seconds, add a scene, or set transition: &quot;none&quot;.
const scenes = [
  { id: &quot;cold-open&quot;, seconds: 3 },
  { id: &quot;config&quot;, seconds: 6 },
  { id: &quot;icon&quot;, seconds: 4.5 },
  { id: &quot;stills&quot;, seconds: 5 },
  { id: &quot;motion&quot;, seconds: 5 },
  { id: &quot;check&quot;, seconds: 4.5 },
  { id: &quot;family&quot;, seconds: 5 },
];

let cursor = 0;
const laid = scenes.map((s) =&gt; {
  const frames = Math.round(s.seconds * FPS);
  const t = s.transition === &quot;none&quot; ? 0 : Math.min(TRANSITION_FRAMES, Math.floor(frames / 2));
  const scene = { ...s, from: cursor, frames, t };
  cursor += frames - t;
  return scene;
});
const end = { id: &quot;end card&quot;, from: cursor, frames: END_CARD_SECONDS * FPS, t: 0 };
const total = cursor + end.frames;
const sec = total / FPS;

const hues = [&quot;#8B6CFF&quot;, &quot;#C4B5FF&quot;, &quot;#6CC4FF&quot;, &quot;#7fd17f&quot;, &quot;#f5c26b&quot;, &quot;#ff9f7b&quot;, &quot;#ff7bd1&quot;, &quot;#a1a1aa&quot;];
const pct = (f) =&gt; (f / total) * 100 + &quot;%&quot;;
document.getElementById(&quot;track&quot;).innerHTML = [...laid, end]
  .map((s, i) =&gt; `&lt;div class=&quot;seg&quot; style=&quot;left:${pct(s.from)};width:${pct(s.frames)};background:${hues[i % hues.length]}&quot;&gt;${s.id}&lt;/div&gt;`
    + (s.t ? `&lt;div class=&quot;lap&quot; style=&quot;left:${pct(s.from + s.frames - s.t)};width:${pct(s.t)}&quot;&gt;&lt;/div&gt;` : &quot;&quot;))
  .join(&quot;&quot;);

const cls = sec &gt; 60 ? &quot;bad&quot; : Math.abs(sec - 30) &lt;= 5 ? &quot;ok&quot; : &quot;warn&quot;;
const note = sec &gt; 60 ? &quot;over the 60 s ceiling: the check fails&quot; : Math.abs(sec - 30) &lt;= 5 ? &quot;close to the 30 s target&quot; : &quot;within 60 s, but far from the 30 s target&quot;;
document.getElementById(&quot;total&quot;).innerHTML = `${total} frames = &lt;span class=&quot;${cls}&quot;&gt;${sec.toFixed(1)} s&lt;/span&gt; &lt;span class=&quot;dim&quot;&gt;(${note})&lt;/span&gt;`;
&lt;/script&gt;
</code></pre>
<p>Across all 16 projects, the explainers land between 28.4 seconds (Tempo) and 33.5 seconds (Halo and Crow), all a few seconds either side of that 30-second target. Same rhythm, same end card, every time.</p>
<h2>Under the hood</h2>
<p>Montage is TypeScript on Remotion 4.0.542 and React 19.3.1, with TypeScript 5.9.3, all pinned exactly, and ffmpeg doing the encoding. It runs on macOS or Linux with Node 23.6 or later, because the scripts import <code>montage.config.ts</code> using Node&#x27;s built-in type stripping. ffprobe comes along with ffmpeg; oxipng, pngquant and ImageMagick are optional extras.</p>
<p>The pipeline, start to finish:</p>
<pre><code class="language-text">src/projects/*/index.tsx   brand, icon, screens, scenes
        │
gen-registry.mjs           generated registry
        │
Root.tsx                   one composition per output
        │
render.mjs                 stills, frames, H.264
        │
ffmpeg + optimizers        GIF palette, faststart, PNG
        │
checks.mjs                 spec caps, report
</code></pre>
<ul>
<li><strong>Discovery.</strong> <code>scripts/gen-registry.mjs</code> globs <code>src/projects/*/index.ts(x)</code> and writes a gitignored <code>src/generated/registry.ts</code>. It runs before every studio, render and still command.</li>
<li><strong>Compositions.</strong> <code>src/lib/outputs.ts</code> turns each project into compositions, each carrying its output file name and caps in its props.</li>
<li><strong>Rendering.</strong> <code>scripts/render.mjs</code> bundles once, renders stills with <code>renderStill</code>, renders demos as PNG frames for the GIF step and renders the explainer with <code>renderMedia</code>.</li>
<li><strong>Icon SVG.</strong> <code>icon.tsx</code> stays pure SVG, so esbuild bundles it and <code>renderToStaticMarkup</code> writes out <code>icon.svg</code>.</li>
<li><strong>Manifest rows.</strong> Each render writes a <code>report.json</code> and Markdown rows for the target repo&#x27;s <code>docs/assets/MANIFEST.md</code>, which says how every file was made.</li>
<li><strong>Fonts.</strong> Inter, JetBrains Mono and Space Grotesk, through <code>@remotion/google-fonts</code>. Apple&#x27;s SF fonts are never bundled; mockups ask the OS for its UI font instead.</li>
<li><strong>No tokens.</strong> Montage reads the sibling project clones next to it, never the GitHub API, so rendering doesn&#x27;t need a token.</li>
</ul>
<p>Day to day, adding a project goes like this:</p>
<pre><code class="language-sh">cp -R src/projects/_example src/projects/&lt;slug&gt;     # then follow docs/AUTHORING.md
npm run sync -- &lt;slug&gt;                               # pull the repo&#x27;s own icons and marks in
npm run studio                                       # preview everything
npm run still -- &lt;slug&gt; &lt;compositionId&gt; out.png      # iterate on one frame
npm run render -- &lt;slug&gt; --out ../&lt;repo&gt;/docs/assets # render, check, and commit in that repo&#x27;s PR
</code></pre>
<p><code>--only icon,gifs</code> renders just some targets, <code>--all</code> does every project, and <code>--list</code> prints every composition with its output file, size and frame count. The first render fetches Chrome Headless Shell into <code>node_modules/.remotion/</code>, and renders run two frames at a time.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/montage/social.png" alt="The Montage social card: icon, name, tagline and repo beside a crop of the hero"/></p>
<h2>What&#x27;s not there yet</h2>
<p>Montage is in development, and its README is upfront about the gaps:</p>
<ul>
<li><strong>Mockups, not captures.</strong> Product screens in Montage are React rebuilds of each app&#x27;s UI from its own tokens and component code. Each repo&#x27;s <code>MANIFEST.md</code> labels them as Montage renders, and so do the captions on this site.</li>
<li><strong>Not every local file is in git.</strong> Synced files and raw captures in <code>public/projects/&lt;slug&gt;/</code> are gitignored, and some projects (the KITE Interactive site captures, for one) use files that no <code>sources.json</code> lists yet. A fresh clone can&#x27;t render those until the files are copied in.</li>
<li><strong>No vertical explainer.</strong> The standard describes a 1080×1920 <code>ExplainerVertical</code>; it isn&#x27;t built.</li>
<li><strong>No <code>deliver</code> step.</strong> Renders go to <code>out/&lt;slug&gt;/</code> or <code>--out</code>, and updating a repo&#x27;s <code>MANIFEST.md</code> is still manual, helped by the generated <code>MANIFEST.rows.md</code>.</li>
<li><strong>Fonts need the network.</strong> Google Fonts are fetched at render time.</li>
<li><strong>No unit tests.</strong> The <code>_example</code> smoke test is the safety net for now.</li>
</ul>
<p>Next up: the vertical explainer and a <code>deliver</code> command that copies renders into a repo and updates its manifest, listing every raw capture so each project renders from a fresh clone, reproducing the older per-repo Remotion explainers so those can retire, and a unit test for <code>outputs.ts</code> and <code>timeline.ts</code>. Those are the two files where one wrong number changes every repo at once, so they&#x27;ve earned it.</p>
<p>Montage has its own card on the <a href="https://www.0x1ad2.dev/projects?project=montage">projects page</a>, with the demo loop, the explainer and the stack at a glance.</p>
<blockquote>
<p>Curious about the source? It&#x27;s private, but access can be granted to anyone interested in contributing. <a href="https://www.0x1ad2.dev/contact">Get in touch</a>.</p>
</blockquote>]]></content:encoded>
    </item>
    <item>
      <title>🪁 Building the KITE website as a scroll-driven WebGPU film</title>
      <link>https://www.0x1ad2.dev/blog/kite-website</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/kite-website</guid>
      <pubDate>Wed, 25 Nov 2026 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>The KITE Interactive website tells a technology consultancy's story as one continuous scroll through eight 3D chapters. It runs on three.js WebGPU with TSL shaders, falls back to WebGL2, and keeps a full text version for anyone who cannot or does not want to watch.</description>
      <category>projects</category>
      <category>sites</category>
      <category>threejs</category>
      <category>webgpu</category>
      <category>react</category>
      <category>typescript</category>
      <content:encoded><![CDATA[<p>Most company websites are a stack of sections you scroll past. I wanted <a href="https://www.kite-interactive.online">KITE&#x27;s</a> to be a single camera move instead: you start in front of a beige computer glowing in emerald fog, and every turn of the scroll wheel pushes you further into the story. Through the screen, onto an office floor, under a printed page, into a shredder, and out the other side to a golden emblem and a &quot;Hello&quot;. It&#x27;s a film you direct with your thumb.</p>
<p>This post walks through what that film is made of. Everything below comes from the repository&#x27;s README; where something isn&#x27;t finished, I say so.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/kite-website/hero.webp" alt="The beige KITE computer glowing in emerald fog next to the headline A Technology Consultancy, Built for Forward Momentum, with the Selected Work film strip on its CRT"/></p>
<p><a href="https://www.0x1ad2.dev/images/projects/kite-website/explainer.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/kite-website/explainer-poster.webp" alt="Watch the 31-second KITE Interactive explainer"/></a></p>
<p><em>Click the poster for the explainer: 31.5 seconds, no audio, made with Montage. Real captures of the public site.</em></p>
<h2>One scroll, eight chapters</h2>
<p>There are no routes on this site. It is a single page, and the whole thing is one continuous camera move. Wheel, touch, keyboard, the scrollbar and the header navigation all drive it, and Lenis smooths the native document scroll so it never fights the browser.</p>
<table><thead><tr><th>#</th><th>Chapter</th><th>What happens</th></tr></thead><tbody><tr><td>1</td><td>Hero</td><td>A KITE computer in emerald fog. Its CRT already shows a live feed of the next scene.</td></tr><tr><td>2</td><td>Selected Work</td><td>The camera dives into the screen. A curved film strip shows KITE&#x27;s capabilities.</td></tr><tr><td>3</td><td>About Us</td><td>The camera dives through the center frame onto an office floor.</td></tr><tr><td>4</td><td>Paper</td><td>A printed page curls down over the office, then scrolls like an editorial page, with a working consultation coupon.</td></tr><tr><td>5</td><td>Shredder</td><td>A 3D shredder cuts the page into falling strips.</td></tr><tr><td>6</td><td>One last trick</td><td>Gold emblems fly past, then a diamond-shaped wipe.</td></tr><tr><td>7</td><td>Golden KITE</td><td>The emblem&#x27;s bands separate and lock together in a flash.</td></tr><tr><td>8</td><td>Contact</td><td>&quot;Hello&quot; over 3D phones, then the contact page and footer.</td></tr></tbody></table>
<p>The header jumps between four anchors (<strong>Home</strong>, <strong>Selected Work</strong>, <strong>About Us</strong> and <strong>Contact</strong>), and each anchor is simply a position on the timeline.</p>
<p>The first scroll is my favorite moment. The CRT on the hero isn&#x27;t a picture of the next chapter; it&#x27;s a live render of it. So when the camera dives into the glass, you don&#x27;t cut to a new scene, you just keep going.</p>
<p><a href="https://www.0x1ad2.dev/images/projects/kite-website/demo.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/kite-website/demo-poster.webp" alt="The camera holds on the KITE computer, dives into its CRT and settles on the Selected Work film strip"/></a></p>
<p><em>The dive from the hero into Selected Work, 5.4 seconds. Click to play the loop.</em></p>
<p>Inside, eight capabilities ride a curved film strip. Use the arrows, the dots, drag or swipe, and open <strong>Explore</strong> for the details of each one. They are capabilities on purpose, not client case studies: the site makes no client claims it can&#x27;t back up.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/kite-website/screenshot-1.webp" alt="Selected Work with Technology Strategy in the center frame of a curved film strip, arrows at both edges and the Explore link under the title"/></p>
<h2>WebGPU with two fallbacks</h2>
<p>The renderer is three.js r186 <code>WebGPURenderer</code>. When a browser has no WebGPU adapter, it falls back to WebGL2 automatically. And when a browser has neither, the site doesn&#x27;t sit there waiting on a renderer that will never arrive: the semantic text version becomes the page.</p>
<p>That decision is made by a check in <code>src/engine/support.ts</code>, which runs once the lazy-loaded 3D chunk has arrived. Here it is in full, because it&#x27;s short:</p>
<pre><code class="language-ts">/**
 * Resolve whether the 3D story can run: a WebGPU adapter or a WebGL2 context.
 * Without either, three&#x27;s renderer cannot initialise, so the text page is shown.
 */
export async function graphicsSupported() {
  try {
    const gpu = (
      navigator as Navigator &amp; { gpu?: { requestAdapter(): Promise&lt;unknown&gt; } }
    ).gpu
    if (gpu &amp;&amp; (await gpu.requestAdapter())) return true
  } catch {
    // Fall through to the WebGL2 check.
  }
  try {
    const canvas = document.createElement(&#x27;canvas&#x27;)
    const gl = canvas.getContext(&#x27;webgl2&#x27;)
    gl?.getExtension(&#x27;WEBGL_lose_context&#x27;)?.loseContext()
    return !!gl
  } catch {
    return false
  }
}
</code></pre>
<p>The same ladder, running in your browser right now. Which rung do you land on?</p>
<pre><code class="language-html-live">&lt;style&gt;
  :root { color-scheme: dark; }
  body { margin: 0; padding: 16px; background: #000; color: #e8f5f1; font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
  .rung { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 8px; border: 1px solid #1c2624; border-radius: 8px; opacity: .45; transition: opacity .3s, border-color .3s; }
  .rung.hit { opacity: 1; border-color: #19c37d; }
  .dot { width: 8px; height: 8px; border-radius: 50%; background: #1c2624; flex: none; }
  .hit .dot { background: #19c37d; box-shadow: 0 0 10px #19c37d; }
  small { color: #8aa39d; }
&lt;/style&gt;
&lt;div class=&quot;rung&quot; id=&quot;webgpu&quot;&gt;&lt;span class=&quot;dot&quot;&gt;&lt;/span&gt;1. WebGPU adapter &lt;small id=&quot;webgpu-note&quot;&gt;checking…&lt;/small&gt;&lt;/div&gt;
&lt;div class=&quot;rung&quot; id=&quot;webgl2&quot;&gt;&lt;span class=&quot;dot&quot;&gt;&lt;/span&gt;2. WebGL2 context &lt;small id=&quot;webgl2-note&quot;&gt;&lt;/small&gt;&lt;/div&gt;
&lt;div class=&quot;rung&quot; id=&quot;text&quot;&gt;&lt;span class=&quot;dot&quot;&gt;&lt;/span&gt;3. Text version &lt;small id=&quot;text-note&quot;&gt;&lt;/small&gt;&lt;/div&gt;
&lt;script&gt;
  const note = (id, text) =&gt; { document.getElementById(id + &#x27;-note&#x27;).textContent = text; };
  const hit = (id, text) =&gt; { document.getElementById(id).classList.add(&#x27;hit&#x27;); note(id, text); };

  async function check() {
    try {
      if (navigator.gpu &amp;&amp; (await navigator.gpu.requestAdapter())) {
        return hit(&#x27;webgpu&#x27;, &#x27;adapter found: the film renders with WebGPU&#x27;);
      }
      note(&#x27;webgpu&#x27;, navigator.gpu ? &#x27;no adapter&#x27; : &#x27;not available&#x27;);
    } catch {
      note(&#x27;webgpu&#x27;, &#x27;request failed&#x27;);
    }
    try {
      const gl = document.createElement(&#x27;canvas&#x27;).getContext(&#x27;webgl2&#x27;);
      if (gl) {
        gl.getExtension(&#x27;WEBGL_lose_context&#x27;)?.loseContext();
        return hit(&#x27;webgl2&#x27;, &#x27;context created: three.js falls back to WebGL2&#x27;);
      }
      note(&#x27;webgl2&#x27;, &#x27;not available&#x27;);
    } catch {
      note(&#x27;webgl2&#x27;, &#x27;failed&#x27;);
    }
    hit(&#x27;text&#x27;, &#x27;neither: the semantic text version becomes the page&#x27;);
  }

  check();
&lt;/script&gt;
</code></pre>
<p>The 3D engine itself is a lazy chunk behind a loading veil, so the header and the text version arrive first.</p>
<h2>Headlines painted into textures</h2>
<p>This is the trick that makes the whole film hang together. The headlines and the printed paper page aren&#x27;t DOM text floating over the canvas. They&#x27;re laid out with Canvas 2D and uploaded as textures, so text curls, shreds and goes through post-processing like any other pixel.</p>
<p>There are off-the-shelf ways to put UI text into a three.js scene, and the README is blunt about them: <code>@pmndrs/uikit</code> and KTX2 textures weren&#x27;t needed. Text has to curl, shred and pass through post-processing, so it&#x27;s painted to textures, and every texture is either generated at runtime or a small WebP.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/kite-website/paper.webp" alt="The printed paper page curling down over the About Us office floor of cubicles"/></p>
<p><em>The paper page curling over the About Us office. Real capture of the public site.</em></p>
<p>The page curl is a vertex shader over subdivided paper tiles. When the page has scrolled past, the shredder rebuilds its last screen as strips and lets them fall.</p>
<p><a href="https://www.0x1ad2.dev/images/blog/kite-website/shred.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/kite-website/shred-poster.webp" alt="The paper page curls down over the office, then the shredder cuts the last screen of the page into falling strips"/></a></p>
<p><em>The page curl and the shredder, 6 seconds. Click to play.</em></p>
<p>Here&#x27;s the idea in miniature: a headline painted onto a 2D canvas, then cut into strips. On the real site the strips are TSL materials in a 3D scene, but the principle is the same. Once text is pixels, you can do anything to it.</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; background: #000; color: #e8f5f1; font: 13px system-ui, sans-serif; }
  .stage { position: relative; height: 240px; overflow: hidden; }
  canvas { position: absolute; top: 18px; display: block; }
  .bar { display: flex; gap: 8px; padding: 10px 16px; border-top: 1px solid #161616; }
  button { background: #0b3b36; color: #e8fff8; border: 1px solid #19c37d; border-radius: 6px; padding: 6px 12px; font: inherit; cursor: pointer; }
&lt;/style&gt;
&lt;div class=&quot;stage&quot; id=&quot;stage&quot;&gt;&lt;/div&gt;
&lt;div class=&quot;bar&quot;&gt;&lt;button id=&quot;shred&quot;&gt;Shred it&lt;/button&gt;&lt;button id=&quot;reset&quot;&gt;Print a new page&lt;/button&gt;&lt;/div&gt;
&lt;script&gt;
  const stage = document.getElementById(&#x27;stage&#x27;);
  const reduced = matchMedia(&#x27;(prefers-reduced-motion: reduce)&#x27;).matches;
  const STRIPS = 14;
  let page, strips = [], raf = 0;

  function paint() {
    cancelAnimationFrame(raf);
    stage.replaceChildren();
    const w = Math.min(440, innerWidth - 32), h = Math.round(w * 0.45);
    const s = w / 440;
    page = document.createElement(&#x27;canvas&#x27;);
    page.width = w; page.height = h;
    page.style.left = (innerWidth - w) / 2 + &#x27;px&#x27;;
    const ctx = page.getContext(&#x27;2d&#x27;);
    ctx.fillStyle = &#x27;#f1efe6&#x27;; ctx.fillRect(0, 0, w, h);
    ctx.fillStyle = &#x27;#1d2b28&#x27;;
    ctx.font = `600 ${Math.round(28 * s)}px system-ui, sans-serif`;
    [&#x27;Making Technology Clearer,&#x27;, &#x27;More Structured, and&#x27;, &#x27;Built to Last&#x27;].forEach((line, i) =&gt; ctx.fillText(line, 22 * s, (52 + i * 38) * s));
    ctx.fillStyle = &#x27;#19c37d&#x27;; ctx.fillRect(22 * s, h - 22 * s, 56 * s, 4 * s);
    stage.append(page);
  }

  function shred() {
    if (!page || strips.length) return;
    const sw = page.width / STRIPS, left = parseFloat(page.style.left);
    strips = Array.from({ length: STRIPS }, (_, i) =&gt; {
      const c = document.createElement(&#x27;canvas&#x27;);
      c.width = Math.ceil(sw); c.height = page.height;
      c.getContext(&#x27;2d&#x27;).drawImage(page, i * sw, 0, sw, page.height, 0, 0, sw, page.height);
      c.style.left = left + i * sw + &#x27;px&#x27;;
      stage.append(c);
      return { c, y: 0, v: 0, delay: Math.random() * 0.35, spin: (i % 2 ? 1 : -1) * (2 + Math.random() * 6) };
    });
    page.remove();
    if (reduced) { strips.forEach(({ c }) =&gt; { c.style.transition = &#x27;opacity .6s&#x27;; c.style.opacity = &#x27;0&#x27;; }); return; }
    const start = performance.now();
    const tick = (now) =&gt; {
      const t = (now - start) / 1000;
      for (const s of strips) {
        if (t &lt; s.delay) continue;
        s.v += 0.6; s.y += s.v;
        s.c.style.transform = `translateY(${s.y}px) rotate(${s.spin * Math.min(1, (t - s.delay) * 2)}deg)`;
      }
      if (strips.some((s) =&gt; s.y &lt; 400)) raf = requestAnimationFrame(tick);
    };
    raf = requestAnimationFrame(tick);
  }

  document.getElementById(&#x27;shred&#x27;).onclick = shred;
  document.getElementById(&#x27;reset&#x27;).onclick = () =&gt; { strips = []; paint(); };
  paint();
&lt;/script&gt;
</code></pre>
<p>The same painted layouts also supply the hotspot rectangles (<code>src/engine/canvas2d.ts</code>, plus the layouts in <code>src/chapters/paperLayout.ts</code> and <code>finaleLayout.ts</code>). That&#x27;s how the real DOM buttons line up exactly with the painted ones, which matters a lot in the next section.</p>
<h3>The post pass</h3>
<p>Every frame ends in one shared post pass (<code>src/engine/post.ts</code>): CRT curvature and bezel, chromatic fringing, bloom, grain, vignette and white flashes. Because the text is in the texture, it gets the full treatment too.</p>
<p>CSS can only fake most of this (real curvature bends the image in a shader), but toggling a rough version on and off shows how much character those layers add. The grain is re-seeded every frame, just like on the live site.</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { margin: 0; padding: 20px 16px; background: #000; color: #e8f5f1; font: 13px system-ui, sans-serif; display: grid; justify-items: center; gap: 14px; }
  .crt { position: relative; width: min(400px, 100%); aspect-ratio: 4 / 3; overflow: hidden; border-radius: 26px / 20px; background: radial-gradient(ellipse at center, #0f4a43, #05201c 75%); box-shadow: 0 0 0 10px #c9c2ad, 0 0 0 12px #8f8873; }
  .feed { position: absolute; inset: 0; display: grid; place-items: center; padding: 0 24px; text-align: center; font-weight: 700; font-size: clamp(18px, 6vw, 28px); line-height: 1.15; color: #d8fff4; }
  .on .feed { text-shadow: -1.5px 0 rgb(255 60 90 / .7), 1.5px 0 rgb(60 200 255 / .7), 0 0 16px rgb(25 195 125 / .9); }
  .layer { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .25s; }
  .on .layer { opacity: 1; }
  .scan { background: repeating-linear-gradient(to bottom, rgb(0 0 0 / .3) 0 1px, transparent 1px 3px); }
  .vignette { background: radial-gradient(ellipse at center, transparent 50%, rgb(0 0 0 / .8) 100%); box-shadow: inset 0 0 40px rgb(0 0 0 / .9); }
  canvas.layer { width: 100%; height: 100%; mix-blend-mode: overlay; image-rendering: pixelated; }
  .flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
  .flash.go { animation: flash .45s ease-out; }
  @keyframes flash { from { opacity: .95; } to { opacity: 0; } }
  .bar { display: flex; gap: 12px; align-items: center; }
  button { background: #0b3b36; color: #e8fff8; border: 1px solid #19c37d; border-radius: 6px; padding: 6px 12px; font: inherit; cursor: pointer; }
&lt;/style&gt;
&lt;div class=&quot;crt on&quot; id=&quot;crt&quot;&gt;
  &lt;div class=&quot;feed&quot;&gt;Solutions That&lt;br&gt;Move Forward&lt;/div&gt;
  &lt;canvas class=&quot;layer&quot; id=&quot;grain&quot; width=&quot;160&quot; height=&quot;120&quot;&gt;&lt;/canvas&gt;
  &lt;div class=&quot;layer scan&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;layer vignette&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;flash&quot; id=&quot;flash&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;bar&quot;&gt;
  &lt;label&gt;&lt;input type=&quot;checkbox&quot; id=&quot;toggle&quot; checked&gt; Post pass&lt;/label&gt;
  &lt;button id=&quot;bang&quot;&gt;Flash&lt;/button&gt;
&lt;/div&gt;
&lt;script&gt;
  const crt = document.getElementById(&#x27;crt&#x27;);
  const grain = document.getElementById(&#x27;grain&#x27;);
  const ctx = grain.getContext(&#x27;2d&#x27;);
  const img = ctx.createImageData(grain.width, grain.height);
  const reduced = matchMedia(&#x27;(prefers-reduced-motion: reduce)&#x27;).matches;

  function seed() {
    for (let i = 0; i &lt; img.data.length; i += 4) {
      const v = Math.random() * 255;
      img.data[i] = img.data[i + 1] = img.data[i + 2] = v;
      img.data[i + 3] = 70;
    }
    ctx.putImageData(img, 0, 0);
  }
  function loop() { seed(); requestAnimationFrame(loop); }
  reduced ? seed() : loop();

  document.getElementById(&#x27;toggle&#x27;).onchange = (e) =&gt; crt.classList.toggle(&#x27;on&#x27;, e.target.checked);
  document.getElementById(&#x27;bang&#x27;).onclick = () =&gt; {
    const f = document.getElementById(&#x27;flash&#x27;);
    f.classList.remove(&#x27;go&#x27;); void f.offsetWidth; f.classList.add(&#x27;go&#x27;);
  };
&lt;/script&gt;
</code></pre>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/kite-website/screenshot-2.webp" alt="The golden KITE emblem with its bands separated and glowing over a dark floor, just before they lock"/></p>
<p><em>The golden KITE, a moment before its bands lock in the white &quot;handshake&quot; flash. Real capture of the public site.</em></p>
<p>That flash comes from the same post pass. The diamond-shaped wipe just before it is its own TSL material: an SDF mask that reveals the golden feed. The emblem you see there is the site&#x27;s own logo, the same one that serves as the project icon:</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/kite-website/icon.webp" alt="The KITE Interactive emblem, a layered emerald diamond"/></p>
<h2>Accessible by construction</h2>
<p>A WebGPU film is a great way to build a site nobody can use, so this part got as much attention as the shaders.</p>
<ul>
<li><strong>Real controls over the canvas.</strong> The header, menu, carousel controls, coupon and contact links are real DOM controls laid over the canvas, not hit-tests on pixels. That&#x27;s why the painted layouts hand out their hotspot rectangles.</li>
<li><strong>A complete text version.</strong> A semantic text version is visually hidden while the scenes run, and keyboard focus moves the story to the focused section. Tab through the page and the camera follows you.</li>
<li><strong>Reduced motion respected.</strong> It disables scroll smoothing and softens the grain.</li>
<li><strong>Readable without JavaScript.</strong> The build prerenders the text version into <code>index.html</code> and writes schema.org JSON-LD, <code>/llms.txt</code> and <code>/sitemap.xml</code>, all from <code>src/content/site.ts</code>. Every word on the site lives in that one file, so the film and the text version can&#x27;t drift apart.</li>
<li><strong>Tested with the canvas running.</strong> The Playwright suite checks WCAG 2.2 A and AA rules with axe, both with the canvas running and on the text-only fallback.</li>
</ul>
<p>An accessibility statement opens from the contact page, too.</p>
<h2>Contact without a backend</h2>
<p>There&#x27;s no server behind the contact flow, on purpose. <strong>Book a call</strong> and the consultation coupon open the scheduling link or email address when they&#x27;re configured. Otherwise the site&#x27;s enquiry form prepares a draft you can copy, and the site never sends or stores it.</p>
<p>The same restraint runs through the rest of the privacy story:</p>
<ul>
<li>The site&#x27;s own code doesn&#x27;t use cookies, <code>localStorage</code> or <code>sessionStorage</code>.</li>
<li>Fonts (Space Grotesk and Manrope) are self-hosted through Fontsource, and the models, stills and Draco decoder are served from the site itself.</li>
<li>Vercel Web Analytics and Speed Insights are only included in Vercel builds. Analytics records page views and exactly two named events, <strong>Book a call</strong> and <strong>Send an enquiry</strong>, with no extra properties.</li>
</ul>
<h2>Under the hood</h2>
<table><thead><tr><th>Layer</th><th>Choice</th></tr></thead><tbody><tr><td>UI</td><td>React 19 and TypeScript</td></tr><tr><td>Build</td><td>Vite 8, with a prerender step for the text version, JSON-LD, <code>llms.txt</code> and the sitemap</td></tr><tr><td>3D</td><td>three.js r186 <code>WebGPURenderer</code> with TSL shaders, through react-three-fiber</td></tr><tr><td>Scroll</td><td>Lenis over the native document scroll</td></tr><tr><td>Assets</td><td>Blender Python scripts for every model (Draco GLB) and still (WebP)</td></tr><tr><td>Tests</td><td>Vitest with Testing Library and jsdom; Playwright with axe</td></tr><tr><td>Hosting</td><td>Vercel</td></tr></tbody></table>
<p>The frame pipeline, in one breath:</p>
<pre><code class="language-text">Scroll (Lenis over native scroll)
  └─▶ Timeline (runtime.ts)
        ├─▶ Chapter layers (scenes and live feeds)
        │     └─▶ Post pass (CRT, fringe, bloom, grain)
        │           └─▶ Canvas (WebGPU or WebGL2)
        └─▶ DOM overlay (header, hotspots, text version)
</code></pre>
<ul>
<li><strong>Timeline.</strong> <code>src/engine/runtime.ts</code> holds the shared per-frame state and turns the scroll position into chapter progress. It&#x27;s built from the measured heights of the paper and contact pages, so longer copy makes those chapters scroll further.</li>
<li><strong>Layers.</strong> Each chapter owns a 3D scene, a camera and a screen-space UI scene (<code>src/engine/layers.ts</code>). Offscreen targets carry the live feeds, like the work chapter on the hero CRT, and the director renders only the layers visible at the current scroll position.</li>
<li><strong>Transitions.</strong> Dives are camera moves square to a screen that samples the next feed. That&#x27;s the whole secret of the opening shot.</li>
</ul>
<h3>Nothing is hand-modeled</h3>
<p>Every model and every still is generated by scripts. Nothing depicts invented clients, projects or people: the imagery shows capabilities rather than client work, and props rather than people.</p>
<pre><code class="language-sh">npm run assets:models   # Blender → public/models/*.glb (Draco)
npm run assets:media    # screen textures and Blender stills → public/media/*.webp
npm run assets:optimize # favicon and emblem from brand-design/
</code></pre>
<h3>CI that lives on my machine</h3>
<p>GitHub Actions no longer runs the checks. <code>npm run verify</code> exports the commit with <code>git archive</code>, runs <code>npm ci</code>, <code>npm run check</code> and every Playwright project in a Docker container, and publishes the result as a <strong>Verify (local)</strong> commit status. A pre-push hook runs it for you. Vitest covers the timeline, the text version, the actions, the enquiry drafts and the error boundary in 5 test files; the 9 Playwright tests run the real canvas on desktop Chromium, mobile Chromium and WebKit.</p>
<p>The README is honest about the catch, and so am I: the status records that a trusted developer machine ran the checks. It isn&#x27;t independent CI.</p>
<p>There&#x27;s also a scroll recorder, <code>scripts/record-scroll.mjs</code>, that records the story as a landscape, portrait or square video for social posts.</p>
<h3>Credit where it&#x27;s due</h3>
<p>The layout, choreography and finish are inspired by <a href="https://www.shader.se/">shader.se</a>, rebuilt in KITE&#x27;s own palette, typography and copy.</p>
<h2>What&#x27;s not there yet</h2>
<p>From the roadmap:</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" disabled=""/> <strong>A first tagged release.</strong> The current version has never been tagged. The plan is a tag and a GitHub Release from the CHANGELOG.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> <strong>A shorter README.</strong> The local CI reference moves to its own doc, so the README stays a showcase.</li>
<li class="task-list-item"><input type="checkbox" disabled=""/> <strong>Media in sync with copy.</strong> Whenever the copy in <code>src/content/site.ts</code> changes length, the capture scroll positions get re-surveyed in Montage and the GIFs and explainer re-rendered.</li>
</ul>
<p>The site itself is live at <a href="https://www.kite-interactive.online">www.kite-interactive.online</a>. Grab a mouse with a good scroll wheel.</p>
<p>KITE Interactive website has its own card on the <a href="https://www.0x1ad2.dev/projects?project=kite-website">projects page</a>, with the demo loop, the explainer and the stack at a glance.</p>
<blockquote>
<p>Curious about the source? It&#x27;s private, but access can be granted to anyone interested in contributing. <a href="https://www.0x1ad2.dev/contact">Get in touch</a>.</p>
</blockquote>]]></content:encoded>
    </item>
    <item>
      <title>🏗️ How I build my website</title>
      <link>https://www.0x1ad2.dev/blog/how-i-build-my-website</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/how-i-build-my-website</guid>
      <pubDate>Sat, 10 Oct 2026 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>0x1ad2.dev is my personal site and technical blog. Every visit picks a new accent hue, the hero runs a WebGL CRT warp, and posts can embed runnable three.js demos and sandboxed HTML playgrounds next to their source, all prerendered for search.</description>
      <category>projects</category>
      <category>sites</category>
      <category>react</category>
      <category>vite</category>
      <category>threejs</category>
      <category>typescript</category>
      <category>blogging</category>
      <content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/0x1ad2-dev/icon.webp" alt="The 0x1ad2.dev icon: the white db monogram on a rounded tile split into 12 slices, one per accent hue"/></p>
<p>This site is a small React application that I treat like a client project. It has a component library, a content pipeline, tests in two runners and a quality gate that runs before every push. It also has more animation than any client would sign off on: a shader in the hero, a letter you can pull out of my name, neon tubes, confetti. This post walks through how it all fits together, and the article you&#x27;re reading is part of the machine, so a few of its sections are live.</p>
<p><a href="https://www.0x1ad2.dev/images/projects/0x1ad2-dev/explainer.mp4"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/0x1ad2-dev/explainer-poster.webp" alt="Watch the 0x1ad2.dev explainer (33 seconds, no audio)"/></a></p>
<p><em>The images and video in this post are mockups rebuilt from the site&#x27;s source with Montage, not screen recordings. To see the real thing, reload this page.</em></p>
<p>Everything below describes the code in the repository today. When something is a trade-off rather than a win, I say so.</p>
<h2>Under the hood</h2>
<table><thead><tr><th>Layer</th><th>Choice</th></tr></thead><tbody><tr><td>UI</td><td>React 19 and TypeScript</td></tr><tr><td>Build</td><td>Vite, with Tailwind CSS v4 through its Vite plugin</td></tr><tr><td>Routing</td><td>React Router with lazy route modules</td></tr><tr><td>Components</td><td>shadcn/ui primitives, plus effects from Magic UI and React Bits</td></tr><tr><td>Motion</td><td><code>motion</code> for springs and layout animation, CSS for the rest</td></tr><tr><td>Graphics</td><td>three.js for the hero and the demos in this post, ogl for the Waves hero and two header bands, <code>vgpu</code> for one WebGPU header band</td></tr><tr><td>Quality</td><td>Oxlint, Vitest with Testing Library, Playwright, and a local gate that runs them all</td></tr><tr><td>Hosting</td><td>Vercel, with per-route HTML written at build time</td></tr></tbody></table>
<p>The components live in the repository rather than in a package. shadcn/ui and the React Bits registry both work that way: <code>npx shadcn add</code> copies the source into <code>src/components/ui</code>, and from then on it&#x27;s my code to read, trim and test. The effects sidebar&#x27;s Jelly Radio came from the React Bits registry the same way.</p>
<p>There&#x27;s no backend and there are no forms. The whole site is static, and contact is a <code>mailto:</code> link plus a few outbound links. Here&#x27;s the path a post takes from my editor to your browser:</p>
<pre><code class="language-text">src/content/blog/*.md
  └─▶ Vite plugins           blog-meta.ts exposes metadata, vite.config.ts validates every post
        └─▶ React SPA        React 19, React Router 8, lazy routes
              └─▶ build/seo.ts   per-route HTML, sitemap.xml, feed.xml, llms.txt
                    └─▶ dist/    served by Vercel with clean URLs
</code></pre>
<h2>A new hue on every visit</h2>
<p>Reload the page and the accent changes. Buttons, links, focus rings, the reading-progress bar, the hero background, the demo colours below, the confetti and even the favicon all follow it. Everything themed derives from one CSS variable, <code>--accent-hue</code>, an OKLCH hue angle:</p>
<pre><code class="language-css">:root {
  --accent-hue: 295;
  --primary: oklch(0.65 0.2 var(--accent-hue));
  --highlight: oklch(0.78 0.14 calc(var(--accent-hue) + 40));
  --ring: oklch(0.65 0.2 var(--accent-hue));
}
</code></pre>
<p>A tiny inline script in <code>index.html</code> picks one of 12 hues before the first paint, so there&#x27;s no flash of purple. It also remembers the tab&#x27;s last hue in <code>sessionStorage</code> and never picks it twice in a row:</p>
<pre><code class="language-ts">const hues = [295, 265, 245, 220, 195, 170, 150, 55, 30, 10, 350, 330]
let previous
try { previous = Number(sessionStorage.getItem(&quot;accent-hue&quot;)) } catch {}
const choices = hues.filter((hue) =&gt; hue !== previous)
const hue = choices[Math.floor(Math.random() * choices.length)]
document.documentElement.style.setProperty(&quot;--accent-hue&quot;, String(hue))
try { sessionStorage.setItem(&quot;accent-hue&quot;, String(hue)) } catch {}
</code></pre>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/how-i-build-my-website/hue-roulette.webp" alt="Six visits in a row: the home page re-tints with a scanline sweep through violet, blue, teal, orange and pink while a 12-hue wheel turns to each picked hue"/></p>
<p><em>Hue roulette, as a mockup: six visits, six accents.</em></p>
<p>OKLCH keeps lightness perceptually even, so a blue primary looks as bright as an orange one and text contrast barely moves between hues. Don&#x27;t take my word for it. Here&#x27;s the same picker, the same 12 hues and the same <code>--primary</code> formula. Press <strong>Run</strong>, then spin it a few times:</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { background: #07090d; color: #e5e7eb; font: 14px system-ui, sans-serif; margin: 0; padding: 1.25rem; }
  .wheel { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
  .slice { width: 1.6rem; height: 1.6rem; border-radius: 50%; opacity: .35; transition: transform .2s, opacity .2s; }
  .slice.on { opacity: 1; transform: scale(1.25); box-shadow: 0 0 0 2px #07090d, 0 0 0 4px #fff; }
  button { font: inherit; color: #07090d; border: 0; border-radius: .5rem; padding: .5rem 1rem; cursor: pointer; }
  code { font: 13px ui-monospace, monospace; }
  .muted { color: #9ca3af; }
&lt;/style&gt;
&lt;div class=&quot;wheel&quot; id=&quot;wheel&quot;&gt;&lt;/div&gt;
&lt;button id=&quot;spin&quot;&gt;Reload the visit&lt;/button&gt;
&lt;p&gt;&lt;code id=&quot;out&quot;&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p class=&quot;muted&quot; id=&quot;history&quot;&gt;&lt;/p&gt;
&lt;script&gt;
  const hues = [295, 265, 245, 220, 195, 170, 150, 55, 30, 10, 350, 330]
  const primary = (h) =&gt; `oklch(0.65 0.2 ${h})`
  const wheel = document.getElementById(&quot;wheel&quot;)
  const slices = hues.map((h) =&gt; {
    const s = document.createElement(&quot;span&quot;)
    s.className = &quot;slice&quot;
    s.style.background = primary(h)
    wheel.append(s)
    return s
  })
  // The playground&#x27;s sandbox blocks sessionStorage, so a variable stands in for it.
  let previous
  const seen = []
  function visit() {
    const choices = hues.filter((h) =&gt; h !== previous)
    const hue = choices[Math.floor(Math.random() * choices.length)]
    previous = hue
    slices.forEach((s, i) =&gt; s.classList.toggle(&quot;on&quot;, hues[i] === hue))
    document.getElementById(&quot;spin&quot;).style.background = primary(hue)
    document.getElementById(&quot;out&quot;).textContent = `--accent-hue: ${hue}; --primary: ${primary(hue)}`
    seen.push(hue)
    document.getElementById(&quot;history&quot;).textContent = &quot;Visits so far: &quot; + seen.join(&quot; → &quot;)
  }
  document.getElementById(&quot;spin&quot;).addEventListener(&quot;click&quot;, visit)
  visit()
&lt;/script&gt;
</code></pre>
<p>CSS can&#x27;t feed a three.js material or <code>canvas-confetti</code>, so <code>src/lib/accent.ts</code> reads the hue back and converts OKLCH to hex in about fifteen lines. That&#x27;s how the hero, the demos, the confetti and the favicon get their colours.</p>
<h2>A hero you can grab</h2>
<p>The home page hero runs React Bits&#x27; <a href="https://reactbits.dev/backgrounds/crt-warp">CRT Warp</a> by default: blocky plasma on a curved CRT screen with scanlines, bloom and a slight RGB split, all in one three.js fragment shader. Moving your cursor bends the screen. I dimmed it from its defaults so the name and copy stay readable on top. Two alternatives live in the effects sidebar described below: <strong>Waves</strong>, a halftone surface of dots rendered with the small <a href="https://github.com/oframe/ogl">ogl</a> library, and <strong>Light pillar</strong>, a raymarched column of light in three.js. All of them take the visit&#x27;s hue.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/projects/0x1ad2-dev/screenshot-1.webp" alt="The home page in violet with the CRT Warp hero, the Tech Text name and the effects sidebar pinned open at the right edge"/></p>
<p>The name on top is React Bits&#x27; <a href="https://reactbits.dev/text-animations/tech-text">Tech Text</a>. A sweep outlines each letter with a measurement frame, like a design tool showing you its bounding boxes. And you can grab a letter, drag it out of my name and let go: it springs back. The heading text stays in the DOM, so assistive tech reads my name, not a pile of letters.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/how-i-build-my-website/tech-text-drag.webp" alt="The cursor grabs the B of the hero name, pulls it out with an offset label, lets go and it springs back while the measurement frame sweeps the other letters"/></p>
<p><em>Tech Text, as a mockup: pull a letter, watch it come home.</em></p>
<p>The backgrounds are the heaviest things on the site, so they come with three guardrails:</p>
<ol>
<li><strong>They&#x27;re optional.</strong> The component is lazy-loaded and only rendered when <code>supportsWebGL()</code> can create a WebGL2 context.</li>
<li><strong>They can&#x27;t take the page down.</strong> They sit inside a <code>BackgroundBoundary</code>, an error boundary that renders nothing if the canvas throws. A missing GPU feature leaves a readable page.</li>
<li><strong>They stop when nobody can see them.</strong> A small hook pauses the frame loop off-screen and in background tabs.</li>
</ol>
<pre><code class="language-ts">// Keep mounted GPU resources, but stop requesting frames outside the viewport.
export function useAnimationActive(ref: RefObject&lt;HTMLElement | null&gt;) {
  const [active, setActive] = useState(true)

  useEffect(() =&gt; {
    let inView = true
    const update = () =&gt; setActive(inView &amp;&amp; document.visibilityState !== &quot;hidden&quot;)
    const observer = typeof IntersectionObserver === &quot;undefined&quot; ? undefined : new IntersectionObserver(
      ([entry]) =&gt; {
        inView = entry.isIntersecting
        update()
      }
    )
    if (ref.current) observer?.observe(ref.current)
    document.addEventListener(&quot;visibilitychange&quot;, update)
    update()
    return () =&gt; {
      observer?.disconnect()
      document.removeEventListener(&quot;visibilitychange&quot;, update)
    }
  }, [ref])

  return active
}
</code></pre>
<p>That same hook drives the neon progress bar and every three.js demo further down this page. With reduced motion turned on, the hero renders one still frame and never starts its loop.</p>
<p>The other pages get their own dark header bands in the same spirit: Micro Slats and Pattern Waves in WebGL through ogl on Experience and About, and Shape Waves in WebGPU through <code>vgpu</code> on the Blog. They take the accent colour too.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/how-i-build-my-website/screenshot-about.webp" alt="The About page with a halftone waves header band and a terminal card"/></p>
<h2>Pages, routes and lazy loading</h2>
<p>The home page loads with the main bundle so the first visit paints quickly. Every other page is a lazy route, so its code downloads only when someone navigates there:</p>
<pre><code class="language-tsx">{
  path: &quot;blog/:slug&quot;,
  lazy: async () =&gt; ({ Component: (await import(&quot;@/pages/BlogPostPage&quot;)).BlogPostPage }),
},
</code></pre>
<p>Each route group also has an <code>errorElement</code>. If a chunk fails to load (a flaky connection or a deploy mid-visit), the header and footer stay on screen and the reader gets a way back instead of a blank page. A Playwright test blocks the About page chunk on purpose to prove that.</p>
<h2>A glowing status dot</h2>
<p>The availability pill in the hero is deliberately plain: a soft border, small text and a green dot with a CSS ping. The only flourish is on the dot itself, which glows like a tiny LED. That&#x27;s three stacked shadows on one element, a tight bright core and two wider, fainter halos:</p>
<pre><code class="language-tsx">&lt;span className=&quot;relative flex size-2&quot;&gt;
  &lt;span className=&quot;absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75 motion-reduce:animate-none&quot; /&gt;
  &lt;span className=&quot;relative inline-flex size-2 rounded-full bg-emerald-300 shadow-[0_0_4px_#6ee7b7,0_0_10px_#10b981,0_0_18px_#10b98199]&quot; /&gt;
&lt;/span&gt;
</code></pre>
<p>The glow is static, so it costs nothing per frame. With reduced motion turned on, the ping stops and the dot keeps glowing.</p>
<p>Try the same trick here. Change the shadow sizes or colours and press <strong>Run</strong>:</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { background: #07060b; display: grid; place-items: center; min-height: 10rem; }
  .pill {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .25rem .75rem .25rem .5rem;
    border: 1px solid rgb(255 255 255 / .15); border-radius: 999px;
    background: rgb(255 255 255 / .05);
    color: rgb(255 255 255 / .8); font: 500 .75rem system-ui, sans-serif;
  }
  .dot {
    width: .5rem; height: .5rem; border-radius: 50%;
    background: #6ee7b7;
    box-shadow: 0 0 4px #6ee7b7, 0 0 10px #10b981, 0 0 18px #10b98199;
  }
&lt;/style&gt;
&lt;span class=&quot;pill&quot;&gt;&lt;span class=&quot;dot&quot;&gt;&lt;/span&gt;Available for select consulting engagements&lt;/span&gt;
</code></pre>
<h2>A neon reading-progress bar</h2>
<p>The thin bar at the very top of the window fills as you scroll and reaches the right edge at the bottom of the page. Look up: it&#x27;s there right now. It&#x27;s a neon tube: when you start scrolling from the top, it strikes with a flicker, then hums gently while it&#x27;s lit. The behaviour and prop names follow React Bits Pro&#x27;s <a href="https://pro.reactbits.dev/docs/components/neon-reveal">Neon Reveal</a>. My version in <code>src/components/ui/neon-reveal.tsx</code> uses the Web Animations API rather than a canvas.</p>
<p>The tube itself doesn&#x27;t know about scrolling. A wrapper sets its width from <code>motion</code>&#x27;s scroll progress and asks it to strike again each time the page leaves the top:</p>
<pre><code class="language-tsx">const { scrollYProgress } = useScroll()
const width = useTransform(scrollYProgress, (value) =&gt; `${value * 100}%`)

useMotionValueEvent(scrollYProgress, &quot;change&quot;, (value) =&gt; {
  if (value &gt; 0 &amp;&amp; !lit.current) {
    lit.current = true
    neon.current?.replay()
  } else if (value === 0) {
    lit.current = false
  }
})
</code></pre>
<p>Animating <code>width</code> instead of <code>scaleX</code> keeps the glow&#x27;s rounded ends from being squashed while the bar is short. Every ignition animation uses a backwards fill, so nothing lingers on the element once it finishes. With reduced motion on, the bar still tracks your position but never flickers.</p>
<h2>An effects sidebar at the edge of the screen</h2>
<p>Move your mouse to the right edge of the window and a panel slides in. It lets you pick the pointer effect for the whole site: <strong>Sparks</strong> on click (the default), a neon <strong>Trail</strong> behind the cursor, a small burst of <strong>Confetti</strong>, or <strong>Off</strong>. It also has a hidden extra: a second choice that switches the home page hero between <strong>CRT</strong>, <strong>Waves</strong> and <strong>Light pillar</strong>. Both choices are React Bits Jelly Radios. The pointer effect is saved in <code>localStorage</code>, so it survives future visits. The hero choice lasts only for the tab&#x27;s session, so every new visit starts with the CRT.</p>
<p>The edge detection is a single passive <code>pointermove</code> listener. The pointer has to stay in the last 12 pixels for 120 ms before the panel opens, so a quick trip to the scrollbar doesn&#x27;t trigger it. Moving well to the left closes it again:</p>
<pre><code class="language-ts">const onPointerMove = (event: PointerEvent) =&gt; {
  if (event.pointerType === &quot;touch&quot;) return
  if (modeRef.current === null) {
    const nearEdge = event.clientX &gt;= document.documentElement.clientWidth - EDGE_ZONE
    if (nearEdge &amp;&amp; event.buttons === 0) dwell ??= setTimeout(() =&gt; setMode(&quot;hover&quot;), EDGE_DWELL)
    else clearDwell()
  } else if (modeRef.current === &quot;hover&quot; &amp;&amp; panelRef.current) {
    if (event.clientX &lt; panelRef.current.getBoundingClientRect().left - LEAVE_DISTANCE) setMode(null)
  }
}
</code></pre>
<p>Hover-only features exclude touch and keyboard users, so a slim handle on the edge opens the same panel with a tap or Enter, and focus moves to the selected option. While closed, the panel is <code>inert</code>, so it never traps Tab. Each effect only runs a frame loop while something is moving. With reduced motion on, the choices are disabled and the panel explains why.</p>
<h2>A command palette for everything</h2>
<p>Press &lt;kbd&gt;⌘K&lt;/kbd&gt;, &lt;kbd&gt;Ctrl&lt;/kbd&gt;+&lt;kbd&gt;K&lt;/kbd&gt; or just &lt;kbd&gt;/&lt;/kbd&gt; on any page. Yes, right now. A palette opens over the page and searches pages, posts and experience roles as you type. It also toggles the theme, copies my email address and opens the LinkedIn, X and KITE links, so they&#x27;re one keystroke away.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/how-i-build-my-website/screenshot-command-menu.webp" alt="The command palette searching for blog over the blog index"/></p>
<h2>Posts are Markdown files</h2>
<p>There&#x27;s no CMS. A post is a Markdown file in <code>src/content/blog</code>, reviewed in a pull request like any other change. The filename becomes the slug:</p>
<pre><code class="language-md">---
title: &quot;🏗️ How I build my website&quot;
description: A concrete promise to the reader.
date: 2026-10-10
tags: [react, threejs]
draft: true
---

## Start with the problem
</code></pre>
<p>The frontmatter parser in <code>src/lib/blog-content.ts</code> supports a deliberate subset: one-line strings, inline lists and booleans. It&#x27;s not YAML, and it doesn&#x27;t pretend to be. Optional fields cover a social preview <code>image</code> and an <code>originalUrl</code> for articles first published on Medium. Drafts appear in development and are left out of production builds.</p>
<p><code>build/blog-meta.ts</code> exposes each post&#x27;s metadata as a module, and post bodies load only when a post is opened. A Vite plugin in <code>vite.config.ts</code> parses every post again, drafts included, during <code>npm run build</code>. A missing title, an impossible date such as <code>2026-02-30</code>, or an embedded demo that doesn&#x27;t exist fails the build rather than publishing a broken page.</p>
<p>The trade-off is honest: draft content is imported into client code, so drafts aren&#x27;t secret. For a personal blog, a reviewed diff per post is worth it.</p>
<h2>From Markdown to a reading page</h2>
<p><code>react-markdown</code> with <code>remark-gfm</code> renders the body, and the post page adds the reading furniture:</p>
<ul>
<li><strong>Reading time</strong> counts prose only. Code blocks are stripped first, so a long snippet doesn&#x27;t inflate the estimate.</li>
<li><strong>Table of contents.</strong> Every <code>##</code> heading gets a slug id and a hover anchor. The sidebar list is React Bits&#x27; <a href="https://reactbits.dev/components/line-sidebar">Line Sidebar</a>: items near your cursor lean out and take the accent colour, and an <code>IntersectionObserver</code> lights up the section you&#x27;re reading. I changed its items from click handlers to real links, so Tab, Enter and the URL hash all work, and keyboard focus lights an item the same way hover does.</li>
<li><strong>Search and tags</strong> on the blog index live in URL parameters, so a filtered view is a shareable link. Search covers titles, descriptions and tags.</li>
<li><strong>Share</strong> copies the post URL and confirms with a toast, or explains when the clipboard is blocked.</li>
<li><strong>Reduced-motion notice.</strong> If your system asks for less motion, the post says which animations are paused and that the examples still work.</li>
</ul>
<h2>Code blocks you can copy and run</h2>
<p>Each fenced block goes through one <code>Pre</code> component, which reads the fence&#x27;s language and picks a renderer:</p>
<pre><code class="language-tsx">function Pre({ children }: { children?: ReactNode }) {
  const code = textOf(children).replace(/\n$/, &quot;&quot;)
  const language = languageOf(children)

  if (language === &quot;html-live&quot;) return &lt;CodePlayground source={code} /&gt;
  if (language === THREE_DEMO_LANGUAGE) {
    return (
      &lt;BackgroundBoundary fallback={&lt;DemoMessage&gt;This demo couldn&#x27;t load. Reload the page to try again.&lt;/DemoMessage&gt;}&gt;
        &lt;Suspense fallback={&lt;DemoMessage&gt;Loading demo…&lt;/DemoMessage&gt;}&gt;
          &lt;ThreeDemo name={code.trim()} /&gt;
        &lt;/Suspense&gt;
      &lt;/BackgroundBoundary&gt;
    )
  }
  return &lt;CodeBlock code={code} language={language} /&gt;
}
</code></pre>
<p>Plain blocks get line numbers, a deliberately tiny regex tokenizer for colour, and a copy button. It&#x27;s not a real parser, but it covers the TypeScript, TSX and HTML I write about without bundling a highlighting engine.</p>
<p><code>html-live</code> blocks, like the hue picker and the glowing dot above, become an editor next to a preview. The preview is an <code>iframe</code> with <code>sandbox=&quot;allow-scripts&quot;</code> and a Content Security Policy of <code>default-src &#x27;none&#x27;</code>. Scripts run, but they can&#x27;t touch this page, its storage or the network.</p>
<p>That&#x27;s a big claim, so here&#x27;s a playground that tries to break out. Press <strong>Run</strong> and watch it fail three times:</p>
<pre><code class="language-html-live">&lt;style&gt;
  body { background: #07090d; color: #e5e7eb; font: 13px ui-monospace, monospace; margin: 0; padding: 1rem; }
  li { margin: .35rem 0; }
  .ok { color: #6ee7b7; }
  .no { color: #fca5a5; }
&lt;/style&gt;
&lt;ul id=&quot;log&quot;&gt;&lt;/ul&gt;
&lt;script&gt;
  const log = (label, ok, detail) =&gt; {
    const li = document.createElement(&quot;li&quot;)
    li.innerHTML = `&lt;span class=&quot;${ok ? &quot;ok&quot; : &quot;no&quot;}&quot;&gt;${ok ? &quot;allowed&quot; : &quot;blocked&quot;}&lt;/span&gt; ${label}: ${detail}`
    document.getElementById(&quot;log&quot;).append(li)
  }
  try { localStorage.setItem(&quot;escape&quot;, &quot;1&quot;); log(&quot;localStorage&quot;, true, &quot;wrote a key&quot;) }
  catch (error) { log(&quot;localStorage&quot;, false, error.name) }
  try { log(&quot;parent page&quot;, true, window.parent.document.title) }
  catch (error) { log(&quot;parent page&quot;, false, error.name) }
  fetch(&quot;https://www.0x1ad2.dev/feed.xml&quot;)
    .then(() =&gt; log(&quot;network&quot;, true, &quot;fetched the feed&quot;))
    .catch((error) =&gt; log(&quot;network&quot;, false, error.name))
  log(&quot;inline script&quot;, true, &quot;you&#x27;re reading its output&quot;)
&lt;/script&gt;
</code></pre>
<h2>Three.js demos inside a post</h2>
<p>That sandbox is exactly why three.js demos need their own path. The <code>iframe</code> can&#x27;t load modules, so a <code>three-demo</code> fence names a TypeScript file in <code>src/components/blog/three-demos/</code> instead:</p>
<pre><code class="language-md">Here is the spinning cube:

~~~three-demo
spinning-cube
~~~
</code></pre>
<p>Every demo exports a <code>mount(canvas, { accent })</code> function with the same small contract. <code>accent</code> is this visit&#x27;s primary colour as hex. The demo owns its renderer and scene. The host owns everything around it:</p>
<pre><code class="language-ts">export type Demo = {
  frame: (seconds: number) =&gt; void
  resize: (width: number, height: number) =&gt; void
  dispose: () =&gt; void
}

export type DemoOptions = { accent: string }
</code></pre>
<p>The host component loads the module and its raw source with two lazy <code>import.meta.glob</code> calls. The code under each demo is therefore the file that&#x27;s running, not a copy that can drift. three.js itself only downloads when a post contains a demo. The host also:</p>
<ul>
<li>drives one <code>requestAnimationFrame</code> loop that stops off-screen, in hidden tabs and when you press <strong>Pause</strong></li>
<li>re-renders a still frame when the canvas resizes while paused</li>
<li>calls <code>dispose()</code> on unmount so geometries, materials and the renderer are released</li>
<li>starts paused for reduced-motion readers, who can opt in with <strong>Play</strong></li>
<li>shows the source with an explanation when WebGL isn&#x27;t available</li>
</ul>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/how-i-build-my-website/screenshot-blog-post-light.webp" alt="A blog post in the light theme with the neon reading bar, the line-sidebar table of contents and the spinning-cube three.js demo"/></p>
<h3>A first scene</h3>
<p>The smallest useful scene is a renderer, a camera and one lit mesh. Rotation comes from elapsed seconds rather than a per-frame increment, so pausing, restarting and frame drops all behave predictably. Notice the colour: it&#x27;s this visit&#x27;s hue.</p>
<pre><code class="language-three-demo">spinning-cube
</code></pre>
<h3>Rewriting geometry every frame</h3>
<p>Here, 3,136 points share one <code>BufferAttribute</code>. Each frame rewrites their heights in place and sets <code>needsUpdate</code>, which uploads the buffer once without allocating anything. Move your pointer over the canvas to move the ripple. The listener is removed in <code>dispose</code>, like every other resource:</p>
<pre><code class="language-three-demo">pointer-ripples
</code></pre>
<h3>Ordered dithering in a shader</h3>
<p>The site&#x27;s previous hero used an ordered-dither pass. This demo is the same idea in under 20 lines of GLSL. A moving gradient is quantised to four shades, and a 4×4 Bayer matrix decides which pixels round up, so it reads as a smooth ramp from a distance:</p>
<pre><code class="language-three-demo">ordered-dither
</code></pre>
<p>To add a demo, drop a file that exports <code>mount</code> into the folder and reference it from a fence. The build checks that the name exists.</p>
<h2>Prerendered for search, and for agents</h2>
<p>A single-page app has an awkward secret: without JavaScript, every page is the same empty shell. So <code>npm run build</code> ends with a step in <code>build/seo.ts</code> that writes a real HTML file for every route (<code>about.html</code>, <code>blog/&lt;slug&gt;.html</code> and so on). Each one carries that page&#x27;s title, description, canonical URL, Open Graph and X cards and JSON-LD, plus the page content as plain HTML for crawlers and AI agents that don&#x27;t run JavaScript. Browsers hide that copy and React replaces it on start-up.</p>
<p>The same step writes the rest of the paperwork:</p>
<table><thead><tr><th>File</th><th>For</th></tr></thead><tbody><tr><td><code>sitemap.xml</code>, <code>robots.txt</code></td><td>Search engines</td></tr><tr><td><code>feed.xml</code></td><td>RSS readers</td></tr><tr><td><code>llms.txt</code>, <code>llms-full.txt</code></td><td>Language models and the agents that use them</td></tr><tr><td><code>404.html</code></td><td>A real not-found page that still boots the app</td></tr></tbody></table>
<p>Vercel serves the route files through <code>cleanUrls</code>, so <code>/about</code> gets <code>about.html</code>. <code>vercel.json</code> also sets long-lived caching for the hashed <code>/assets/</code>, a week for <code>/images/</code>, an hour for the feeds and text files, and a handful of security headers, including a <code>Permissions-Policy</code> that turns off the camera, microphone, geolocation and topics. To host it anywhere else, serve <code>dist/</code> with <code>.html</code> extension fallback and <code>404.html</code> for missing paths.</p>
<h2>Light and dark</h2>
<p>The theme follows your system until you pick one, and the same inline script that picks the hue sets the <code>dark</code> class before the first paint. The animated toggler reveals the new theme in a circle. Decorative motion respects reduced-motion settings everywhere.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/how-i-build-my-website/screenshot-home-light.webp" alt="The home page in the light theme with the CRT Warp hero in violet and the effects sidebar open"/></p>
<h2>Testing and the quality gate</h2>
<p>Vitest runs unit and integration tests in jsdom: the frontmatter parser, date validation, routes, the SEO step and the playground. jsdom has no WebGL, so those tests check the fallbacks. Playwright runs the production build in three projects, Desktop Chrome, Desktop Safari (WebKit) and a Pixel 7 viewport. It covers navigation, blog search and tag filters, content, the playground and three.js demos, interactions, effects, theme, performance and resilience: every post renders its code blocks and anchors, the hero canvas pauses off-screen, a failed chunk keeps navigation alive, and the effects sidebar opens from the edge and remembers its choice.</p>
<p>GitHub Actions are disabled for this repository, so nothing is checked on GitHub. Instead, <code>npm run verify</code> runs every check on my own machine, and a pre-push hook won&#x27;t let a commit leave without it:</p>
<pre><code class="language-sh">npm run check    # Oxlint, Vitest, tsc -b and the production build, which validates every article
npm run verify   # check, plus Playwright in Chromium, WebKit and a mobile viewport
</code></pre>
<p>The gate is picky on purpose. It insists on the Node version in <code>.nvmrc</code>, reinstalls dependencies when the lockfile or toolchain changed, rejects <code>.only</code> in tests, and serves the build on a free port so it never reuses a stale preview server. A pass on a clean tree is recorded for that commit, so pushing it again doesn&#x27;t rerun everything. After a verified push, the hook posts a <code>Verify (local)</code> commit status to GitHub. To be clear about what that means: my own machine ran the gate. It is not the same as independent CI.</p>
<p>Dependabot alerts are on, but Dependabot opens no update PRs. <code>npm run deps:report</code> gives a read-only overview of outdated packages, <code>npm audit</code> and open alerts, and upgrades go through one dependency PR that has to pass the same gate.</p>
<h2>Privacy, briefly</h2>
<ul>
<li><strong>Analytics only on Vercel.</strong> Vercel Web Analytics and Speed Insights load only in Vercel builds, grouped by route pattern, so every post counts as <code>/blog/[slug]</code>.</li>
<li><strong>Preferences stay in your browser.</strong> Your theme and pointer effect live in <code>localStorage</code>. The visit&#x27;s hue and hero background live in <code>sessionStorage</code> and reset when the tab closes.</li>
<li><strong>Self-hosted fonts.</strong> Inter and JetBrains Mono are bundled, so no font CDN is contacted.</li>
<li><strong>Sandboxed playgrounds.</strong> As the escape attempt above showed, example code can&#x27;t reach the network or this page&#x27;s storage.</li>
</ul>
<h2>What&#x27;s not there yet</h2>
<p>The roadmap is a list of ideas the code points to, not commitments:</p>
<ul>
<li><strong>Full-text blog search.</strong> Search covers titles, descriptions and tags today, not article bodies.</li>
<li><strong>More three.js demos.</strong> There are three today. Each new one is a single module with <code>mount(canvas, { accent })</code>.</li>
<li><strong>New writing.</strong> Most of the older articles are ports of my Medium posts from 2016 to 2020.</li>
</ul>
<p>As for status: it&#x27;s live at <a href="https://www.0x1ad2.dev">www.0x1ad2.dev</a>, which is where you&#x27;re reading this. Pushes to <code>main</code> go to production and pull requests get preview deployments.</p>
<p>That&#x27;s the whole machine: a static React app, Markdown in the repository, and enough guardrails that the fun parts (neon tubes, shaders, confetti, a letter you can steal from my name) can&#x27;t make the reading worse.</p>
<p>0x1ad2.dev has its own card on the <a href="https://www.0x1ad2.dev/projects?project=0x1ad2-dev">projects page</a>, with the demo loop, the explainer and the stack at a glance.</p>
<blockquote>
<p>Curious about the source? It&#x27;s private, but access can be granted to anyone interested in contributing. <a href="https://www.0x1ad2.dev/contact">Get in touch</a>.</p>
</blockquote>]]></content:encoded>
    </item>
    <item>
      <title>Part 1: Create your first Next.js application</title>
      <link>https://www.0x1ad2.dev/blog/create-your-first-nextjs-application</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/create-your-first-nextjs-application</guid>
      <pubDate>Tue, 28 Apr 2020 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>A step-by-step guide to scaffolding a Next.js app with Yarn, styled-components and dotenv, and rendering your first page.</description>
      <category>nextjs</category>
      <category>react</category>
      <category>nodejs</category>
      <category>tutorial</category>
      <content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/create-your-first-nextjs-application/01.webp" alt="Orange DevJam Next.js mini-series banner"/></p>
<h2>What is Next.js</h2>
<p>Next.js is a minimalistic framework for server-rendered (SSR), and production-ready React applications. Here are some other cool features Next.js brings to the table:</p>
<ul>
<li>An intuitive page-based routing system (with support for dynamic routes)</li>
<li>Automatically statically optimizes page(s) when possible</li>
<li>Server-side renders page(s) with blocking data requirements</li>
<li>Automatic code splitting for faster page loads</li>
<li>Client-side routing with optimized page prefetching</li>
<li>Built-in CSS support, and support for any CSS-in-JS library</li>
<li>Webpack-based dev environment which supports <a href="https://webpack.js.org/concepts/hot-module-replacement/">Hot Module Replacement</a> (HMR)</li>
<li>API routes to build your API with serverless functions, with the same simple router used for pages</li>
<li>Customizable with community plugins and with your own Babel and Webpack configurations</li>
</ul>
<h2>What we are going to create</h2>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/create-your-first-nextjs-application/02.webp" alt="Browser at localhost:3000/placeholder showing the DevJam logo and “Woo-hoo you&#x27;ve created your first Next.js app”"/></p>
<h2>Prerequisites</h2>
<p>Before creating our first Next.js project, there are some essential dependencies that you need to install in order to at least run our app and install our application-specific dependencies:</p>
<ul>
<li><a href="https://nodejs.org/en/">NodeJS</a>: NodeJS is a cross-platform JavaScript run-time that executes JavaScript code outside of the browser. NodeJS lets developers use JavaScript to write command-line tools and server-side applications.</li>
<li><a href="https://yarnpkg.com/">Yarn</a>: Yarn is a package manager for your code. It allows you to use and share (e.g., JavaScript) code with other developers from around the world. Yarn does this quickly, securely, and reliably so you don’t ever have to worry.</li>
<li><a href="https://code.visualstudio.com/">Visual Studio Code</a>: Visual Studio Code is a lightweight but powerful source code editor that runs on your desktop and is available for Windows, macOS, and Linux. It comes with built-in support for JavaScript, TypeScript, and Node.js and has a rich ecosystem of extensions for other languages (e.g., C++, C#, Java, Python, PHP, Go) and runtimes (e.g., .NET and Unity).</li>
</ul>
<blockquote>
<p>I’m in favor of Yarn but you could also use NPM instead if you want to! Both are good tools for managing your packages.</p>
</blockquote>
<h2>Setup your project</h2>
<p>With those essential dependencies installed, we are now able to scaffold our first project using the yarn interactive setup form.</p>
<blockquote>
<p>If you don’t know what mkdir, cd and other CLI commands mean <a href="https://openclassrooms.com/en/courses/4614926-learn-the-command-line-in-terminal">click here</a></p>
</blockquote>
<p>Create a new folder on your system where your project lives. I call our new folder “devjam-dasboard”.</p>
<pre><code class="language-sh">$ mkdir devjam-dashboard
</code></pre>
<p>Traverse into that directory</p>
<pre><code class="language-sh">$ cd devjam-dashboard
</code></pre>
<p>Initialize a new Yarn project</p>
<pre><code class="language-sh">$ yarn init
</code></pre>
<p>This command walks you through an interactive session to create a package.json file, after that we can start adding our application-specific dependencies.</p>
<h3>Install dependencies</h3>
<p>We’re going to add a whole lot of packages to the application, most of them are a must-have (some of them aren’t used in this part of the series yet).</p>
<pre><code class="language-sh">$ yarn add body-parser dotenv dotenv-webpack express isomorphic-fetch next react react-dom styled-components bootstrap react-bootstrap
</code></pre>
<p>If everything did go well our <strong>package.json</strong> should look like this</p>
<pre><code class="language-json">{
  &quot;name&quot;: &quot;devjam-dashboard&quot;,
  &quot;version&quot;: &quot;1.0.0&quot;,
  &quot;description&quot;: &quot;A small administrative dashboard for DevJam.&quot;,
  &quot;main&quot;: &quot;index.js&quot;,
  &quot;author&quot;: &quot;Dennis Bruijn&quot;,
  &quot;license&quot;: &quot;MIT&quot;,
  &quot;dependencies&quot;: {
    &quot;body-parser&quot;: &quot;^1.19.0&quot;,
    &quot;bootstrap&quot;: &quot;^4.4.1&quot;,
    &quot;dotenv&quot;: &quot;^8.2.0&quot;,
    &quot;dotenv-webpack&quot;: &quot;^1.7.0&quot;,
    &quot;express&quot;: &quot;^4.17.1&quot;,
    &quot;isomorphic-fetch&quot;: &quot;^2.2.1&quot;,
    &quot;next&quot;: &quot;^9.3.5&quot;,
    &quot;react&quot;: &quot;^16.13.1&quot;,
    &quot;react-bootstrap&quot;: &quot;^1.0.0&quot;,
    &quot;react-dom&quot;: &quot;^16.13.1&quot;,
    &quot;styled-components&quot;: &quot;^5.1.0&quot;
  }
}
</code></pre>
<ul>
<li><a href="https://github.com/expressjs/body-parser">body-parser</a>: This package lets your NodeJS application parse different types of request bodies (e.g., application/JSON).</li>
<li><a href="https://github.com/motdotla/dotenv">dotenv</a>: Loads environment variables from .env for NodeJS projects.</li>
<li><a href="https://github.com/mrsteele/dotenv-webpack">dotenv-webpack</a>: A secure webpack plugin that supports dotenv and other environment variables and only exposes what you choose and use.</li>
<li><a href="https://github.com/expressjs/express">Express</a>: Fast, unopinionated, minimalist web framework for NodeJS</li>
<li><a href="https://github.com/matthew-andrews/isomorphic-fetch">isomorphic-fetch</a>: This package adds an <em>isomorphic</em> fetch function that you can use both on the front-end and the back-end.</li>
<li><a href="https://github.com/vercel/next.js">Next.js</a>, <a href="https://github.com/facebook/react">react</a>, and <a href="https://auth0.com/blog/next-js-authentication-tutorial/">react-dom</a>: Together, these packages let you build React apps with Next on top.</li>
<li><a href="https://github.com/twbs/bootstrap">bootstrap</a> and <a href="https://github.com/react-bootstrap/react-bootstrap">react-bootstrap</a>: These packages allow you to use Bootstrap components without having to use jQuery.</li>
<li><a href="https://styled-components.com/">styled-components</a>: Utilising tagged template literals (a recent addition to JavaScript) and the power of CSS, styled-components allows you to write actual CSS code to style your components.</li>
</ul>
<h3>Launching from the command line</h3>
<p>Launching Visual Studio Code from the terminal looks cool and is a productive way to edit (if you split your screen with the terminal on one side and Code on the other).</p>
<p>To enable this, press <strong>cmd + shift + P</strong>, type in <strong>shell command,</strong> and select <strong>Install code command in path</strong></p>
<h3>Configure babel</h3>
<p>Create a file called .babelrc inside the project root</p>
<pre><code class="language-sh">$ touch .babelrc
</code></pre>
<p>Open the file</p>
<pre><code class="language-sh">$ code .babelrc
</code></pre>
<p>Paste the following into the file and hit save.</p>
<pre><code class="language-json">{
  &quot;presets&quot;: [&quot;next/babel&quot;],
  &quot;plugins&quot;: [[&quot;styled-components&quot;, { &quot;ssr&quot;: true }]]
}
</code></pre>
<p>This will make styled-components work with Next.js and let Babel know that you are developing with this package. Configuring Babel with <a href="https://nextjs.org/blog/next-7#babel-7">the next/babel preset is needed</a> to make this package compile your code correctly.</p>
<h3>Configure dotenv</h3>
<p>Create a file called .env inside the project root</p>
<pre><code class="language-sh">$ touch .env
</code></pre>
<p>Open the file</p>
<pre><code class="language-sh">$ code .env
</code></pre>
<p>Paste the following into the file and hit save.</p>
<pre><code class="language-ini">PORT=3000
</code></pre>
<p>An env file is a simple configuration text file that is used to define some variables you want to pass into your application’s environment. This file needs something like a parser to make it work. The parser reads the variable definitions one-by-one and parses them to the environment. In our case, the parser is webpack in combination with dotenv.</p>
<h3>Configure Next.js</h3>
<p>Create a file called .next.config.js inside the project root</p>
<pre><code class="language-sh">$ touch next.config.js
</code></pre>
<p>Open the file</p>
<pre><code class="language-sh">$ code next.config.js
</code></pre>
<p>Paste the following into the file and hit save.</p>
<pre><code class="language-js">require(&quot;dotenv&quot;).config();

const path = require(&quot;path&quot;);
const Dotenv = require(&quot;dotenv-webpack&quot;);

module.exports = {
  webpack: config =&gt; {
    config.plugins = config.plugins || [];

    config.plugins = [
      ...config.plugins,

      new Dotenv({
        path: path.join(__dirname, &quot;.env&quot;),
        systemvars: true
      })
    ];

    return config;
  }
};
</code></pre>
<p>A Next.js config file is a regular NodeJS module, not a JSON file. It is used by the Next.js server and build phases, and it’s not included in the browser build.</p>
<h2>Let’s build!</h2>
<h3>Create a pages directory</h3>
<p>In Next.js, a <strong>page</strong> is a <a href="https://legacy.reactjs.org/docs/components-and-props.html">React Component</a> exported from a .js, jsx, .ts, or .tsx file in the pages directory.</p>
<pre><code class="language-sh">$ mkdir -p src/pages
^ the -p flag makes sure src is created first
</code></pre>
<h3>Add a new page</h3>
<p>Create a file called placeholder.js inside the src/pages directory</p>
<pre><code class="language-sh">$ touch src/pages/placeholder.js
</code></pre>
<p>Open the file</p>
<pre><code class="language-sh">$ code src/pages/placeholder.js
</code></pre>
<p>Paste the following into the file and hit save.</p>
<pre><code class="language-jsx">import styled from &quot;styled-components&quot;;

const Placeholder = styled.div`
  margin-top: 25vh;
  text-align: center;
  font-family: Arial, Helvetica, sans-serif;
  img {
    width: 100px;
  }
  h1 {
    color: #4a566e;
  }
`;

function Index() {
  return (
    &lt;Placeholder&gt;
      &lt;img src=&quot;https://cdn-images-1.medium.com/max/222/1*CAL6MRkz-KF6U2oZY4JWJg@2x.png&quot; /&gt;
      &lt;h1&gt;Woo-hoo you&#x27;ve created&lt;/h1&gt;
      &lt;h1&gt; your first Next.js app 🎉&lt;/h1&gt;
    &lt;/Placeholder&gt;
  );
}

export default Index;
</code></pre>
<p>Each page is associated with a route based on its file name. e.g., if you create <strong>pages/placeholder.js</strong> that exports a React component like below, it will be accessible at <strong>domain.io/placeholder</strong></p>
<h3>Run it</h3>
<p>To wrap things in this section, open the package.json file add a script property to the main object.</p>
<p>Open the file package.json</p>
<pre><code class="language-sh">$ code package.json
</code></pre>
<p>Paste the following into the file and hit save.</p>
<pre><code class="language-json">&quot;scripts&quot;: { &quot;dev&quot;: &quot;next&quot; },
</code></pre>
<p>After defining the dev script, you can execute</p>
<pre><code class="language-sh">$ yarn dev
</code></pre>
<p>to run the first version of your Next.js app.</p>
<p>If everything works as expected, in a few seconds, you will be able to open <a href="http://localhost:3000/placeholder">http://localhost:3000/placeholder</a> in a web browser.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/create-your-first-nextjs-application/03.webp" alt="You did it!"/>
<em>You did it!</em></p>
<h2>Github repository</h2>
<p>If you want to check out the code without following the guide or just check if you did everything right <a href="https://github.com/0x1ad2/devjam-next-part-1">DevJam Part 1 — Repository</a></p>]]></content:encoded>
    </item>
    <item>
      <title>⏩ React Live: the interactive conference</title>
      <link>https://www.0x1ad2.dev/blog/react-live-the-interactive-conference</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/react-live-the-interactive-conference</guid>
      <pubDate>Mon, 30 Sep 2019 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>Key learnings from React Live in Amsterdam: Theme UI, SVGR, Framer Motion, Ignite, MobX State Tree and Next.js 9.</description>
      <category>react</category>
      <category>conference</category>
      <category>react-native</category>
      <content:encoded><![CDATA[<p>Two weeks ago I attended the React Live conference; it’s one of the biggest React conferences in the Netherlands. Besides being a conference, Passionate People (the event organizers) tried to spice it up by adding live coding to their sessions.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/react-live-the-interactive-conference/01.webp" alt="The conference was hosted at Theater Amsterdam, a tier-A location."/>
<em>The conference was hosted at Theater Amsterdam, a tier-A location.</em></p>
<blockquote>
<p>“Most impressive Conference Venue I have ever been too” — Evan You</p>
</blockquote>
<h2>🔑 Key learnings</h2>
<p>I usually write my conference blogs talk by talk, but since everyone is doing that, it’s quite annoying to read. I collected my key learnings below.</p>
<p><strong>Theme UI</strong><br/>
Build consistent; theme-able React apps based on constraint-based design principles.</p>
<p>This way of working allows you, your product team, and the UI/UX team to be consistent when making changes. You can define a theming object based on the rules that the UI/UX team gives you.</p>
<pre><code class="language-js">export default {
  fonts: {
    body: &#x27;system-ui, sans-serif&#x27;,
    heading: &#x27;&quot;Avenir Next&quot;, sans-serif&#x27;,
    monospace: &#x27;Menlo, monospace&#x27;,
  },
  colors: {
    text: &#x27;#000&#x27;,
    background: &#x27;#fff&#x27;,
    primary: &#x27;#33e&#x27;,
  },
}
</code></pre>
<p>You can later use emotion (a CSS-in-JS library) in your components to read the object that you’ve defined.</p>
<blockquote>
<p>You can also tokenize the above values, so they have a single source of truth.</p>
</blockquote>
<p><a href="https://github.com/system-ui/theme-ui">GitHub - system-ui/theme-ui: Build consistent, themeable React apps based on constraint-based design principles</a></p>
<p><strong>Transform SVGs into React components</strong><br/>
SVGR is an SVG to React transformer. The transformed SVG will be a simple React component that becomes highly configurable. SVGR is available as a module, webpack plugin or via CLI.</p>
<p><a href="https://react-svgr.com/">SVGR - SVGR</a></p>
<p><strong>Framer motion</strong><br/>
As an addition to the SVG part, you can use Framer X’s motion library to power your transformed SVG with fluid cross-device animations.</p>
<p><a href="https://motion.dev/">Motion - JavaScript &amp; React animation library</a></p>
<p><strong>Infinite Red Ignite</strong><br/>
Infinite Red has released a new version of their React Native boilerplate tooling called Ignite. Check it out, it’s incredible!</p>
<p><a href="https://github.com/infinitered/ignite">GitHub - infinitered/ignite</a></p>
<p>Besides Ignite, Infinite Red also offers a tool called ReactorTron: a desktop app for inspecting your React and React Native projects on macOS, Linux, and Windows.</p>
<p><a href="https://github.com/infinitered/reactotron">GitHub - infinitered/reactotron: A desktop app for inspecting your React JS and React Native projects. macOS, Linux, and Windows.</a></p>
<p><strong>Mobx state tree</strong><br/>
An Opinionated, transactional, MobX powered state container. That is combining the best features of the immutable and mutable world for an optimal DX.</p>
<p><a href="https://github.com/mobxjs/mobx-state-tree">mobxjs/mobx-state-tree</a></p>
<p>Besides MobX, Overmind was also mentioned as a proper state container <a href="https://overmindjs.org/?view=react">https://overmindjs.org/</a></p>
<blockquote>
<p>I don’t use MobX, but it was refreshing to see what’s possible</p>
</blockquote>
<p><strong>Next level NextJS 9</strong><br/>
<a href="https://x.com/timneutkens">Tim</a> did a live coding session with Zeit’s product NextJS. It was interesting to see what new features have been added since the time I first tried it (over a year ago). It now has zero-config TypeScript support, file-based dynamic routing, automatic static optimization, and many more features.</p>
<p><a href="https://nextjs.org/blog/next-9">Next.js 9</a></p>
<p><a href="https://www.youtube.com/watch?v=B5bKxxaEsUs"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/react-live-the-interactive-conference/02.webp" alt="Video thumbnail: React Live Conference 2019 - Aftermovie"/></a>
<em>▶ Watch “React Live Conference 2019 - Aftermovie” on YouTube</em></p>
<p><strong>Fun fact:</strong> During the talks, we had WiFi problems, and as you can imagine, that’s not ideal for a live coding conference. 😅 Luckily they managed to fix it rather quickly by providing a UTP cable for the speakers. Shout out to the team!</p>]]></content:encoded>
    </item>
    <item>
      <title>⚡️ Build your own CLI power tool using NodeJS</title>
      <link>https://www.0x1ad2.dev/blog/build-your-own-cli-power-tool-using-nodejs</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/build-your-own-cli-power-tool-using-nodejs</guid>
      <pubDate>Sun, 28 Jul 2019 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>Automate setting up a new machine with a small Node.js CLI that uses Enquirer and Homebrew to install the apps you always need.</description>
      <category>nodejs</category>
      <category>cli</category>
      <category>tutorial</category>
      <content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/build-your-own-cli-power-tool-using-nodejs/01.webp" alt="Banner with a cartoon robot and the title Build your own CLI power tool using NodeJS, with Node.js and Sytac logos"/></p>
<p>Hopefully, some of you can relate to the following problem. You buy yourself a new machine or get a new device from a client to work with. You go to the process of installing, updating, and configuring the device. Even worse when you’re done store your work in a safe place, sign off across the system and format your SSD.</p>
<h2>What are we using</h2>
<p><strong>NodeJS</strong><br/>
NodeJS is a cross-platform JavaScript run-time that executes JavaScript code outside of the browser. NodeJS lets developers use JavaScript to write command-line tools and server-side applications.</p>
<p><strong>Enquirer</strong><br/>
Enquirer is fast, easy to use, and lightweight system to build stylish, intuitive, and user-friendly prompts.<br/>
<a href="https://github.com/enquirer/enquirer">https://github.com/enquirer/enquirer</a></p>
<h2>What are we building</h2>
<p>For this use case, we can make ourselves a powerful command-line interface to automate some of these tasks. Since NodeJS allows us to write and execute code that primarily interacts with the system disk and network, tasks like downloading and installing binaries will become a breeze.</p>
<h2>Setup a new project</h2>
<p>Make sure you’ve got a terminal of choice set up (I use Zsh with oh-my-zsh). Also, get homebrew for Mac so we can fetch binaries and install them via CLI commands.</p>
<p><strong>1.) Create a new directory called “node-power-cli”</strong></p>
<pre><code class="language-sh">$ mkdir ~/Projects/node-power-cli
</code></pre>
<p><strong>2.) Traverse into that directory</strong></p>
<pre><code class="language-sh">$ cd ~/Projects/node-power-cli
</code></pre>
<p><strong>3.) Grab the MIT license and add it to the project</strong></p>
<pre><code class="language-sh">$ npx license mit &gt; LICENSE
</code></pre>
<p><strong>4.) Add a .gitignore file to the project</strong></p>
<pre><code class="language-sh">$ npx gitignore node
</code></pre>
<p><strong>5.) Generate a new package.json file</strong></p>
<pre><code class="language-sh">$ npm init -y
</code></pre>
<p><strong>6.) Create a new file</strong></p>
<pre><code class="language-sh">$ touch power-cli.js
</code></pre>
<p><strong>7.) Allow the file to be executed</strong></p>
<pre><code class="language-sh">$ chmod u+x power-cli.js
</code></pre>
<p><strong>8.) Edit the new file</strong></p>
<pre><code class="language-sh">$ code power-cli.js
</code></pre>
<pre><code class="language-js">#! /usr/bin/env node
// will tell shell enviroment which program it needs execute this, in our case it&#x27;s node
// always run your code in strict mode
&quot;use strict&quot;;

console.log(`My first Node CLI app 🎉`);
</code></pre>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/build-your-own-cli-power-tool-using-nodejs/02.webp" alt="To execute your NodeJS script, you can use the following command $ ./power-cli.js"/>
<em>To execute your NodeJS script, you can use the following command $ ./power-cli.js</em></p>
<blockquote>
<p><em>If you’ve not seen npx before, it searches locally to see if there is a command to run and executes it. If there is no local command, it will try to download, install the command from npm, and run it. This is useful when generating new projects and saves you from globally installing a lot of stuff.</em></p>
</blockquote>
<h2>Add and use Enquirer</h2>
<p><strong>1.) Install Enquirer</strong></p>
<pre><code class="language-sh">$ npm install enquirer --save
</code></pre>
<p><strong>2.) Define your list of frequently used binaries</strong></p>
<pre><code class="language-js">// make a list of frequently used binaries
const frequentlyUsedBinaries = [
  &quot;iterm2&quot;,
  &quot;visual-studio-code&quot;,
  &quot;google-chrome&quot;,
  &quot;zsh&quot;,
  &quot;whatsapp&quot;,
  &quot;spectacle&quot;,
  &quot;spotify&quot;,
  &quot;slack&quot;,
  &quot;github&quot;,
  &quot;node&quot;,
  &quot;grammarly&quot;,
  &quot;figma&quot;
];
</code></pre>
<p><strong>3.) Add multi-select prompt</strong></p>
<pre><code class="language-js">// require the enquirer module
const { MultiSelect } = require(&quot;enquirer&quot;);

// create a new multi select prompt
const multiSelectPrompt = new MultiSelect({
  name: &quot;value&quot;,
  message: &quot;Select all the binaries that you want to install&quot;,
  choices: frequentlyUsedBinaries
});

// run the prompt and handle the answer
multiSelectPrompt
  .run()
  .then(binaries =&gt; {
    console.log(&quot;Selected binaries:&quot;, binaries);
  })
  .catch(console.error);
</code></pre>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/build-your-own-cli-power-tool-using-nodejs/03.webp" alt="To execute your NodeJS script, you can use the following command $ ./power-cli.js"/>
<em>To execute your NodeJS script, you can use the following command $ ./power-cli.js</em></p>
<h2>Execute CLI commands</h2>
<p>Now we get an answer from the multi-select prompt, and we can parse that to a function to generate a command-line string. After that use brew to install all the selected binaries.</p>
<pre><code class="language-js">// require utility tools and child_process exec to execute CLI commands
const util = require(&quot;util&quot;);
const exec = util.promisify(require(&quot;child_process&quot;).exec);

// define a async function execute commands
async function executeCommands(CommandLineString) {
  const { stdout, stderr } = await exec(CommandLineString);
  console.log(&quot;Standard output:&quot;, stdout);
  console.log(&quot;Standard error:&quot;, stderr);
}

// create command line string
function getCommandLIneString(binaries) {
  return binaries
    .map(binary =&gt; {
      return `brew cask install ${binary} &amp;&amp;`;
    })
    .join()
    .replace(/,/g, &quot; &quot;)
    .slice(0, -3);
}

// run the prompt and handle the answer
multiSelectPrompt
  .run()
  .then(binaries =&gt; {
    console.log(&quot;Selected binaries:&quot;, binaries);
    console.log(&quot;Installing them all&quot;);
    executeCommands(getCommandLIneString(binaries));
  })
  .catch(console.error);
</code></pre>
<h2>Run it!</h2>
<p>Now we’re done and we can run the program and see if it works the way we expected.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/build-your-own-cli-power-tool-using-nodejs/04.webp" alt="Select the binaries that you want and hit ENTER"/>
<em>Select the binaries that you want and hit ENTER</em></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/build-your-own-cli-power-tool-using-nodejs/05.webp" alt="Terminal output of power-cli.js installing Grammarly and Firefox through Homebrew casks"/></p>
<p>That’s it. There’s your first “friendly &amp; powerful” command-line tool that you can extend with all the possibilities you’ve got in mind — E.G., a feature that sets your <a href="https://pawelgrzybek.com/change-macos-user-preferences-via-command-line/">default user preferences for macOS</a>.</p>
<p>If you have any questions? Either comment on this story or tweet me at @0x1ad2 If you want to check out the project yourself here’s the <a href="https://github.com/0x1ad2/nodejs-power-tool">Github repository</a>.</p>]]></content:encoded>
    </item>
    <item>
      <title>🇫🇷 React Europe 2018</title>
      <link>https://www.0x1ad2.dev/blog/react-europe-2018</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/react-europe-2018</guid>
      <pubDate>Sun, 20 May 2018 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>Highlights from React Europe 2018: the Context API, new lifecycle methods, Suspense, Apollo, Replicated Redux, CodeSandbox and Lona.</description>
      <category>react</category>
      <category>conference</category>
      <category>graphql</category>
      <content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/react-europe-2018/01.webp" alt="ReactEurope 2018 banner over photos of the conference audience and the Eiffel Tower"/></p>
<p>I visited React Europe with my colleague Peter. The conference hold in France just like the previous years. It allowed us to learn a lot of new things about React, GraphQL, React Native, and Reason. Also, a lot of excellent product releases 💕</p>
<p>Here’s a break down with the things I loved the most</p>
<h2>React</h2>
<p><strong>Keynote</strong></p>
<p>It all started with an all-American 🇺🇸 keynote from <a href="https://medium.com/u/e50c25098d37">Ken Wheeler</a> he told us about The state of React, probably a reference to the American State of the Union, I would vote for Ken as President of the React Community (spreading some love here 💙).</p>
<p><strong>Context API</strong><br/>
Context provides a way to pass data through the component tree without having to pass props down manually at every level. So basically teleporting data between components.</p>
<p>There are two main steps to set up the Context API into your application<br/>
1. add a context provider &amp; define the data you want to store<br/>
2. use a context consumer where ever you need the data from the store</p>
<p>Want a code example? Head over to <a href="https://legacy.reactjs.org/docs/context.html">https://legacy.reactjs.org/docs/context.html</a></p>
<p><strong>New lifecycle methods</strong><br/>
We all know the current component lifecycles (componentWillMount, componentWillReceiveProps, and componentWillUpdate). These also happen to be the lifecycles that cause the most confusion within the React community. For these reasons, Facebook is going to deprecate those methods in favor of better alternatives. Those alternatives would be the following.</p>
<p>1. getDerivedStateFromProps is being added as a safer alternative to the legacy componentWillReceiveProps.</p>
<p>2. getSnapshotBeforeUpdate is being added to support safely reading properties from e.g. the DOM before updates are made.</p>
<p>All the legacy lifecycle methods will be available until react 17 comes around the corner, for then the lifecycle methods will be prefixed by “UNSAFE_” to indicate that they might cause issues.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/react-europe-2018/02.webp" alt="React lifecycle diagram with render, pre-commit and commit phases, including getDerivedStateFromProps and getSnapshotBeforeUpdate"/></p>
<p><strong>Suspense</strong><br/>
And there was React Suspense, it was everywhere, everyone was talking about it Suspense jokes everywhere, even the React Europe cup we got some Suspense stuff on it.</p>
<p>In short: the new feature allows you to defer rendering part of your application tree until some condition is met e.g. loading data from an endpoint or when a resource is loaded.</p>
<p>The mechanism basically works like this as explained by <a href="https://x.com/acdlite">@acdlite</a><br/>
- in the render method, read a value from the cache.<br/>
- if the value is already cached, the render continues like normal<br/>
- if the value is not already cached, the cache *throws a promise*<br/>
- when the promise resolves, React retries where it left off</p>
<p>A good example of suspense would be async placeholders, here’s a code example</p>
<pre><code class="language-jsx">import React, { Fragment } from &quot;react&quot;;

function Placeholder({ delayMs, fallbackUI, children }) {
  return (
    &lt;React.Timeout ms={delayMs}&gt;
      {didTimeout =&gt; {
        return (
          &lt;Fragment&gt;
            &lt;span hidden={didTimeout}&gt;{children}&lt;/span&gt;
            {didTimeout ? fallbackUI : null}
          &lt;/Fragment&gt;
        );
      }}
    &lt;/React.Timeout&gt;
  );
}

export default Placeholder;
</code></pre>
<p>thanks to <a href="https://medium.com/u/c827782c6410">Peggy Rayzis</a>!</p>
<p><a href="https://gist.github.com/peggyrayzis/4c4778e88d9eb71b71b8974836fea044">Placeholder.js on GitHub Gist</a></p>
<p><a href="https://www.youtube.com/watch?v=QFk6YwMz8nc"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/react-europe-2018/03.webp" alt="Video thumbnail: Keynote - @Ken_Wheeler at @ReactEurope 2018"/></a>
<em>▶ Watch “Keynote - @Ken_Wheeler at @ReactEurope 2018” on YouTube</em></p>
<p><strong>The Case for Whimsy</strong><br/>
<a href="https://medium.com/u/a11edf57e20a">Joshua Comeau</a> give an awesome talk about The Case for Whimsy, we usually tend to just craft new features and fix bugs but besides that, we could also build fun things e.g. at Khan Academy, they fill the user’s screen with confetti rain when they get 100% correct on an exercise. That’s pure joy, go make something fun!</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/react-europe-2018/04.webp" alt="Animated illustration of confetti, party hats and champagne bottles"/></p>
<p><a href="https://www.youtube.com/watch?v=Z2d9rw9RwyE"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/react-europe-2018/05.webp" alt="Video thumbnail: The Case for Whimsy - Joshua Comeau aka @joshwcomeau at @ReactEurope 2018"/></a>
<em>▶ Watch “The Case for Whimsy - Joshua Comeau aka @joshwcomeau at @ReactEurope 2018” on YouTube</em></p>
<p><strong>On Apollo</strong><br/>
<a href="https://medium.com/u/c827782c6410">Peggy Rayzis</a> is an Open Source Engineer <a href="https://x.com/apollographql">**@**apollographql</a> the talk was created around the future of Apollo, what’s available right now and what’s the next big thing in the near future.</p>
<p>The new 2.1 version of Appolo now supports Render Props 🎉 a component with a render prop takes a function that returns a React element and calls it instead of implementing its own render logic.</p>
<p>And of course, coming in 2018, Suspense support!</p>
<p><a href="https://www.youtube.com/watch?v=fCXYA3lZTbo"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/react-europe-2018/06.webp" alt="Video thumbnail: A Journey Through React Apollo - Peggy Rayzis aka @peggyrayzis at @ReactEurope 2018"/></a>
<em>▶ Watch “A Journey Through React Apollo - Peggy Rayzis aka @peggyrayzis at @ReactEurope 2018” on YouTube</em></p>
<p><strong>Replicated Redux</strong><br/>
<a href="https://medium.com/u/8e6c73de31a2">Jim Purbrick</a> is doing awesome things in ReactVR on the Oculus team at Facebook. He showed us the potential of Redux for building networked ReactVR applications.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/react-europe-2018/07.webp" alt="Avatars gathered around a colourful board game table in a networked React VR room"/></p>
<p>Redux’s reified events, serializable actions and state, middleware, side effect free functional reducers and time travel superpowers make it well suited for building simple, networked, testable decoupled simulations.</p>
<p><a href="https://www.youtube.com/watch?v=Fr3vp0C22H0"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/react-europe-2018/08.webp" alt="Video thumbnail: Replicated Redux - Jim Purbrick aka @JimPurbrick at @ReactEurope 2018"/></a>
<em>▶ Watch “Replicated Redux - Jim Purbrick aka @JimPurbrick at @ReactEurope 2018” on YouTube</em></p>
<p><strong>A year of CodeSandbox</strong><br/>
<a href="https://medium.com/u/ee6691f0bd65">Ives van Hoorne</a> is the owner of one of the most awesome products currently around, it’s called CodeSandBox, CodeSandbox is an online editor that helps you create web applications, from prototype to deployment.</p>
<p>CodeSandbox recently turned one year old and gave him some valuable insights he’s shared that in his talk ⬇️</p>
<p><a href="https://www.youtube.com/watch?v=qURPenhndYA"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/react-europe-2018/09.webp" alt="Video thumbnail: A year of CodeSandbox - Ives van Hoorne aka @CompuIves at @ReactEurope 2018"/></a>
<em>▶ Watch “A year of CodeSandbox - Ives van Hoorne aka @CompuIves at @ReactEurope 2018” on YouTube</em></p>
<p><strong>Beyond React</strong></p>
<p><a href="https://medium.com/u/cb21631de456">Devin Abbott</a> is a software engineer working at <a href="https://medium.com/u/ebe93072cafd">AirbnbEng</a> he’s currently working on Lona, a perfect fit for a gap that a lot of companies have, a bridge between design and development. Lona is a design tool that allows you to design flexible, compassable component systems and transpile these components into any language on any platform, such as Swift components on iOS, or Kotlin components on Android.</p>
<p><a href="https://www.youtube.com/watch?v=HVwLOcllTfI"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/react-europe-2018/10.webp" alt="Video thumbnail: Beyond React - Devin Abbott aka @dvnabbott at @ReactEurope 2018"/></a>
<em>▶ Watch “Beyond React - Devin Abbott aka @dvnabbott at @ReactEurope 2018” on YouTube</em></p>
<p>Check out the Github repo <a href="https://github.com/Lona/Lona">https://github.com/Lona/Lona</a> this tool is 🔥</p>
<p><strong>And last but not least Bridging React Native Back to its Roots</strong></p>
<p>An epic talk by <a href="https://x.com/vincentriemer">@vincentrimer</a> he’s a software engineer at Symantec he released React Native DOM an experimental, comprehensive port of React Native to the web. It’s multithreaded by default, build with the same bundler and it has the same layout behaviour as React Native on mobile.</p>
<p><a href="https://www.youtube.com/watch?v=aOWIJ4Mgb2k"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/react-europe-2018/11.webp" alt="Video thumbnail: Bridging React Native Back to its Roots - Vincent Riemer  (@vincentriemer) at @ReactEurope 2018"/></a>
<em>▶ Watch “Bridging React Native Back to its Roots - Vincent Riemer  (@vincentriemer) at @ReactEurope 2018” on YouTube</em></p>
<p>Check out the Github repo <a href="https://github.com/vincentriemer/react-native-dom">https://github.com/vincentriemer/react-native-dom</a></p>]]></content:encoded>
    </item>
    <item>
      <title>👨🏻‍💻 GDG DevFest 2017</title>
      <link>https://www.0x1ad2.dev/blog/gdg-devfest-2017</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/gdg-devfest-2017</guid>
      <pubDate>Wed, 22 Nov 2017 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>Notes from GDG DevFest 2017 in Amsterdam: Google's machine learning APIs, an early look at Flutter and real-time data lessons from BUX.</description>
      <category>conference</category>
      <category>google</category>
      <category>flutter</category>
      <content:encoded><![CDATA[<p>Last weekend I visited <a href="https://devfest.nl/">GDG DevFest 2017</a> at the University of Amsterdam. This conference is the biggest Google related event in The Netherlands, carefully crafted by the GDG community!</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/gdg-devfest-2017/01.webp" alt="Credits to @elizacamber"/>
<em>Credits to @elizacamber</em></p>
<p>Usually, the conference is visited by approximately 500 attendees and speakers all over the world, several of these attendees are GDE’s (Google Developer Experts) so there’s a lot to learn 🧠</p>
<p>Every year there are three parallel lecture tracks dedicated to Mobile, Web &amp; Cloud technologies.</p>
<h2>Machine Learning APIs and how to get the most of it</h2>
<p>In this session, we dived into what the different Google Cloud Machine Learning APIs can do. We combined various solutions to get an interesting results and they even released a new feature called <a href="https://cloud.google.com/speech/docs/basics#time-offsets">Google speech API timestamps</a></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/gdg-devfest-2017/02.webp" alt="Collage of a Google Cloud machine learning talk, a slide on two ways to benefit from ML and the GDG DevFest Netherlands banner"/></p>
<h2>Creating your first flutter app</h2>
<p><a href="https://flutter.dev/">Flutter</a> is a new cross-platform SDK from Google to create Android and iOS apps with a single-codebase written in Dart.</p>
<p>It allows fast development through a feature we already knew from React Native called hot reload. Hot reload helps you quickly and easily experiment, build UIs, add features, and fix bug faster.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/gdg-devfest-2017/03.webp" alt="Collage of the “Creating your first flutter app” talk, a code slide and the audience"/></p>
<p>Flutter has built-in beautiful Material Design and Cupertino (iOS-flavor) widgets, rich motion APIs, smooth natural scrolling, and platform awareness to delivery the best experience to the client.</p>
<p>It also allows access to native features and SDKs</p>
<blockquote>
<p>⚠ ️<strong>Be aware of the fact that flutter is still in ALPHA</strong></p>
</blockquote>
<h2>Designing a real-time data application: a case study on the stock market</h2>
<p>Applications that require data from real-time events impose their own challenges. How to store data? Can you cache data at all? How to make sure data that is constantly changing is consistent throughout the app?</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/gdg-devfest-2017/04.webp" alt="Collage of the BUX talk “Designing a real-time data application: a case study on the stock market” and its slide on how trades are matched"/></p>
<p>The guys at BUX have quite a lot experience with this and where happy to share their best practices. I think the main lesson for me was:</p>
<blockquote>
<p>If a technology works (has proven itself) stick with it but do not be afraid to experiment with upcoming technologies.</p>
</blockquote>
<p>They just completed a <a href="https://press.getbux.com/160170-next-generation-trading-app-bux-completes-10-6-million-funding-round/">€10.6 million funding round</a> so I think you’ll see them around.</p>
<p>Altogether I had an amazing day! Attended serval cool talks, met new and old friends and was able to write some code in between. See you next year!</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/gdg-devfest-2017/05.webp" alt="Collage of a laptop with code open, a sandwich lunch and the GDG DevFest Netherlands banner"/></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/gdg-devfest-2017/06.webp" alt="Douglas Adams quote “I may not have gone where I intended to go, but I think I have ended up where I needed to be” above DevFest swag: a fidget spinner, a notebook and an Android sticker"/></p>]]></content:encoded>
    </item>
    <item>
      <title>🔥 Firebase Dev Summit 2017</title>
      <link>https://www.0x1ad2.dev/blog/firebase-dev-summit-2017</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/firebase-dev-summit-2017</guid>
      <pubDate>Tue, 31 Oct 2017 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>What Google showed at the Firebase Dev Summit 2017 in Amsterdam, from Crashlytics and Predictions to Cloud Firestore.</description>
      <category>conference</category>
      <category>firebase</category>
      <category>google</category>
      <content:encoded><![CDATA[<p>Today I visited the Firebase Dev Summit in Amsterdam 🇳🇱 This summit showcased the latest product releases and features. We learned how Firebase helps to solve key infrastructure &amp; growth challenges that the industry faces.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/firebase-dev-summit-2017/01.webp" alt="The Muziekgebouw aan &#x27;t IJ and Bimhuis venue on the Amsterdam waterfront"/></p>
<h2>Huh, Firebase Dev Summit?</h2>
<p>The Firebase Dev Summit is an annual event held by Google. Every year a country is selected to host the summit and the event is mostly based around Firebase.</p>
<p>Since Firebase isn’t just a <a href="https://techcrunch.com/2014/10/21/google-acquires-firebase-to-help-developers-build-better-realtime-apps/">real-time database</a> anymore but a platform that helps developers build, analyze and grow there is a lot of awesome knowledge that could be shared.</p>
<h2>What’s new in Firebase?</h2>
<p>Basically, Google integrated <a href="https://firebase.google.com/docs/crashlytics/">Crashlytics</a> into Firebase, enabled <a href="https://firebase.google.com/docs/ab-testing/abtest-with-console">first-class A/B support</a> and take their first step in bringing the power of Machine Learning 🤖 into Firebase with a new product called <a href="https://firebase.google.com/products/predictions/">Predictions</a>.</p>
<blockquote>
<p>Predictions automatically create dynamic user groups based on predicted behaviour from your analytics, you can use these predictions i.e. to send users who are about to churn in the next 7 days a customised notification</p>
</blockquote>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/firebase-dev-summit-2017/02.webp" alt="Firebase Predictions illustration: players grouped by predicted behaviour, with those about to churn offered three extra lives"/></p>
<p>They are also working hard to prepare for the General Data Protection Regulation (<a href="https://en.wikipedia.org/wiki/General_Data_Protection_Regulation">GDPR</a>) across Firebase and they are committed to helping us (developers) succeed under it.</p>
<h2>Talks, talks, talks!</h2>
<p>I’ve tried to attend the talks that were most aligned with my day to day job as a front-end web developer. And to sum it up, the most exciting feature for me is…<a href="https://firebase.google.com/docs/firestore/">Cloud Firestore</a>! 🎉</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/firebase-dev-summit-2017/03.webp" alt="Cloud Firestore diagram of phones, tablets and laptops syncing a shared list through the cloud"/></p>
<p>A fully-managed NoSQL document database for mobile and web app development. It operates using documents and collections as a data model.</p>
<p>It allows for expressive queries. Queries scale with the size of your result set, not the size of your data set.</p>
<p>So you’ll get the same performance fetching 1 result from a set of 100, or 100,000,000</p>
<p>Firestore syncs data between devices, enables offline data access through an on-device database and they provide SDK’s for Node, Python, Go, and Java.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/firebase-dev-summit-2017/04.webp" alt="Firebase Dev Summit 2017 attendee badge next to a cup of coffee"/></p>
<p>I had an amazing day!</p>
<p>Did meet some new people, a couple I already knew, and some I used to work with in the past.</p>
<blockquote>
<p>The food was delicious, the venue was perfect and it had all the features I think a conference needs to be able to offer their attendees.</p>
</blockquote>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/firebase-dev-summit-2017/05.webp" alt="Collage of the keynote stage at Firebase Dev Summit 2017 and slides about building and growing apps"/></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/firebase-dev-summit-2017/06.webp" alt="Collage of speakers on stage, a code slide and the audience at Firebase Dev Summit"/></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/firebase-dev-summit-2017/07.webp" alt="Collage of a talk building an app with Cloud Storage, Authentication and Cloud Firestore, including live coding"/></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/firebase-dev-summit-2017/08.webp" alt="Collage of a fastlane talk asking “How would you like 2 extra hours every week?” next to a list of release-day excuses"/></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/firebase-dev-summit-2017/09.webp" alt="Collage of a serverless talk showing an app with client SDKs talking directly to Cloud Firestore"/></p>]]></content:encoded>
    </item>
    <item>
      <title>🦑 Simplify testing your local environment on physical devices by using Squid</title>
      <link>https://www.0x1ad2.dev/blog/test-local-environments-on-physical-devices-with-squid</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/test-local-environments-on-physical-devices-with-squid</guid>
      <pubDate>Wed, 20 Sep 2017 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>Route a phone's traffic through SquidMan on your Mac so cookies, headers and hosts-file entries keep working when you test on real devices.</description>
      <category>testing</category>
      <category>mobile</category>
      <category>devtools</category>
      <content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/test-local-environments-on-physical-devices-with-squid/01.webp" alt="Banner with a pink octopus: Simplify testing your local environment on physical devices by using Squid"/></p>
<p>Big companies use a lot of <a href="https://en.wikipedia.org/wiki/HTTP_cookie">HTTP cookie</a>s 🍪 to store all the information you need to interact with the application in a proper way. Besides using cookies there are other things to take care of like setting HTTP request headers or tweak your application to fix HTTP access control issues.</p>
<p>If you are working on your local machine and have setup all these things everything works well but when you need to test it outside of this machine i.e. on a physical Android or iOS device it’s a hard to get it all working.</p>
<p>Here’s where squid comes in</p>
<p><a href="http://www.squid-cache.org/Intro/">squid : Optimising Web Delivery</a></p>
<p>Basically, squid allows you to forward all your device requests through your machine so everything you’ve set stays set.</p>
<blockquote>
<p>Squid is a fully-featured HTTP/1.0 proxy which is almost (but not quite — we’re getting there!) a fully-featured HTTP/1.1 proxy. Squid offers a rich access control, authorization and logging environment to develop web proxy and content serving applications.</p>
</blockquote>
<h2>How to install it?</h2>
<p>I would recommend using SquidMan for configuring and running, SquidMan is a graphical installer and manager for the Squid proxy cache.</p>
<p>You can install SquidMan trough a brew <a href="https://github.com/Homebrew/homebrew-cask/blob/main/Casks/s/squidman.rb">cask</a></p>
<pre><code class="language-sh">$ brew cask install squidman
</code></pre>
<h2>Configure squid to use your OS host file</h2>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/test-local-environments-on-physical-devices-with-squid/02.webp" alt="SquidMan 3.8 window showing “Squid is not running” and a Start Squid button"/></p>
<p>When you launch SquidMan you would see the following window, go to <strong>SquidMan</strong> &gt; <strong>Preferences</strong> to configure it.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/test-local-environments-on-physical-devices-with-squid/03.webp" alt="SquidMan General preferences with the HTTP port set to 7777"/></p>
<p>Once there go to <strong>General</strong> and change the port a less used one i.e. <strong>7777</strong>.<br/>
After that go to template and add the following, if not already set.</p>
<pre><code class="language-sh">#host file
hosts_file /etc/hosts
</code></pre>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/test-local-environments-on-physical-devices-with-squid/04.webp" alt="SquidMan Template preferences with hosts_file /etc/hosts added at the end of the Squid configuration"/></p>
<p>This means that SquidMan would use your local machine it’s <strong>hosts(file)</strong> to route the traffic trough.</p>
<p>Now press the <strong>save</strong> button and <strong>start</strong> SquidMan to use it.</p>
<h2>Configure squid on your iPhone to forward traffic</h2>
<p>Unlock your phone, go to Wifi networks (make sure you are on the same network as your machine) and press the <strong>( i )</strong> icon next to the network. This will open up network settings.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/test-local-environments-on-physical-devices-with-squid/05.webp" alt="iPhone Wi-Fi network details with the HTTP proxy currently set to Off"/></p>
<p>Click on configure proxy <strong>Manual</strong> and configure based upon your SquidMan settings.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/test-local-environments-on-physical-devices-with-squid/06.webp" alt="iPhone Configure Proxy screen set to Manual with server 10.0.30.189 and port 7777"/></p>
<h2>Configure squid on your Android phone to forward traffic</h2>
<p>Unlock your phone, go to <strong>Connections</strong> (make sure you are on the same network as your machine) and long-press the SSID (network name).</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/test-local-environments-on-physical-devices-with-squid/07.webp" alt="Android Connections settings with Wi-Fi turned on"/></p>
<p>This will open up a pop-up, click on <strong>Manage network settings</strong>.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/test-local-environments-on-physical-devices-with-squid/08.webp" alt="Android Wi-Fi list with a long-press menu offering Forget network, Manage network settings and Write to NFC tag"/></p>
<p>Another screen pops-up.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/test-local-environments-on-physical-devices-with-squid/09.webp" alt="Android network dialog with advanced options shown, proxy set to Manual, host 10.0.30.189 and port 7777"/></p>
<p>Click on <strong>show advanced options</strong>, proxy <strong>Manual</strong> and configure based upon your SquidMan settings.</p>
<p>Press save and you’re done you can now visit your <a href="http://local-development-url.host">http://local-development-url.host</a> on your mobile device through a proxy on your local machine. 🙌🏼 🚀</p>]]></content:encoded>
    </item>
    <item>
      <title>💎 Visual Studio Code treasures</title>
      <link>https://www.0x1ad2.dev/blog/visual-studio-code-treasures</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/visual-studio-code-treasures</guid>
      <pubDate>Mon, 17 Jul 2017 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>A list of Visual Studio Code extensions I can't live without, from Prettier and Quokka to GitLens and Import Cost.</description>
      <category>vscode</category>
      <category>devtools</category>
      <content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/visual-studio-code-treasures/01.webp" alt="Visual Studio Code Treasures title card with a treasure chest full of gems"/></p>
<p>It has almost been a year since I published my story about <a href="https://www.freecodecamp.org/news/atom-treasures-82a64ac391c">Atom the hackable text editor</a> from our friends at <a href="https://medium.com/u/8df3bf3c40ae">GitHub</a> here’s my take on VS Code 👇🏼</p>
<blockquote>
<p><a href="https://x.com/Microsoft">@Microsoft</a> did an exceptional job by creating a super performant and flexible editor. There’s a big community behind it and it’s constantly improving. Besides flexibility and performance, it also offers IntelliSense, interactive debugging and build-in GIT commands.</p>
</blockquote>
<p>If you haven’t switched yet, give it a try and let me know what you think about it.</p>
<p><a href="https://code.visualstudio.com/">Visual Studio Code</a></p>
<h2>How to install extensions?</h2>
<p>Installing extensions in Visual Studio Code is a breeze! Launch Visual Studio Code Quick Open with Ctrl+P (⌘P) and paste the extension installation command in there: <code>ext install prettier-vscode</code></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/visual-studio-code-treasures/02.webp" alt="Another thing you can do is open the extensions marketplace by clicking on the extension icon in Visual Studio Code"/>
<em>Another thing you can do is open the extensions marketplace by clicking on the extension icon in Visual Studio Code</em></p>
<h2>The list</h2>
<h3>Prettier</h3>
<p>This extension enables you to use Prettier in your projects.</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode">Prettier - Code formatter - Visual Studio Marketplace</a></p>
<p>Prettier is an opinionated code formatter with support for: JavaScript, (including ES2017) JSX, Flow, TypeScript, CSS, LESS, SCSS, JSON and GraphQL</p>
<p>You can learn more about prettier by watching this React Conf video.</p>
<p><a href="https://www.youtube.com/watch?v=hkfBvpEfWdA"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/visual-studio-code-treasures/03.webp" alt="Video thumbnail: ⚡️ - James Long - A Prettier Printer (plus bonus clip!) - React Conf 2017"/></a>
<em>▶ Watch “⚡️ - James Long - A Prettier Printer (plus bonus clip!) - React Conf 2017” on YouTube</em></p>
<h3>Quokka</h3>
<p>This extension enables you to use Quokka.js in your projects.</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=WallabyJs.quokka-vscode">Quokka.js - Visual Studio Marketplace</a></p>
<p><a href="https://quokkajs.com">Quokka.js</a> is a rapid prototyping playground for JavaScript and TypeScript. It runs your code immediately as you type and displays various execution results in your code editor.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/visual-studio-code-treasures/04.gif" alt="Quokka.js showing the value of a JavaScript object inline as it is typed"/></p>
<p>Use command Start on current file from the quokka.js command list or press Ctrl+K(⌘K)</p>
<h3>Import Cost</h3>
<p>This extension enables you to display import/require package size inside the file you are working in.</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=wix.vscode-import-cost">Import Cost - Visual Studio Marketplace</a></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/visual-studio-code-treasures/05.webp" alt="Import Cost showing the size of each imported package next to its import line"/></p>
<h3>ESLint</h3>
<p>This extension enables you to use ESLint. ESLint is an open source JavaScript linting utility originally created by Nicholas C. Zakas in June 2013. Code <a href="https://en.wikipedia.org/wiki/Lint_(software)">linting</a> is a type of static analysis that is frequently used to find problematic patterns or code that doesn’t adhere to certain style guidelines. There are code linters for most programming languages, and compilers sometimes incorporate linting into the compilation process.</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint">ESLint - Visual Studio Marketplace</a></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/visual-studio-code-treasures/06.webp" alt="ESLint problems panel in VS Code listing lint errors for the open files"/></p>
<h3>Markdown all in one</h3>
<p>This extension enables you to have keyboard shortcuts (toggle bold, italic, code span and heading), a table of contents generator, automatically show preview, list editing and much more.</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one">Markdown All in One - Visual Studio Marketplace</a></p>
<blockquote>
<p>Because we all ❤ Markdown, don’t we?</p>
</blockquote>
<h3>Project manager</h3>
<p>This extension allows you to manage multiple projects inside visual studio code, the projects are listed in a projects.json that gives you full control over names and paths</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=alefragnani.project-manager">Project Manager - Visual Studio Marketplace</a></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/visual-studio-code-treasures/07.webp" alt="Command palette filtered to Project Manager commands to edit, list, refresh and save projects"/></p>
<h3>Regex previewer</h3>
<p>This extension enables you to validate your regular expressions in real-time.</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=chrmarti.regex">Regex Previewer - Visual Studio Marketplace</a></p>
<p>Shows the current regular expression matches in a side-by-side document. This can be turned on/off with Ctrl+Alt+M (⌥⌘M).</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/visual-studio-code-treasures/08.gif" alt="Regex Previewer highlighting matches of an email regular expression in a side-by-side sample file"/></p>
<h3>Settings sync</h3>
<p>This extension enables you to synchronize: settings, snippets, themes, file icons, key bindings, workspaces and extensions across multiple machines using <a href="https://gist.github.com/">GitHub gist</a>.</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync">Settings Sync - Visual Studio Marketplace</a></p>
<p>It basically does the same as <a href="https://atom.io/packages/sync-settings">sync-settings</a> did in Atom</p>
<h3>Auto close tag</h3>
<p>This extension allows you to automatically add HTML/XML close tag, same as Visual Studio IDE or Sublime Text does.</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=formulahendry.auto-close-tag">Auto Close Tag - Visual Studio Marketplace</a></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/visual-studio-code-treasures/09.webp" alt="Auto Close Tag adding the closing HTML tag while typing in test.html"/></p>
<h3>Path intellisense</h3>
<p>This extension enables auto completion of file paths in your HTML tags.</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=christian-kohler.path-intellisense">Path Intellisense - Visual Studio Marketplace</a></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/visual-studio-code-treasures/10.gif" alt="Path Intellisense suggesting file paths while editing an HTML file in a small project"/></p>
<h3>Auto rename tag</h3>
<p>This extension allows you to automatically rename paired HTML/XML tag.</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=formulahendry.auto-rename-tag">Auto Rename Tag - Visual Studio Marketplace</a></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/visual-studio-code-treasures/11.gif" alt="Auto Rename Tag renaming the matching closing tag as an opening HTML tag is edited"/></p>
<h3>Change case</h3>
<p>This extension enables you to quickly change the case of the current selection or current word, you can change the cases to camelCase, CONSTANT_CASE, snake_case, kebab-case, etc.</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=wmaurer.change-case">change-case - Visual Studio Marketplace</a></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/visual-studio-code-treasures/12.webp" alt="Change Case converting selected identifiers in a TypeScript file between casings"/></p>
<h3>Stylelint</h3>
<p>This extension enables you to use Stylelint in your project, Styelint is a modern CSS linter and fixer that helps you avoid errors and enforce consistent conventions in your stylesheets.</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint">stylelint - Visual Studio Marketplace</a></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/visual-studio-code-treasures/13.webp" alt="Stylelint warnings for a CSS rule with a universal selector, an unspaced calc operator and trailing zeros"/></p>
<blockquote>
<p>Don’t forget to add a .stylelintrc config file to your project root. <a href="https://stylelint.io/user-guide/configure/">https://stylelint.io/user-guide/configure/</a></p>
</blockquote>
<h3>Git Lens</h3>
<p>This extension <strong>supercharges</strong> the built-in Visual Studio Code Git capabilities. It helps you to <strong>visualize code authorship</strong> at a glance via Git blame annotations and code lens, <strong>seamlessly navigate and explore</strong> the history of a file or branch, <strong>gain valuable insights</strong> via powerful comparison commands, and so much more.</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens">GitLens - Git supercharged - Visual Studio Marketplace</a></p>
<h3>TODO Highlight</h3>
<p>This extension allows you to highlight TODOs, FIXMEs, and any keywords, annotations.</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=wayou.vscode-todo-highlight">TODO Highlight - Visual Studio Marketplace</a></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/visual-studio-code-treasures/14.webp" alt="TODO Highlight colouring TODO and FIXME comments in a JavaScript file"/></p>
<h3>SVG Viewer</h3>
<p>This extension enables you to view SVG’s on the fly, just right click the file and view.</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=cssho.vscode-svgviewer">SVG Viewer - Visual Studio Marketplace</a></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/visual-studio-code-treasures/15.gif" alt="SVG Viewer previewing an SVG file opened from the VS Code explorer"/></p>
<h2>Extra</h2>
<h3>Color Info</h3>
<p>This extension enables you to view color information specifics on a color entry in CSS.</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=bierner.color-info">Color Info - Visual Studio Marketplace</a></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/visual-studio-code-treasures/16.webp" alt="Color Info hover showing a colour swatch with its RGB, HSL, CMYK, hex and alpha values"/></p>
<h3>VScode icons</h3>
<p>This extension enables you to have specific file icons for almost every extension. By default Visual Studio Code now uses seti as icon pack, this is why I didn’t list VScode icons in the main list.</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=vscode-icons-team.vscode-icons">vscode-icons - Visual Studio Marketplace</a></p>
<p>You can see it in action here</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/visual-studio-code-treasures/17.gif" alt="vscode-icons giving each file type its own icon in the VS Code explorer"/></p>
<h3>VS Code Spotify</h3>
<p>This extensions allows you to use Spotify inside Visual Studio Code.</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=shyykoserhiy.vscode-spotify">vscode-spotify - Visual Studio Marketplace</a></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/visual-studio-code-treasures/18.webp" alt="VS Code status bar with vscode-spotify playback controls and the current track"/></p>
<h3>Calculate</h3>
<p>This extension allows you to do evaluate your math.</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=acarreiro.calculate">Calculate - Visual Studio Marketplace</a></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/visual-studio-code-treasures/19.gif" alt="Calculate evaluating sums like 1+1 and 5^5 in an untitled file"/></p>
<h3>Insert Numbers</h3>
<p>This extension allows you to insert incrementing/decrementing numbers with a custom starting point.</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=Asuka.insertnumbers">Insert Numbers - Visual Studio Marketplace</a></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/visual-studio-code-treasures/20.webp" alt="Insert Numbers adding incrementing numbers at several cursors in a C struct"/></p>
<h2>Did I miss something powerful? ⚡</h2>
<p>If there’s a good extension available that’s not listed, please let me know in the comments. I tried to create a list of extensions that fit well into the generic workflow of a web developer. I might do a write up on specifics if requested, there are pretty powerful extensions out there if you are an Angular or React developer.</p>]]></content:encoded>
    </item>
    <item>
      <title>🔦 How to create a PWA with a 90+ score in Google Lighthouse using Ionic 2</title>
      <link>https://www.0x1ad2.dev/blog/pwa-with-a-90-lighthouse-score-using-ionic-2</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/pwa-with-a-90-lighthouse-score-using-ionic-2</guid>
      <pubDate>Wed, 22 Mar 2017 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>How I built an Ionic 2 Progressive Web App that scores 99 in Google Lighthouse, from enabling the service worker to Firebase Hosting.</description>
      <category>pwa</category>
      <category>ionic</category>
      <category>performance</category>
      <category>firebase</category>
      <content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/pwa-with-a-90-lighthouse-score-using-ionic-2/01.webp" alt="Lighthouse on a rocky coastline under a blue sky"/></p>
<p>I just created a <a href="https://web.dev/explore/progressive-web-apps">Progressive Web App</a> that scores 99 out of 100 in the <a href="https://developer.chrome.com/docs/lighthouse/overview/">Lighthouse</a> auditing report. I used <a href="https://ionicframework.com/">Ionic 2</a> (<a href="https://angular.dev/">Angular</a>) to get the results I wanted, here’s how I did it:</p>
<h2>Install Ionic globally</h2>
<p>To use the Ionic CLI we fist need to install Ionic globally.</p>
<pre><code class="language-sh">$ sudo npm install -g ionic cordova
</code></pre>
<h2>Create a new blank Ionic 2 project</h2>
<p>After that we can make a new Ionic 2 project by executing the following command using the Ionic CLI.</p>
<pre><code class="language-sh">$ ionic start MyPWA blank — v2
</code></pre>
<h2>Serve the application</h2>
<p>Execute the ionic serve command to serve the application in your browser. Serving the application in the browser automatically creates a web based build of your Ionic project.</p>
<pre><code class="language-sh">$ ionic serve
</code></pre>
<h2>Install Lighthouse for Google Chrome</h2>
<p><a href="https://chromewebstore.google.com/detail/lighthouse/blipmdconlkpinefehnmjammfjpmpbjk">Click here</a> and install Lighthouse. After installation and icon will appear.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/pwa-with-a-90-lighthouse-score-using-ionic-2/02.webp" alt="Google Lighthouse logo: a striped lighthouse under a starry night sky"/></p>
<h2>Run Lighthouse to generate a report</h2>
<p>If you click on the Lighthouse icon it will do some tests and generate a report.</p>
<blockquote>
<p>You need to close Chrome Developer tools to be able to run the test.</p>
</blockquote>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/pwa-with-a-90-lighthouse-score-using-ionic-2/03.webp" alt="First Lighthouse report scoring the Ionic app 60 out of 100, failing offline support, load performance and progressive enhancement"/></p>
<h2>Optimize 📈</h2>
<h3>1. App can load on offline/flaky connections</h3>
<p>Ensuring your web app can respond when the network connection is unavailable or flaky is critical to providing your users a good experience. This is achieved through the use of a <a href="https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API">Service Worker</a>.</p>
<p>You can enable the Service Worker in Ionic by un-commenting the Service Worker part in the <strong>index.html</strong></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/pwa-with-a-90-lighthouse-score-using-ionic-2/04.webp" alt="Commented-out service worker registration script in Ionic&#x27;s index.html"/></p>
<p>After enabling you automatically resolve the Service Worker fail under <strong>User can be prompted to Add to Homescreen</strong></p>
<h3>2. Site is progressively enhanced</h3>
<p>Progressive enhancement means that everyone can access the basic content and functionality of a page in any browser, and those without certain browser features may receive a reduced but still functional experience.</p>
<p>We’re going to add some code to our <strong>index.html</strong> file to let the user know that they need to enable JavaScript to get the full experience. Ionic wouldn’t be able to provide a functional experience without using JavaScript.</p>
<pre><code class="language-html">&lt;noscript&gt;
  &lt;h1&gt;You don’t have javascript enabled.&lt;/h1&gt;
  &lt;p&gt;Please enable it to get the full experience.&lt;/p&gt;
&lt;/noscript&gt;
</code></pre>
<h3>4. Page load performance is fast</h3>
<p>Users notice if sites and apps don’t perform well and that will give them a bad experience. To pass this point in the report let’s make a production build using Ionic CLI’s build command and the — prod flag.</p>
<pre><code class="language-sh">$ ionic build — prod
</code></pre>
<h2>Create a secure hosting environment using Firebase 🔥</h2>
<p>Head to <a href="https://firebase.google.com">Firebase</a> and create an account. Once your account has been created go to the <a href="https://console.firebase.google.com/">Firebase console</a> to create a new project.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/pwa-with-a-90-lighthouse-score-using-ionic-2/05.webp" alt="Firebase console Create a project dialog with the project name MyPWA and region Netherlands"/></p>
<p>That’s it you’ve created your first Firebase project 🎉</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/pwa-with-a-90-lighthouse-score-using-ionic-2/06.webp" alt="Firebase console overview of the new MyPWA project with options to add Firebase to iOS, Android and web apps"/></p>
<p>As you’ve might have noticed Firebase includes a lot of features from analytics, to cloud messaging to hosting. We are going to use the last one to host our PWA in a secure environment.</p>
<h2>Deploy 📦</h2>
<p>We can deploy to Firebase by using the Firebase CLI login, init &amp; deploy commands. First, you need to login into your Firebase account (a web browser will pop-up).</p>
<pre><code class="language-sh">$ firebase login
</code></pre>
<p>After that traverse to the right directory and execute Firebase init, select hosting and select the project we’ve created above.</p>
<pre><code class="language-sh">$ firebase init
</code></pre>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/pwa-with-a-90-lighthouse-score-using-ionic-2/07.webp" alt="Terminal running firebase init and asking which Firebase features to set up"/></p>
<p>Set the <strong>www</strong> folder as default</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/pwa-with-a-90-lighthouse-score-using-ionic-2/08.webp" alt="firebase init Hosting setup asking for the public directory, answered with www"/></p>
<p>After initializing the project we can simply deploy the application to Firebase by executing.</p>
<pre><code class="language-sh">$ firebase deploy
</code></pre>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/pwa-with-a-90-lighthouse-score-using-ionic-2/09.webp" alt="Terminal output of firebase deploy uploading 33 files from www and printing the hosting URL"/></p>
<p>That’s it we’ve deployed our package 👍🏻</p>
<h2>Run Lighthouse (again) to generate a report</h2>
<p>Click on the lighthouse icon when in your Firebase environment, again it will do some tests and generate a report. This time, and most of the times it will generate a 90+ score.</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/pwa-with-a-90-lighthouse-score-using-ionic-2/10.webp" alt="Lighthouse report scoring the deployed PWA 99 out of 100 with every progressive web app audit passing"/></p>
<h2>100 out of 100?</h2>
<p>If you want to get a perfect score you should need to optimize more. Due to the way Ionic was build the <a href="https://developer.chrome.com/docs/lighthouse/performance/first-meaningful-paint">first meaningful paint</a>, <a href="https://developer.chrome.com/docs/lighthouse/performance/speed-index">perceptual speed index</a>, <a href="https://developer.chrome.com/docs/lighthouse/performance/interactive">time to interactive</a> are higher than recommended. In my opinion, this wouldn’t be an issue but there’s always room for improvement.</p>
<p>We can measure our application by applying the <a href="https://web.dev/articles/rail">RAIL method</a>. RAIL is a user-centric performance model. Every web app has these four distinct aspects to its life cycle, and performance fits into them in different ways:</p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/pwa-with-a-90-lighthouse-score-using-ionic-2/11.webp" alt="The RAIL performance model: Response, Animation, Idle and Load"/></p>
<p>There a couple of ways to improve the performance, the two main parts would be <a href="https://web.dev/articles/performance-optimizing-content-efficiency">Optimizing Content Efficiency</a> &amp; adjusting the <a href="https://web.dev/articles/critical-rendering-path">Critical Rendering Path</a></p>
<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/pwa-with-a-90-lighthouse-score-using-ionic-2/12.webp" alt="Diagram comparing optimized progressive rendering, which shows content from 0.3 seconds, with unoptimized rendering that stays blank until 1.5 seconds"/></p>]]></content:encoded>
    </item>
    <item>
      <title>Fingerprint end-to-end encryption</title>
      <link>https://www.0x1ad2.dev/blog/fingerprint-end-to-end-encryption</link>
      <guid isPermaLink="true">https://www.0x1ad2.dev/blog/fingerprint-end-to-end-encryption</guid>
      <pubDate>Fri, 19 Aug 2016 00:00:00 GMT</pubDate>
      <dc:creator>Dennis Bruijn</dc:creator>
      <description>Improved endpoint security using FE2EE: an idea for requiring a fingerprint scan before you can read end-to-end encrypted messages.</description>
      <category>security</category>
      <category>encryption</category>
      <content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/fingerprint-end-to-end-encryption/01.webp" alt="Green title card with a fingerprint: Fingerprint end-to-end encryption, improved endpoint security using FE2EE"/></p>
<h2>🔑 What is E2EE?</h2>
<p>According to Wikipedia End-to-end encryption (E2EE) is a system of communication where only the communicating users can read the messages. In principle, it prevents potential eavesdroppers — including telecom providers, Internet providers, and even the provider of the communication service — from being able to access the cryptographic keys needed to decrypt the conversation.</p>
<p><a href="https://www.wired.com/2016/05/allo-duo-google-finally-encrypts-conversations-end-end/"><img loading="lazy" decoding="async" src="https://www.0x1ad2.dev/images/blog/fingerprint-end-to-end-encryption/02.webp" alt="https://www.wired.com/2016/05/allo-duo-google-finally-encrypts-conversations-end-end/"/></a>
<em><a href="https://www.wired.com/2016/05/allo-duo-google-finally-encrypts-conversations-end-end/">https://www.wired.com/2016/05/allo-duo-google-finally-encrypts-conversations-end-end/</a></em></p>
<h2>💡 What is FE2EE?</h2>
<p>FE2EE stands for <strong>Fingerprint end-to-end encryption</strong> It’s just a made up term based on my idea on how we could improve end-to-end encryption or at least the authentication around end-to-end encryption.</p>
<p><strong>In a nutshell:</strong> applications should allow users to switch on FE2EE. After that, a fingerprint scan is required to authenticate that the receiver is the owner of the device and thus is authorized to read the contents of that message.</p>
<h2>🛠 A good way to implement FE2EE?</h2>
<p>Existing applications should be able to keep their current E2EE techniques/features the fingerprint only adds a level of authentication. And must be enabled throughout the settings panel of the application (so you can opt-in if you want).</p>
<p>After the authenticity of the user is validated. The user should have the possibility to edit the level of (re)authentication. I can imagine a user would just want to receive an authentication request on app start or maybe before each message.</p>
<p><em><strong>Note:</strong></em> <em>This is just an idea on how to implement it if you think there’s a better/safer/easier way, please share it.</em></p>
<h2>📱 How could FE2EE be used on my phone?</h2>
<p>Some iOS and Android devices can do fingerprint scans (a biometric scanner module on your device is required). It allows the devices to perform the most secure security check to date.</p>
<p><em><strong>Note:</strong></em> <em>Although fingerprint scanning has already be hacked a couple of times by the</em> <a href="https://www.ccc.de/en/updates/2014/ursel"><em>Chaos Computer Club</em></a> <em>it’s still much safer than a passcode or pattern.</em></p>
<h2>✏️ Share you toughts</h2>
<p>Please share your toughs below, tweet me or send me an email. Also if you have some constructive feedback on my writings please, reach out to me.</p>]]></content:encoded>
    </item>
  </channel>
</rss>
