Building Kharcha: India's Zero-Friction UPI Expense Tracker
How I built a native Android expense tracker that automatically captures UPI payments from GPay, PhonePe, and Paytm with zero AI and 100% data ownership.
Managing personal finances in India's UPI-first economy is unique. We make dozens of micro-transactions daily—from the local chai tapri to Swiggy orders. Logging these manually in traditional expense trackers is tedious and friction-heavy.
That's why I built Kharcha: a native Android expense tracker purpose-built for India's UPI ecosystem.
The Problem with Existing Trackers
Most expense trackers require you to manually open the app and log every transaction. Some attempt to automate this using AI, which often leads to miscategorized expenses, hallucinations, and privacy concerns because your financial data is being sent to third-party LLM providers.
I wanted something different:
- Zero Manual Entry: It should automatically capture payments from GPay, PhonePe, Paytm, or CRED.
- Zero AI: The categorization should be 100% deterministic and rule-based.
- Absolute Data Ownership: It must be an offline-first app where data lives on the device, not strictly in the cloud.
How Kharcha Works
Automated UPI & SMS Capture
Kharcha reads push notifications and SMS banking alerts in real-time. To prevent double-counting (which is a notorious issue when you receive both a notification and an SMS for the same transaction), I implemented a smart deduplication system with a ±2 minute window.
Smart Spam Filter
Your SMS inbox is full of OTPs, recharge prompts, and loan ads. Kharcha silently ignores these before they even hit the parser, ensuring that your ledger is clean and accurate.
Ground-Truth Wallet Sync
Extracted SMS balances act as ground-truth checkpoints. If there's a discrepancy, Kharcha silently corrects your local wallet ledgers to match the actual bank balance.
Rules Engine
Instead of relying on an LLM to guess what "Swiggy" means, Kharcha uses a transparent rules engine. Swiggy → Food, Uber → Travel. You can add custom regex-based rules to auto-sort your niche merchants.
The Tech Stack
I chose a stack that prioritizes local performance and reliability:
- Framework: Flutter (Android 12+, minSdk 32)
- State & UI: Riverpod, go_router, Material 3, fl_chart
- Local DB: Drift (SQLite) — The definitive Source of Truth
- Cloud / Sync: Supabase (Postgres, Google Auth)
- Native Plugins:
flutter_local_notifications,local_auth
By utilizing Drift for local storage and Supabase strictly as a silent background sync target, Kharcha achieves true offline-first capability. Even if you're entirely offline, the app functions flawlessly. I also moved heavy chart calculations (like merchant rankings and GitHub-style heatmaps) into native SQLite aggregations to eliminate OOM crashes and keep the UI butter-smooth.
The Experience
I wanted Kharcha to feel native and personal. It features:
- Hinglish Daily Summaries: Localized 9PM daily check-ins ("Aaj ₹540 kharcha hue") and Sunday weekly recaps.
- GitHub-Style Heatmaps: To help you visualize your spending intensity visually.
- Privacy-First Export: You can export your database to CSV or JSON with merchant PII auto-hashed for safe spreadsheet analysis.
- Biometric App Lock: Fingerprint or PIN protection ensures your financial data stays private.
Check it out
Kharcha is available for Android (arm64). You can check out the website or grab the latest APK directly from the GitHub Releases page.
Building Kharcha has been a fantastic journey in Android systems programming, local-first architecture, and creating user-centric mobile applications. If you're tired of manually logging your UPI expenses, give it a spin!
More Essays
Building jev-curate: Fast Synthetic Dataset Sifter in Rust
Filtering synthetic training data with TypeSafe AI Jev: streaming JSONL and Parquet rows through calibrated System One gates at 70ms latency with zero memory accumulation. � 5 min
systemsBuilding jev-git: Sub-Second Git Reflex Gate in Rust
Screening staged git diffs for leaked secrets, destructive payloads, and AI hallucinations in 80ms using TypeSafe AI Jev System One. � 4 min
systemsBuilding jev-scout: Zero-Hallucination Crate and Repo Scout
Preventing AI package hallucinations: discovering real crates and GitHub repositories using live registry APIs and TypeSafe Jev speculative fan-out scoring. � 4 min