CardaMon Logo CardaMon Architecture Case Study
Engineering Case Study • Production Architecture

Architecting a Privacy-First, Real-Time Financial Intelligence Engine

How I designed and engineered a sub-2ms heuristic on-device parser, an offline-first multi-device sync queue, a dynamic cloud credit card rule catalog, and native Android zero-loss financial defenses without ever reading user emails or sending raw SMS to the cloud.

0 ms
Cloud SMS Exposure
< 1.2 ms
Parsing Turnaround
15 min
Sliding Dedup Window
100%
Offline-First Capable

The Privacy & Bloat Crisis in Indian Fintech

India's credit card market has exploded to over 100 million active cards with labyrinthine reward tiers, monthly merchant spend caps, rotating multiplier vouchers, and aggressive devaluation cycles. Yet, incumbent market apps (CRED, Fold, Axio, IndMoney) suffer from three fatal architectural and product flaws:

πŸ”’
Cloud Inbox Scraping Liability
Competitors force users to connect their Google/Outlook accounts via full-read IMAP/OAuth permissions or upload unredacted PDF statements to remote cloud scrapers. This exposes personal communications, receipts, and sensitive financial identities to potential data leaks and third-party monetization.
🎰
Gamification & Ad Monetization Bloat
Mainstream apps have transformed from utilities into high-friction ad platforms filled with spinning wheels, peer loans, insurance cross-sells, and e-commerce stores, resulting in 150MB+ bundle sizes, battery drain, and sluggish app open times (>4 seconds).
πŸ•³οΈ
The "UPI Black Hole" & Lost Rewards
Over 80% of daily expenses occur over UPI. Traditional budget trackers classify UPI strings (e.g. UPI/P2M/414062684284/Zomato) as generic "Transfers" or "Others", missing credit card RuPay UPI rewards, Swiggy/Zomato dining 5% accelerators, and milestone voucher progress entirely.

The CardaMon Hybrid Edge Architecture

CardaMon is built on a hybrid architecture combining a native Android Kotlin background layer with a progressive web application (React/TypeScript). Every financial string is parsed and sanitized locally before reactive synchronization to an encrypted Firebase Realtime Database.

Native Android OS
SMS BroadcastReceiver &
NotificationListenerService
→
Kotlin Heuristic Engine
On-Device Regex Parser &
15-Min Sliding Dedup Cache
→
Capacitor Bridge
Low-overhead event bus &
Widget Biometric Bypass
→
React UI Layer (L1)
<1ms LocalStorage Cache &
Optimistic State Updates
→
Firebase Cloud (L2)
Atomic Offline Queue &
Isolated User Partitioning
⚑
1. Layer 1 Cache: <1ms UI Response
All user operations (logging an expense, renaming a category, swiping to delete) update the in-memory React state and localStorage synchronously before making any network calls. The interface responds in under 1 millisecond with zero loading spinners.
πŸ”„
2. Atomic Offline Sync Queue
Network mutations are queued as atomic actions (set, update, remove). If the user boards a flight or loses signal, actions accumulate in an indexed retry queue. Upon reconnection, transactions sync in background without user intervention or duplicate records.
☁️
3. Dynamic Remote Rules Catalog
Credit card reward rules, milestone thresholds, and exclusions are decoupled from the client app binary via public_config/credit_card_catalog in Firebase RTDB. When banks devalue points or launch new cards, rules hot-update live without app updates.

The "Minor Things" That Make a Major Difference

A look into the complex edge cases, mathematical optimizations, and subtle bugs solved in production that distinguish CardaMon from typical portfolio projects:

A. Solving the Cross-Channel Deduplication Matrix

Modern banks send an SMS alert, a banking app push notification, and an email receipt simultaneously. Furthermore, in P2P UPI transfers, both sender and receiver banks send alerts for the exact same amount. Without strict channel and type isolation, notifications collide or mute each other.

// Thread-safe sliding-window deduplication in Kotlin (TransactionDedupHelper.kt) object TransactionDedupHelper { private const val DEDUP_WINDOW_MS = 15 * 60 * 1000L // 15-minute sliding window fun generateKey(amount: Double, lastFour: String?, type: String = "EXPENSE"): String { val amtKey = Math.round(amount * 100) val l4 = lastFour?.trim()?.takeIf { it.isNotEmpty() } ?: "NO_CARD" // Prefix with transaction direction to prevent sender (DR) & receiver (CR) P2P collisions: val tKey = if (type.equals("INCOME", ignoreCase = true)) "CR" else "DR" return "${tKey}_${amtKey}_$l4" } }

B. 6-Tier Cascading Payee Heuristic Engine

Indian bank SMS formats vary wildly: multiline HDFC formats (To KOBIN MATHEW), single-line Axis alerts, SBI card swipe messages, and messy UPI RRN trails. CardaMon passes raw text through six cascading filter tiers, sanitizing noise, stripping leading grammatical prepositions, and formatting fused PascalCase merchant titles.

// Payee resolution in TypeScript (smsParser.ts) // Tier 1: Multiline structure extraction & leading preposition normalization candidate = candidate.replace(/^(?:UPI\/(?:[A-Za-z0-9_-]+\/)+|UPI\/|Ref\s+(?:no\s+)?\d+\/)/i, '').trim(); candidate = candidate.replace(/^(?:to|paid\s+to|transferred\s+to|transfer\s+to|towards)\s+/i, '').trim(); candidate = candidate.replace(/(?:UMRN|Ref|UPI Ref|Txn|A\/C|Bal|Avail|via|Auth code).*$/i, '').trim(); // Formats fused strings (e.g. BharatConnectUtiliti -> BharatConnect Utiliti) candidate = candidate.replace(/([a-z])([A-Z])/g, '$1 $2').trim();

C. Zero-Loss Engine: Automated Bank Fee Auditing & RBI Ombudsman Redressal

Credit card issuers extract billions annually from unmonitored leakages: unexpected annual card renewals (₹499 to ₹12,500 + GST), missing 1% fuel surcharge waivers, 1% Dynamic Currency Conversion (DCC) penalties on foreign gateways, and late payment finance charges. CardaMon’s Zero-Loss Engine continuously audits every transaction against card tier contracts:

πŸ”
Continuous Contract Audit
Instantly flags annual fee debits, cross-border DCC fee slips, and un-refunded fuel surcharges by matching card numbers, merchant categories, and transaction amounts.
πŸ“œ
Pre-Drafted Grievance Scripts
Generates 1-tap pre-drafted grievance emails and telephone support scripts citing RBI Master Directions on Credit Card Conduct to secure immediate fee reversals.
πŸ’°
Cumulative Recovery Tracking
Maintains an audited ledger of reclaimed fees and refunds, providing users with a verifiable savings counter of money saved directly through CardaMon.

D. Predictive 12-Month Outflow Forecaster & Peak Month Detection

Most expense trackers are purely backward-looking. CardaMon integrates a forward-looking 12-month calendar projection engine (SubscriptionForecaster.tsx) that maps utility billing cycles (BESCOM, Airtel, TNEB, piped gas), SaaS recurring subscriptions, insurance policies, and annual card renewals into the future.

// Peak Outflow Month Detection Algorithm (SubscriptionForecaster.tsx) const medianMonthlyCommitment = calculateMedianOutflow(twelveMonthProjection); const peakThreshold = medianMonthlyCommitment * 1.35; // +35% above baseline const peakMonths = twelveMonthProjection.filter(month => { // Flags high-outflow clusters (e.g. festival spending, dual insurance renewals) return month.totalCommitment > peakThreshold; });

By highlighting peak outflow clusters months in advance, users avoid liquidity squeezes, overdraft penalties, and unexpected balance deductions.

E. Smart Advisor & Multi-Card Portfolio Reward Optimizer

Indian credit card enthusiasts typically hold 3 to 8 cards with conflicting reward structures. CardaMon solves the "Which card should I swipe?" dilemma with dynamic algorithmic recommendations:

🎯
Optimal Card Spend Matcher
Instantly recommends the highest-yield card for any merchant or category: Infinia on SmartBuy (33.3%), Millennia on Amazon (5%), Airtel Axis on Utility bills (25%), or Tata Neu on UPI (10%).
🏹
Milestone Sniper Alerts
Monitors spend velocity towards annual fee waivers and milestone reward vouchers (e.g. Taj luxury stays, bonus 10,000 RPs), alerting users when they are close to hitting target thresholds.
⚑
Voucher Multiplier Hub
Calculates effective returns across instant gift vouchers (Gyftr / SmartBuy / NeuPass 5X/10X multipliers), factoring in platform processing fees and monthly brand caps.

F. Granular Notification Control & Battery-Aware Edge Listening

Unlike competitors that bombard users with promotional spam and drain device batteries with unoptimized polling, CardaMon gives users total sovereign control over notifications and hardware consumption:

πŸ””
Heads-Up vs Silent Mode
Users can toggle between rich native Android heads-up alerts with 1-tap "Save" action buttons, discreet in-app toasts, or completely silent background logging.
πŸ”‹
Screen-Off Battery Defense
Android receivers automatically pause heavy UI event processing during screen-off sleep states, preventing background battery drain and unnecessary CPU wake locks.
πŸ›‘οΈ
Dynamic Spam Exclusions
A real-time customizable exclusion engine drops marketing keywords, loan offers, and OTP spam before they can create notification noise or false expense entries.

G. Zero-Trace Statement Ingestion & RAM-Only PDF Decryption

Competitors require users to upload monthly statements to cloud parser servers, exposing full account numbers, credit limits, and purchase histories. CardaMon executes the entire statement pipeline on-device inside volatile browser memory:

πŸ“‘
Volatile RAM Password Decryption
Encrypted bank PDFs (e.g. DOB + PAN combinations) are decrypted entirely in client RAM. The decryption key is flushed from memory immediately upon parsing completion.
πŸ“Š
Multi-Format Reconciliation
Parses PDF, CSV, and Excel statements across all major Indian issuers (HDFC, SBI, ICICI, Axis, Amex), automatically reconciling duplicate transactions against real-time SMS records.
⚑
Zero Server Upload
Statement files are never transmitted to Firebase, external APIs, or third-party servers. Your raw financial statements never leave the physical device.

H. Airport Lounge Access Engine & Spend-Linked Eligibility Radar

Following massive 2025–2026 devaluations across Indian issuers, airport lounge access is now heavily conditioned on prior quarterly spends. CardaMon dynamically tracks eligibility and quotas:

πŸ›«
Quarterly Quota Counters
Maintains real-time domestic and international visit counters per card, with visual countdown reminders ahead of calendar quarter resets.
πŸ’³
Spend-Linked Radar
Monitors rolling spend criteria (e.g. β‚Ή50,000 spend required in preceding calendar quarter for ICICI/Regalia Gold) so travelers are never turned away at the lounge desk.
🎟️
Priority Pass & DreamFolks Integration
Distinguishes between direct credit card swipes and companion Priority Pass / DreamFolks memberships, including guest charge warnings.

The "Small Things": 30+ Micro-Interactions That Elevate Everyday Usage

True software excellence is measured not just in high-level architecture, but in the dozens of thoughtful micro-features and intuitive details that remove daily friction:

πŸ“… Calendar & Scheduling Delights
βž• Zero-Txn Past Date CTA
Tapping any past calendar date with zero transactions reveals an instant "+ Add Transaction to [Date]" shortcut button.
πŸ”€ Dual-Mode Recurring Click
Tapping a future scheduled bill opens the 12-Month Outflow Forecaster; tapping a past one opens historical spend trend charts.
πŸ”΄ Monthly Spend Pulse Dots
Calendar days feature subtle color-coded heat dots reflecting daily expenditure intensity at a glance.
↔️ Month-Over-Month Gestures
Fast horizontal flick gestures allow seamless jumping between historical and projected calendar months.
⚑ Speed & Touch Interactions
πŸ‘† Full-Screen Tab Swipe
Swipe horizontally anywhere on the screen to switch tabs (Dashboard ↔ Txns ↔ Cards ↔ Analytics) with edge resistance.
πŸ“³ Physical Haptic Micro-Engine
Custom tactile vibration pulses on swipe completion, card flip, successful expense logging, and biometric unlock.
🏺 Terracotta "Gullak" Loader
Custom nostalgic Indian clay piggy-bank animation featuring physical coin-drop physics and a glowing aura.
πŸ“‹ Smart Clipboard AI Auto-Paste
Detects copied bank SMS or WhatsApp payment messages from the clipboard and fills the entire transaction form in 1 click.
πŸ”„ 1-Tap Transaction Cloning
Clone any recurring daily spend (e.g. morning coffee, metro commute) with today's timestamp in a single tap.
🌊 Scroll Nudge & Modal Lock
Subtle gradient edge fades hint at off-screen horizontal content, while modals lock background scroll to prevent rubber-banding.
πŸ’³ Card Craft & Visual Fidelity
πŸƒ Realistic 3D Card Tilt & Flip
Interactive gyroscope and pointer-driven 3D tilt showing embossed card art, shiny EMV chip, and billing cycle progress bar.
🎨 Automatic Merchant Avatars
Instant brand logo resolution for popular Indian merchants (Swiggy, Zomato, Uber, Zepto, Blinkit, Tata Neu, Amazon).
πŸͺ™ Point Valuation Converter
Calculates real Indian Rupee value across airline miles (Air India, Vistara, KrisFlyer), hotel programs, and statement cash.
⏳ Reward Point Expiry Countdown
Visual countdown alerts flag reward points expiring within 30 to 90 days to prevent unredeemed loyalty loss.
❄️ Virtual Card Freeze Simulation
1-tap virtual card lock state temporarily removes cards from the active advisor without deleting historical spend data.
🎯 Card Advisor Quick Picker
Input a merchant or amount to immediately compare returns across all cards in your wallet before paying.
πŸ”’ Privacy & Discretion Controls
πŸ‘οΈ Shoulder-Surfing Privacy Eyeball
1-tap toggle on the dashboard masks balances, spend metrics, and card limits (β€’β€’β€’β€’β€’β€’) in public spaces.
πŸ“ Zero-Cloud Scratchpad (Local Notepad)
An instant notes and calculation checklist that lives strictly in local device memory with zero cloud synchronization.
πŸ”‘ Biometric App Lock & Widget Bypass
Keeps the full application protected by Biometrics/PIN while allowing <2s instant expense logging via Home Screen widgets.
🧹 1-Tap Cache & Tombstone Purge
Granular controls in Settings let users clear dedup caches, reset merchant memory, or purge local database copies on demand.
🧠 Edge Intelligence & Automation
🀝 Self-Transfer Opposing Flow Fusion
Auto-detects matching debit and credit alerts between user accounts within 3 minutes, fusing them into 1 unified Transfer.
πŸ“² Android Quick Settings Tile
Pull down Android quick settings to summon the Smart Card Advisor right at the checkout counter without opening the app.
πŸ”” Granular Heads-Up vs Silent Toggle
Choose between high-priority Heads-Up alerts with 1-tap "Save", subtle in-app snackbars, or silent background processing.
β›½ Fuel Surcharge & DCC Sniffer
Flags fuel swipes where the 1% surcharge was never refunded, and alerts on international gateway DCC currency markup fees.
πŸ“œ Pre-Drafted RBI Dispute Letters
1-tap formal grievance emails citing RBI Master Directions to request immediate annual fee waivers and refund reversals.
πŸ“¦ Offline Queue Sync Pill & Counter
Live status badge displaying exact synchronization state (e.g. "● Synced" or "β—‹ 2 Pending Mutations Queued").
🏷️ 1-Tap Date Filter Chips
Instant filtering across "Today", "This Week", "This Month", and custom ranges with zero loading wait times.
🌊 Interactive Sankey Cashflow Chart
Visual flow diagram mapping income sources directly into bank debits, credit card bills, SIPs, and net savings.
πŸ“Š CSV & Excel Statement Export
1-click formatted exports structured cleanly for CA tax filing, financial archiving, and personal accounting.
πŸ—“οΈ Resilient Date Normalizer
Accurately parses single-digit and heterogeneous dates (1-Oct, 01/10/2026, 1st October) across SMS and emails.

How CardaMon Compares Against Market Giants

A direct technical comparison highlighting architectural design choices between CardaMon and leading Indian fintech applications:

Feature / Metric CardaMon (This App) CRED Fold Money Axio (Walnut)
Privacy & Data Pipeline 100% On-Device Heuristic Reads Full Gmail Inbox Account Aggregator API Cloud Scraper Backend
Offline Capabilities Full Offline L1 Cache Fails completely offline Server dependent Partial
UPI Reward Optimization RuPay & Voucher Multipliers Cashback coins only Standard categorization Basic tagging
Zero-Loss Fee Defense Automated Fee Audit & Scripts None None None
12-Month Cashflow Forecaster Predictive & Peak Months Backward looking only Backward looking only None
Multi-Card Reward Optimizer Optimal Card Matcher + Milestones Only shows bill due None None
Granular Notification Control Full Sovereign Control (Silent/Heads-Up) Rigid, unconfigurable Standard push only Frequent marketing spam
Home Screen Widgets <2s Biometric Bypass Quick-Add None Basic balance widget Deprecated
Ad Monetization & Loans Zero Ads, Zero Loans, 0 Bloat Peer loans & storefront Subscription model NBFC Loan Prompts
Client App Footprint < 10 MB Native APK (< 4.3 MB PWA) ~ 145 MB ~ 65 MB ~ 50 MB

Core Technologies & Standards

Frontend & PWA
TypeScript 5.x • React 18 • Vite 8 • Workbox Service Worker
Engineered with strict zero-dependency vanilla design system tokens, CSS hardware-accelerated animations, and responsive touch layouts without heavyweight component libraries.
Android & Native Bridge
Kotlin • Android SDK 35 • Capacitor 8 • RemoteViews
Custom broadcast receivers, screen-off battery savers, Android 13+ runtime POST_NOTIFICATIONS permission checkers, and biometric bypass handlers for Home Screen widgets.
Cloud & Data Layer
Firebase Realtime Database • REST Fallback • Cloud Remote Config
Isolated multi-tenant path hierarchy (users/{uid}/*), conflict-free queue replay with atomic update() payloads, and public card catalog distribution.

Engineering Beyond the Minimum Viable Product

CardaMon is proof that consumer financial technology can be blisteringly fast, visually stunning, and deeply analytical without sacrificing user privacy or turning personal devices into advertising billboard displays.

Explore Live App → View GitHub Repository