Inspiration

A bank statement is the most revealing file most people have: every shop, every salary, every rent payment. Many budgeting tools ask you to upload it to a server first, and some people who would benefit from budgeting help are not comfortable doing that. I wanted to find out whether an AI money coach could be useful while your transactions never leave your laptop.

What it does

Ledger Zero is a free web app with no login. You drop in a CSV or a text PDF bank statement (password-protected PDFs work too).

  • The file is read inside the browser tab, and every row is checked against the running balance.
  • Rules sort the shops they know. Gemini Nano, the AI model built into Chrome, sorts the rest on your laptop.
  • You see spending by category and by month, recurring charges, and a transaction list you can correct.
  • When you click Get my savings plan, cloud Gemini writes a plan with monthly moves and a four-week schedule. You can also ask it questions, like "Can I afford a ₹25,000 trip in March?"
  • A privacy chip at the top always shows what has left your laptop: "Private · nothing uploaded" at first, and "Private · only totals shared" after you ask for a plan. You can see exactly what will be sent before you click.
  • The Under the hood page shows how the routing works, with counters and a log of every AI call.

Once the page is loaded, reading a CSV and sorting run on the device with no internet connection. Only the savings plan and questions need the cloud.

How I built it

The app uses Firebase AI Logic hybrid inference, with two paths kept strictly apart.

  • On the device: sorting uses the ONLY_ON_DEVICE mode, which runs Gemini Nano in Chrome. It never quietly falls back to the cloud, and the code checks that each answer really came from the device. If Nano is not available, the app switches to a rules-only Basic mode. The model download starts only after a click.
  • In the cloud: the savings plan and questions use the ONLY_IN_CLOUD mode with Gemini (gemini-3.5-flash-lite), a system instruction and a structured response schema. This only happens after an explicit click.
  • A payload guard checks every request before it leaves. Only fixed categories, whole-number amounts, months, counts, currency and a question of at most 300 characters can pass. No shop names, no dates, no transaction rows.
  • Firebase App Check (reCAPTCHA Enterprise in production) protects the cloud calls. Firebase Remote Config holds the cloud model name, the prompt version and a cloud on/off switch. The app runs on Firebase Hosting (free Spark plan).
  • The rest of the stack: React, TypeScript, Vite, Tailwind CSS, Framer Motion and Recharts for the interface. PapaParse and pdf.js read the files, ExcelJS exports spreadsheets, IndexedDB remembers your corrections on your own laptop, and 123 automated tests run with Vitest.

Challenges I ran into

  • Making "never sees your transactions" something you can check, not just a promise. The payload guard, the privacy chip and the routing log (with bytes per call) exist for this.
  • On-device AI is not available everywhere. The app never hides that: no silent cloud fallback, just a clear rules-only mode.
  • Reading real-world PDFs, including password-protected ones. The running-balance check proves that every row was read correctly.
  • Being honest about offline. Testing showed the PDF reader loads the first time a PDF is opened, so the claim is exactly this: once the page is loaded, reading a CSV and sorting work with no internet.

Accomplishments that I'm proud of

  • Gemini Nano alone, with no rules helping, sorted 92.5% of a 40-shop test set correctly (37 of 40), at about 1.9 seconds per shop, on my laptop.
  • In the demo, 42 transactions were handled with 39 sorted by rules, 3 by on-device AI, and none uploaded. Sorting sent 0 bytes off the laptop. The savings plan request carried 538 bytes of category totals. Both numbers are visible in the routing log.
  • The hybrid split is not hidden: the user can see where every call ran.

What I learned

Hybrid AI is mostly a decision about where each job should run. A small on-device model is good enough for a narrow job like sorting shops, and a bigger cloud model is worth using for writing a plan. Drawing the line clearly, and showing proof of it, is what makes people trust the result.

What's next

Support for scanned PDFs and .xlsx statements, more statement layouts, and more languages as on-device models add them. Ledger Zero is a coaching aid, not financial advice.

Try it

  1. Open https://ledgerzero-09.web.app in desktop Chrome. No login.
  2. Click Try a sample file (made-up data: a rupee statement if your browser is set to India, a dollar statement otherwise; the link below it switches), then press Analyze my statement.
  3. Look at the privacy chip at the top: "Private · nothing uploaded".
  4. Click Get my savings plan. The chip changes to "Private · only totals shared".
  5. Open Under the hood to see the routing log.

Gemini Nano needs desktop Chrome on supported hardware and works in English only. If it is not available, the app says so and runs in rules-only mode.

Built With

  • chrome
  • exceljs
  • firebase-ai-logic
  • firebase-app-check
  • firebase-hosting
  • firebase-remote-config
  • framer-motion
  • gemini
  • gemini-nano
  • indexeddb
  • papaparse
  • pdf.js
  • react
  • recharts
  • tailwindcss
  • typescript
  • vite
  • vitest
Share this project:

Updates

Submission history