Personal OS: a private dashboard with a WhatsApp assistant
A private dashboard for tasks, clients, finance and site monitoring that I can also run from WhatsApp, with 2FA and owner-only deletes.
The problem
My work was scattered across notes, a CRM, deadlines, money tracking and four Gmail inboxes, and I wanted one private place for all of it that I could also reach from my phone. It holds real client and finance data, so the hard part was letting a chat assistant read and change it without handing over the keys.
How I built it
I wrote down 15 engineering rules first (never claim verification without running the test, no secrets in source, no destructive change without approval) and recorded each big decision as a short design note. The app is Next.js 15 on Supabase Postgres, with its own TOTP two-factor login and a local-file fallback that production refuses to use. A WhatsApp assistant and an MCP server share one registry of controlled tools, so neither can do anything the registry does not list, and a delete needs a code that only I can confirm. A site watchdog crawls my own websites on a schedule and alerts me when a page breaks, and a forwarder sends every new email from four Gmail inboxes to WhatsApp with a tag. Tests that could erase data are fenced: the Supabase suite reads a separate env file, refuses known production projects, needs an explicit flag, and exits with its own code (87) so a refusal cannot be mistaken for a failed build.
What got hard
- A security audit of the login found six real problems, including a race that let one single-use 2FA token create several sessions, a 2FA-disable endpoint with no rate limit, and a rate-limit key taken from a field a caller could spoof.
I fixed all six and wrote a regression test for each that reproduces the original bug against a live server.
- The watchdog's guard against requests to private addresses never ran for targets written as IP addresses, because Node skips a custom DNS lookup when the host is already an IP. 65 green tests had missed it, since every CMO test enabled the loopback escape hatch.
I validate the address before the request and on every redirect hop, and kept the connect-time check for DNS rebinding. A new test never enables the escape hatch: reverting the fix turns 6 passes into 5 failures, and a positive control shows the same URL becomes reachable when the hatch is on, so 'blocked' cannot be confused with 'network broken'.
- The watchdog reported 'all clear' on my real sites. Every scan of a real hostname failed in about 200 ms (Node's connect hook expects a list of addresses and mine returned one), and on my client-rendered sites the served HTML has no links at all, so the crawler found nothing to check.
I fixed the lookup contract, seeded the crawl from sitemap.xml (one level of sitemap index), and made the page cap count pages fetched instead of URLs discovered. Both real sites then answered 200 in about 700 ms, one with 9 sitemap URLs and the other with 317.
- Letting a small language model delete records from chat is risky. My first design masked the 4-digit confirm code by text pattern, and a review showed the model could learn a live code and write it back in Urdu digits that the confirm parser accepted but the mask missed.
A delete now parks under a single-use code that lasts 10 minutes and is confirmed only by a message matched in code before any model sees it. Masking finds a live code in any spelling (ASCII, Urdu, Arabic-Indic or full-width digits, with invisible characters or dashes between them) in history, tool results and replies. Deliberately broken versions of the code were caught by the tests: 26 of 26 mutants, none survived.
- Forwarding every new email from four Gmail inboxes to WhatsApp must not lose a message across a redeploy or send one twice. A review found that mail claimed by another instance counted as handled, which could drop an email during a deploy.
Claims became time-limited leases with a per-folder cursor, takeover after 10 minutes, and retries for receipts that fail to save, with a test for each case. Id lists go to the database in chunks of 50, because a backlog of 150 emails would otherwise exceed the request-line limit and stall forwarding for good.
- From 3 Nov 2026 WhatsApp refused the client version compiled into the self-hosted gateway ('Client outdated 405'), and the upstream project had no fixed release.
I rebuilt the gateway from the exact upstream commit I had audited, with the open upstream fix applied as a byte-for-byte patch, in a Docker build that fails if the binary needs any library other than musl. Messaging resumed two minutes after the merge.
- The bot's free-model chain stopped working when its provider refused the key, and the Claude models I moved to then answered every message with a 400, because the bot sent a temperature setting they have deprecated.
I moved to Anthropic's OpenAI-compatible endpoint and stopped sending temperature to Claude models. The five-question check now records which model answered: 5 of 5 came from Sonnet 5.5 with all 11 requests accepted, where the old code had also scored 5 of 5 only because each question failed first and fell back to a second model.
The result
It runs in production on Supabase and Northflank, with 29 automated test files covering auth, 2FA, rate limits, request-forgery containment, the bot, the gateway and the email forwarder. After the model change on 12 Nov 2026 the assistant answers on Claude Sonnet 5.5.
The ← and → keys turn the page too.