Ledgerline
Rebuilt the invoicing dashboard for a B2B billing product so finance teams stopped exporting to spreadsheets.
- Role
- Lead engineer
- Stack
- TypeScript · Next.js · PostgreSQL · Redis
- Year
- 2025
- Result
- 1.8s → 240ms p95 dashboard load
Kept the reporting queries in Postgres with three materialized views refreshed on write, instead of adding a separate analytics store. One database to operate, and the numbers on screen are always the numbers in the ledger.
Context
Finance teams at a mid-size B2B billing company were exporting every invoice report to spreadsheets, because the dashboard took almost two seconds to load and often disagreed with the ledger by a few cents.
What I did
I traced the slow paths to six reporting queries that each re-aggregated a year of invoices. Three materialized views, refreshed inside the same transaction as each ledger write, replaced them. The dashboard reads only from those views, so what it shows is always what the ledger says.
Result
p95 dashboard load fell from 1.8s to 240ms. Spreadsheet exports dropped by two thirds in the first month, and the “numbers don’t match” support tag went quiet.