<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Levin Siju</title>
    <description>The latest articles on DEV Community by Levin Siju (@levinsiju).</description>
    <link>https://dev.to/levinsiju</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4155311%2F71ef4d62-9996-4356-9467-83cba7612180.png</url>
      <title>DEV Community: Levin Siju</title>
      <link>https://dev.to/levinsiju</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/levinsiju"/>
    <language>en</language>
    <item>
      <title>Building CoTally — A Privacy-First Family Expense Tracker PWA with Offline Sync &amp; Multi-Currency</title>
      <dc:creator>Levin Siju</dc:creator>
      <pubDate>Thu, 01 Oct 2026 16:14:14 +0000</pubDate>
      <link>https://dev.to/levinsiju/building-cotally-a-privacy-first-family-expense-tracker-pwa-with-offline-sync-multi-currency-89g</link>
      <guid>https://dev.to/levinsiju/building-cotally-a-privacy-first-family-expense-tracker-pwa-with-offline-sync-multi-currency-89g</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Feol0unvky3zzmdq937zb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Feol0unvky3zzmdq937zb.png" alt=" " width="400" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Most expense-splitting and budgeting apps today have become bloated, locked behind subscription paywalls, or require constant internet connectivity. More importantly, existing tools rarely balance &lt;strong&gt;shared household spending&lt;/strong&gt; with &lt;strong&gt;personal financial privacy&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;To solve this, I built &lt;strong&gt;&lt;a href="https://cotally.vercel.app" rel="noopener noreferrer"&gt;CoTally&lt;/a&gt;&lt;/strong&gt; — a modern Progressive Web App (PWA) designed for families and households to track shared budgets, balance debts, and auto-convert currencies in real time, even without an internet connection.&lt;/p&gt;

&lt;p&gt;Here is a breakdown of the architecture, key technical challenges, and how I built it using &lt;strong&gt;React, Vite, TypeScript, and Supabase&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ The Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Frontend&lt;/strong&gt;: React 18, Vite, TypeScript&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Styling &amp;amp; Components&lt;/strong&gt;: Tailwind CSS, shadcn/ui (Radix UI primitives), Lucide Icons&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Animations &amp;amp; Charts&lt;/strong&gt;: Framer Motion, Recharts&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backend &amp;amp; Database&lt;/strong&gt;: Supabase (PostgreSQL with Row-Level Security, Supabase Auth)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Fetching &amp;amp; Caching&lt;/strong&gt;: TanStack React Query&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PWA &amp;amp; Offline&lt;/strong&gt;: VitePWA (Workbox Service Worker) + LocalStorage event queue&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  💡 Key Architectural Features
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Privacy-First Household Accounting
&lt;/h3&gt;

&lt;p&gt;In typical household budgeting apps, either everything is shared or everything is private. CoTally introduces a &lt;strong&gt;hybrid privacy model&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Shared Household Spend&lt;/strong&gt;: Groceries, utilities, and dining out are shared with real-time totals and budget limits visible to all family members.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Private Financial Privacy&lt;/strong&gt;: Personal spending, private debts, and individual savings goals remain completely hidden from other household members using Supabase Row-Level Security (RLS).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Live Multi-Currency Normalization
&lt;/h3&gt;

&lt;p&gt;Living in an international environment means family members frequently spend across different currencies (e.g., &lt;strong&gt;AED, INR, USD, EUR, GBP, SAR&lt;/strong&gt;).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Built a client-side exchange rate layer using &lt;code&gt;open.er-api.com&lt;/code&gt; with in-memory caching to avoid redundant API polling.&lt;/li&gt;
&lt;li&gt;When expenses are recorded in any currency, CoTally auto-calculates an &lt;code&gt;amount_base&lt;/code&gt; in the household's chosen base currency.&lt;/li&gt;
&lt;li&gt;If a household changes its base currency (e.g. from AED to GBP), an automated migration converts all existing past records and recalculates budget progress bars in real time.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. True Offline-First Logging &amp;amp; Auto-Sync
&lt;/h3&gt;

&lt;p&gt;Financial logging needs to happen at the exact moment of purchase, regardless of cell reception or airplane mode.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Offline Caching&lt;/strong&gt;: Static assets are precached using Workbox, while recent transactions and category data are cached locally. The app shell opens in 0ms offline with zero loading spinners.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optimistic Offline Queue&lt;/strong&gt;: When an expense is recorded offline, it is instantly assigned a local ID, queued in &lt;code&gt;localStorage&lt;/code&gt;, and prepended to the live transaction feed with a "Waiting to sync" badge.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Background Sync&lt;/strong&gt;: An event-driven &lt;code&gt;useOfflineSync&lt;/code&gt; hook listens for browser reconnection events, sequentially flushing queued expenses to Supabase and replacing local records with permanent database entries seamlessly.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. 2-Second Hardware Quick-Add
&lt;/h3&gt;

&lt;p&gt;To make expense tracking effortless, I set up a dedicated &lt;strong&gt;Supabase Edge Function&lt;/strong&gt; (&lt;code&gt;quick-add&lt;/code&gt;) paired with an iOS Apple Shortcut and Android shortcut:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Users can simply &lt;strong&gt;Double-Tap the back of their iPhone&lt;/strong&gt; (Back Tap) or double-press their power button.&lt;/li&gt;
&lt;li&gt;The shortcut prompts for amount, category, and note, and sends a lightweight payload to the server.&lt;/li&gt;
&lt;li&gt;The backend automatically resolves categories using a contextual dictionary (e.g., &lt;em&gt;Stationary&lt;/em&gt; ➔ Education, &lt;em&gt;Shein&lt;/em&gt; ➔ Shopping, &lt;em&gt;Karak&lt;/em&gt; ➔ Dining) and saves the entry in under 2 seconds.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🚀 Check It Out
&lt;/h2&gt;

&lt;p&gt;CoTally is live and free to use:&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;Live Web App&lt;/strong&gt;: &lt;a href="https://cotally.vercel.app" rel="noopener noreferrer"&gt;https://cotally.vercel.app&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'd love to hear your thoughts and feedback on the architecture, offline handling, and multi-currency approach!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>supabase</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
