§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- 01
Layered reconciliation
Protected manual links and confidence per layer.
- 02
OCR of heterogeneous invoices with AI
Validating dates, amounts and issuer; reprocessing without paying the cost twice.
- 03
Volume-relative paths
A guard that rejects absolute paths, so hundreds of PDFs are never reprocessed by accident.
- 04
In-memory registry of long jobs
Fed line by line by external scripts, so the progress bar moves.
- 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