Case Study
2026Full-Stack + MobileReact NativeNext.jsGemini AIMongoDB

Xpendz × XNomz

Calendar View
Macros Breakdown
Nutrition Home
Transaction List
Spending Analysis
App Hub
Hubclick to cycle

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.

01

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.

iOSTestFlight + App Store
AndroidExpo EAS + APK
Web PWAVercel — same backend
02

Expense Tracking

  1. 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.

  2. 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.

  3. 03Categories

    6 default categories, each with an icon and hex colour, plus any custom ones. A transaction can be marked ignored or force-included.

  4. 04Spending Analytics

    Monthly spend by category, a daily chart, the split by payment mode, and a calendar heatmap.

  5. 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.

04

In Action

See it
live.

Two apps, one suite. Watch the core flows — from logging a transaction to tracking your macros.

XpendzExpense TrackerXNomzNutrition Tracker
05

Native Widgets

The app follows you to your home screen. Live spending, nutrition, and hydration — all without opening the app.

Analysis widget — light modeAnalysis widget — dark mode
Meal Log widget — light modeMeal Log widget — dark mode
Water Log widget — light modeWater Log widget — dark mode
06

Tech Stack

Mobile
React Native 0.81Expo 54Expo RouterNativeWindReanimated v4
Backend
Next.js 14TypeScriptJWT AuthRate Limiting
Database
MongoDBMongoose
AI & APIs
Gemini FlashGmail APIGoogle OAuth 2.0
DevOps
VercelExpo EASTestFlightPWA
07

Architecture Decisions

Next.js for both backend and PWA

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.

React Context over Redux

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.

Dual-layer caching

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.

Email parsing via regex, not LLM

Bank emails are structured. Regex is fast, free and fully auditable. Gemini is kept for the problem that really is ambiguous: recognising food.

Clock-aligned background sync

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.

In-memory rate limiting

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.

Conservative AI calorie estimation

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.

08

Challenges

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

09

By the Numbers

23API Endpoints
9MongoDB Collections
18+Screens
4React Contexts
3External Integrations
8Bank Parser Patterns
20+Indian Dish Anchors
3-Layer Caching
RoleFull-Stack + Mobile
Year2026
StackReact Native · Next.js · Gemini AI · MongoDB
ModulesXpendz + XNomz

AKSHAT KUMAR

Full-Stack + AI Developer