Skip to content
brorn
No. 011 · Personal life

ainvoice

Matches bank statement entries with invoices, reads invoices with AI-powered OCR and sends them to the TOConline accounting system.

Live
Period
2026-06 → now
Platforms
Web · Phone (photo capture)
Role
Solo: design, build, ship
Tech
Fig. 1 · Statement and invoices
Fig. 2 · Long running jobs
Fig. 3 · Executive dashboard

§1The problem

Every month you have to find the invoice for each business expense (in emails, websites and on paper) and link it to the bank entry for the accountant. It was repetitive manual work.

§2What I built

  • Two-column screenStatement expenses and invoices, with drag and drop, filters, card and table views; link, approve and remove.
  • ScrapersAbout a dozen, to download digital invoices from services and email.
  • Paper invoicesPhoto or batch from the phone, OCR with AI and validation.
  • Layered matcherLinks invoice and entry automatically, explaining why.
  • DashboardsLong-running process panel with progress, an executive dashboard and a print module.
  • IntegrationsInvoices sent to TOConline; statement via Open Banking.
  • MaintenanceAudits and correction scripts.

§3The hard parts

5 entries
  1. 01

    Layered reconciliation

    Protected manual links and confidence per layer.

  2. 02

    OCR of heterogeneous invoices with AI

    Validating dates, amounts and issuer; reprocessing without paying the cost twice.

  3. 03

    Volume-relative paths

    A guard that rejects absolute paths, so hundreds of PDFs are never reprocessed by accident.

  4. 04

    In-memory registry of long jobs

    Fed line by line by external scripts, so the progress bar moves.

  5. 05

    Centralised AI calls

    Retry on JSON parse failures, and one item per call to avoid truncation.

§4Result

In use, with a real database and hundreds of invoices already processed.

§5Stack

  • Next.js 16
  • React
  • TypeScript
  • SQLite (better-sqlite3)
  • Puppeteer (scrapers)
  • LLM via command-line agent for OCR and classification
  • Open Banking (Enable Banking)
  • TOConline API
  • tsx
  • pm2