Xpendz × XNomz
Personal finance and nutrition tracking for the Indian market. It syncs bank notification emails, parses transactions from 8 bank formats, and logs meals with an AI camera prompted for Indian food.
Overview
Expenses and meals, tracked from one backend.
Indian banks send transaction alerts by SMS and email, and every bank formats them differently, so generic expense trackers can't read them reliably. Xpendz reads the email alerts from Gmail and runs them through a regex parser per bank to pull out each transaction. Manual entries are still supported, and the sync is careful not to double-count them. XNomz covers nutrition: a Gemini-backed food camera calibrated with Indian portion reference values in its prompt, so its estimates fit what people here actually eat.
Expense Tracking
- 01Gmail Transaction Sync
Connects to Gmail over OAuth 2.0 and searches for bank notification emails. Each match gives the amount, merchant, date, payment mode and UPI reference number.
- 023-Layer Deduplication
The app sends the message IDs it already has, the database enforces a unique index on emailMessageId, and a 60-second window catches a synced transaction that matches one entered by hand.
- 03Categories
6 default categories, each with an icon and hex colour, plus any custom ones. A transaction can be marked ignored or force-included.
- 04Spending Analytics
Monthly spend by category, a daily chart, the split by payment mode, and a calendar heatmap.
- 05Background Sync
Syncs run hourly, aligned to the clock: the task wakes at the top of the hour instead of polling every N minutes, which means 3–4× fewer wasted wakeups.
In Action
See it
live.
Two apps, one suite. Watch the core flows — from logging a transaction to tracking your macros.
Tech Stack
Architecture Decisions
One repo serves the API, the web PWA and the login page. There is no separate Express server, and everything deploys to Vercel with no extra config.
Four small contexts (Auth, App, Theme, Camera) instead of one big store. Each sits next to the data it owns, so the state of each feature is easier to follow.
When a screen loads, cached data from AsyncStorage renders at once while a fresh fetch runs in the background, and the UI updates when it arrives. Return visits show no loading spinner.
Bank emails are structured. Regex is fast, free and fully auditable. Gemini is kept for the problem that really is ambiguous: recognising food.
Instead of firing every N minutes, the sync calls secondsUntilNextHour() and lines every wakeup up with the top of the hour. It uses less battery and is easier to predict.
On a single-instance Vercel deployment, in-memory token buckets are enough and add no latency. A cleanup pass every 100 requests stops memory from growing without bound.
The Gemini prompt is written to underestimate on purpose. People counting calories lose trust in an app faster when it overestimates than when it underestimates, so the defaults lean low.
Challenges
Multi-bank email parsing without a standard format
Every Indian bank formats its alerts differently. Parsing runs as a pipeline: each bank's parser has a matchHint regex to reject non-matching emails quickly, then one regex per field. Parsers run in order and the first match wins.
OAuth token refresh on stateless serverless
Vercel functions are stateless, so there is no long-running process to refresh OAuth tokens in the background. Tokens are stored in MongoDB and refreshed on demand once they are within 60 seconds of expiry.
Gemini hallucination control for Indian cuisine
Generic LLMs overestimate calories in Indian food because they are trained on Western portion sizes. The fix is a 130+ line prompt with explicit portion anchors, rules for deriving macros, an instruction to err low, and sanity checks.
Image upload to a serverless function
A food photo reaches the Next.js API route as multipart form data. The route reads the form, takes the File object, converts it to base64 through arrayBuffer, and sends it to Gemini as inline data within the same request.
Background sync across iOS and Android
iOS and Android run background work very differently. The app registers the sync task with expo-task-manager before React mounts, uses expo-background-fetch for the periodic trigger, and watches AppState to catch the app coming back to the foreground.
By the Numbers
AKSHAT KUMAR
Full-Stack + AI Developer