Manuel Hernandez · Case study

BuildMetrx: software that reads a contractor's bills and puts every line on the right job

A contractor's real costs are buried in hundreds of vendor bills. I built the system that reads those bills, has a person approve them, and turns them into a live picture of what each job is costing.

My roleCo-founder. Designed the system and built the back end.
WhenCurrent version built August to November 2026
Built withTypeScript, Next.js, Supabase Postgres, Cloudflare Workers, Claude API
StatusLive. In use at my co-founder's construction company.

The problem

My co-founder runs a construction company in South Florida. He was running jobs on spreadsheets, whiteboards and memory. The first question I asked him was "How much does a yard of concrete cost you?" He couldn't answer it from his own records, and neither can most contractors. The answer is spread across supplier bills that arrive as PDFs, phone photos and emails, and get typed into accounting weeks later with no link to the job they were for.

We tried to build it four or five times. The early versions tracked bills but didn't show the numbers that mattered. We restarted from scratch to get that right, and the version described here is the result.

What it does

How a bill moves through it

  1. It arrives.Upload, phone photo, a forwarded email, or a pull from QuickBooks. A PDF holding many invoices is split into separate bills.
  2. It is checked against what is already there.The same file can't be loaded twice, and a bill that matches an earlier one is flagged before anyone approves it.
  3. A vision model reads it.The model has to answer in a fixed structure. Anything that doesn't fit the structure is rejected, not guessed at.
  4. Plain code checks the model's work.The totals have to add up and the dates have to make sense. Each line is matched to the vendor, the job and the company's price book. Lines the system isn't confident about are marked for a closer look.
  5. A person approves it.Every bill, every time. There is one approval path, and the database itself refuses any other way of marking a bill approved.
  6. The numbers update.Job costs, the price book and cash flow are calculated from approved bills only. The approved bill can be pushed back to QuickBooks.

The hard parts

Making a model reliable enough for money

Every model call in the product goes through one function. It forces a structured answer, checks it, and gives up after two minutes with one retry. That limit exists because a read once hung for ten minutes and left an invoice stuck. If the main provider is down, the same read moves to a second provider on its own and the switch is logged. Each company has an hourly limit on reads so a mistake can't run up a bill. A separate script scores the reader against invoices a human already approved, for accuracy, speed and cost, so I can test a new model before switching to it.

Never counting the same bill twice

Contractors get the same invoice by email, on paper and in a statement. The system catches repeats in layers: the identical file, the same invoice number from the same vendor, and a look-alike with a different number. A bill with an open duplicate question can't be approved until someone answers it.

Learning from corrections

When a person fixes how a line was sorted, the system remembers that fix for that vendor. The next bill from the same vendor is sorted correctly without the model being asked.

Keeping every company's data apart

Each company's data is walled off inside the database, not only in the app's code. There are 411 access rules across 139 tables. Every database change ends with a check that fails the change if a new table was left without its rule. I ran my own security audit in November 2026. The wall between companies held, and I moved three in-company rules out of the app and into the database, where they can't be skipped.

The hardest part: getting unit cost right

The hardest part was getting unit cost right. The first version barely worked. We stopped building, went back and worked out how the number had to come together, then started again from scratch. It took four or five attempts. How it is worked out is the core of the product, so I don't describe it here. What I can say is that it comes from the job's own real numbers, and that everything above exists to make those numbers trustworthy.

By the numbers

1,066commits in 14 weeks
4,633automated tests
150database tables
411data access rules
126screens
100API routes

How I built it

I built BuildMetrx with Claude Code as my engineering partner. Almost every commit was written with it. My part was deciding what the system should do and how the pieces fit, writing the rules it has to follow, and checking the work. Each feature started as a written spec, then a plan, then code with tests. Changes were tried on a demo company first, and nothing went live until I said so. My co-founder who leads design owns the look of the product and the websites.

I came to this from six years in sales, not from a computer science degree. What I brought was knowing how to ask a business owner the right questions, and the patience to rebuild until the numbers were right.

What I would do next

Manuel Hernandez · Miami, Florida · manuel@aureonai.com · More work