Building a Local-First Financial IDE: How I forced Gemini AI to do strict Double-Entry Accounting

Published: (March 3, 2026 at 02:51 PM EST)
3 min read
Source: Dev.to

Source: Dev.to

I got tired of accounting software that feels like a slow, cloud‑based spreadsheet from 2010.
As a developer, I spend my day in VS Code—fast, keyboard‑driven, and local. I wanted my financial tools to feel the exact same way, so I built Finance‑OS under my new studio, Auvira Systems.

Strict requirements

  • Zero Cloud Database – financial data lives in the browser, not on any server.
  • Double‑Entry Ledger – mathematically rigorous; no editing history, only reversals.
  • AI Command Bar – type “Paid $50 for AWS hosting” and have the system automatically balance the books.

The Local‑First Architecture

The biggest paradigm shift was dropping Postgres/MongoDB.
Instead, the entire application state—every transaction, account, and predictive forecast—lives in the user’s browser using localStorage (and eventually IndexedDB for scale).

Benefit: Zero latency. Switching between the Chart of Accounts and the Forecasting Engine is instant.
Challenge: Data portability. To solve this, I built a Sovereign Vault feature. Users can export their entire ledger as a single, encrypted JSON file and import it on another machine. You own your database.

Forcing an LLM to Do Strict Accounting

LLMs are notoriously bad at math and strict formatting. If the AI hallucinates a number, a double‑entry ledger (where Assets = Liabilities + Equity) breaks instantly.

I used Google Gemini as a stateless parser, not a database. When a user types a command, the app sends it to a stateless proxy. The prompt enforces a JSON schema:

// The AI is only allowed to return this structure
interface AIResponse {
  debitAccount: string;
  creditAccount: string;
  amountInCents: number; // NEVER use floats for currency!
  description: string;
}

Golden Rule: The AI never touches the ledger; it only suggests the JSON payload.
The local React application catches the JSON, verifies that the accounts exist, ensures debits equal credits, and then commits the transaction to the local state. If the AI hallucinates, the TypeScript logic rejects it.

The “Privacy Shield” (A Fun UI Detail)

Because the app runs locally, I often use it in public places. To hide sensitive numbers, I added a global Privacy Shield toggle that applies a Tailwind blur and reduced opacity to all financial integers:

// A simple but highly effective UI pattern

  {formatCurrency(totalCash)}

Try It Out (No Sign‑up Required)

Building complex, stateful applications entirely in the browser has been an incredible learning experience. Since there is no backend database, I created a frictionless Guest Mode. Click the link below, jump straight into the IDE, and test the AI command bar yourself—your data stays on your machine.

👉 Try Finance‑OS Live Here

0 views
Back to Blog

Related posts

Read more »