Web · Full-stack AI app
Hisabify
An AI expense tracker and budget planner for Bangladesh: type or say what you spent in English, Bangla or Banglish, and review it before anything is saved.
Stack
- TypeScript
- React
- Tailwind CSS
- TanStack Query
- Python
- FastAPI
- SQLAlchemy
- PostgreSQL
- Supabase
- Gemini
- Vercel
- Render
- input languages: English, বাংলা and Banglish
- 3
- input languages: English, বাংলা and Banglish
- automated tests (226 backend, 55 frontend)
- 281
- automated tests (226 backend, 55 frontend)
- AI extraction eval cases on the first run
- 33/33
- AI extraction eval cases on the first run
- AI tools that can write data
- 0
- AI tools that can write data
What it does
Hisab (হিসাব) means "accounts" in Bangla. Type or say "Ajke 100 taka rickshaw vara, 200 taka lunch, ar 50 taka cha kheyechi" and you get three transactions to review and edit before anything is saved. Ask "Ei mash e koto khoroch holo?" or "Can I buy a 2,500 taka keyboard and still save this month?" and the answer comes from your own records.
| Feature | What it means |
|---|---|
| Bangla / Banglish / English, text and voice | Number words ("dedh hajar" = ৳1,500), "kal" resolved as yesterday or tomorrow from the verb tense, Bangla digits, code-switched speech |
| Commitment-aware safe-to-spend | What you can spend after reserving unpaid bills, this month's savings and essential budgets, as a per-day figure |
| What-if purchase simulator | Affordable / over budget / cuts into savings / not affordable, with alternatives. Records nothing |
| Irregular income | Expected income (tuition, freelance) is tracked separately and never counted until it arrives |
| Adaptive budgets, with consent | When a category heads over budget, the app proposes moving money from categories with room. Nothing changes until you approve |
Around those sit the everyday pieces: wallets (Cash, bKash, Nagad, Rocket, bank, savings) with transfers, monthly bills, an insights page where every chart also has a table view, CSV export, dark mode and a phone layout.
AI proposes, Python decides, you confirm
A finance app can't afford a model that is usually right, so the design gives the LLM as little authority as possible. It reads your words and phrases answers. It never writes data and never does money maths.
1 · You
2 · Normalize
3 · Gemini
4 · Validate
5 · You
- Extraction returns a draft. Saving goes through the normal API, which validates everything again, so the AI path has no shortcut to the database.
- Money maths is deterministic. Budgets, safe-to-spend, forecasts and simulations are plain, unit-tested Python. The model is only asked to explain the results.
- The assistant's tools are read-only (balances, spending, budgets, forecast, simulator) and scoped to the signed-in user. A test runs every tool and checks that nothing in the database changed.
Checking the model's numbers
In live testing the model called the right tool, got a total of ৳11,990.50, and then wrote ৳11,900.50 in its answer. The data cards beside the answer were still correct, but the sentence wasn't. So every ৳ amount in an answer is now checked against the numbers the tools actually returned, allowing sums and differences of two of them for simple arithmetic. An unverified amount sends the answer back to the model once to correct; if it is still wrong, the answer is flagged.
def unverified_amounts(answer: str, tool_results: list[dict]) -> list[str]: """৳ amounts in `answer` that can't be traced to the tool results.""" mentioned = amounts_in_answer(answer) if not mentioned: return [] known: set[Decimal] = set() for result in tool_results: numbers_in(result, known) known = {abs(n) for n in known} base = sorted(known)[:MAX_NUMBERS] derived = set(base) for a, b in itertools.combinations(base, 2): derived.add(a + b) derived.add(abs(a - b)) return [text for text, value in mentioned if value not in derived]Silence is not a transaction
Given an all-silent recording, a real transcription model confidently returned "bKash-e 500 taka pathalam" ("I sent 500 taka by bKash"). Silent audio is now rejected in plain Python before any AI is called: the browser records a 16 kHz WAV, and the server measures the loudest 100 ms window.
# 16-bit full scale is 32767. 300 ≈ −40 dBFS: quieter than any normal speech close to a# phone/laptop mic, louder than a typical silent room (browser AGC is usually on).SPEECH_RMS_THRESHOLD = 300 def loudest_window_rms(wav_bytes: bytes, window_ms: int = 100) -> float: # … window = max(1, rate * window_ms // 1000) loudest = 0.0 for start in range(0, len(samples), window): chunk = samples[start : start + window] rms = math.sqrt(sum(s * s for s in chunk) / len(chunk)) loudest = max(loudest, rms) return loudest def is_probably_silent(wav_bytes: bytes) -> bool: return loudest_window_rms(wav_bytes) < SPEECH_RMS_THRESHOLDVoice recordings are processed in memory and never stored, and the transcript is always shown for editing before it becomes a draft.
Safe to spend
A wallet balance overstates what you can spend: rent is still due, and this month's savings haven't been moved yet. Safe-to-spend reserves those first, and doesn't count expected income until it arrives.
def safe_to_spend(db: Session, user_id: uuid.UUID) -> dict: """How much can I spend for the rest of this month without hurting commitments? available = money in non-savings wallets − unpaid bills this month − savings target not yet moved to savings wallets − remaining budget for ESSENTIAL categories (minus bills already counted) per day = available ÷ days left (incl. today) Expected (not yet received) income is reported separately, never counted as money. """ # … for item in budget["items"]: remaining = max(ZERO, item["remaining"]) if item["category"]["is_essential"]: # Don't reserve twice: an unpaid rent bill already covers the rent budget. essential_left += max( ZERO, remaining - unpaid_by_cat.get(item["category"]["id"], ZERO) ) else: flexible_budget_left += remaining # … available = spendable - unpaid_bills - savings_left - essential_leftThe purchase simulator builds on the same snapshot. It is read-only: it answers "can I afford this?" with a verdict, the reasons, and the most you could spend without touching savings.
Architecture
Browser · Vercel
API · FastAPI on Render
Data & AI
- Money is never a float.
NUMERIC(14,2)in Postgres,Decimalin Python, strings over JSON, and BigInt-based sums in the browser, with lakh-grouped formatting (৳1,25,000). - Balances are derived, never stored: opening balance plus history, so edits and deletes can't make them drift.
- Idempotency keys on every money action, so a double click or a retry can't save twice. Database CHECK constraints back up the rules, for example that a transfer needs two different wallets.
- Auth: Supabase issues the session and the API verifies the ES256 JWT against Supabase's JWKS. Every query is filtered by that user id, and Postgres row-level security is enabled with no policies, so Supabase's public data API exposes nothing.
- Privacy: a strict Content-Security-Policy (the one inline script is allowed by hash, and a test checks it), AI prompts aren't stored unless you opt in, and you can export your data or delete your account.
Testing, including the AI
Unit tests can't tell you whether a model understands "dedh hajar", so alongside them there are evaluation sets that run against the real model.
| Suite | Result |
|---|---|
| Backend tests (pytest, DB tests against PostgreSQL 17 in CI) | 226 |
| Frontend tests (Vitest: money maths, dates, WAV encoding, safe markdown, CSP) | 55 |
| AI extraction eval | 33/33 first run; 30/33 on a rerun (2 provider outages, 1 reused-amount error, now flagged) |
| Assistant eval (right tool, exact numbers, language mirrored) | 11/11 |
| AI budget extraction (English, Banglish, Bangla script, missing income) | 4/4 |
The rerun is reported as measured rather than replaced with the better number: the reused-amount mistake it exposed became a new validation rule.
Limits and what's next
- Forecasts are transparent averages, not ML. A learned model makes sense once there are months of real data.
- Bills are monthly only, and custom categories can't yet be created from the UI.
- No bank or bKash integration and no real payments, by design.
The live app runs on free tiers, so the API can take 30–60 seconds to wake up on the first request.