← Selected Work

Cry Tracker

Log a cry in one tap — size, mood, triggers — and turn it into mood breakdowns, size distributions, and streaks.

Svelte 5TypeScriptHonoCloudflare WorkersCloudflare D1

Problem

I wanted a small personal tracker: one tap to log a cry, then enough structure to see a pattern. How big was it, happy or sad, what set it off, an occasional note. The data entry was never the point — the payoff was the mood breakdown, the size distribution, the recurring triggers, the streak.

It only ever needs to serve one person. So the real constraint was keeping it tiny and cheap to run, while still being a real app — authenticated, persistent, deployed — not a toy stuck in localStorage.

Logging a cry — pick a size, a valence, and one or more triggers

Approach

An npm-workspaces monorepo, two halves: a Svelte 5 SPA for the UI, a Hono API on Cloudflare Workers backed by Cloudflare D1 for everything else. The SPA ships as a static bundle. All state lives in D1 behind the Worker; the browser only keeps a bearer token.

  • PIN gate, not accounts. One user means auth can just be a numeric PIN, exchanged for a session token, rate-limited per IP (5 attempts / 15 min) via an auth_attempts table. The PIN lives in a Worker secret, never in committed source — tests use their own fixed test-only PIN.
  • Data the app can reshape. Sizes, valences, triggers — the selectable labels aren't hardcoded enums. They live in a config table, editable in Settings. The app's vocabulary is data.
  • Stats as the product. The cries table is flat, no foreign keys, on purpose — it keeps the aggregation queries (mood split, size distribution, trigger frequency, streaks) simple and fast.

The stats view — mood breakdown, size distribution, and trigger categories

Result

A complete, deployed app that does one thing well and costs almost nothing to run: a static Svelte front end, a Hono Worker on Cloudflare's free tier. The API is small and fully covered by integration tests against a real Workers runtime (@cloudflare/vitest-pool-workers) — auth, the cries CRUD flow, config. Auth is rate-limited, secrets stay out of the repo, and the label lists are editable — so it tracks crying the way I actually think about it, not some predefined taxonomy.