All builds

Business records tool / 2026 / In progress · Anonymized work

Operations Ledger.

A purchase ledger that saves a purchase and all its records together, or saves nothing

The hard part
Stopping one purchase from being recorded twice when a request is sent again, or the same invoice arrives under a new key.
Works today
The ledger records purchases from invoices, checks every total in whole numbers and saves each purchase with all its records, or nothing.
Role
Software engineering
Built with
TypeScript · Node.js · SQLite · MCP · Zod · JavaScript · HTML · CSS · Lucide

01What I built

The problem.

Recording a purchase from an invoice can go wrong in two ways that are easy to miss. Rounding can make the lines add up to a slightly different total from the invoice. And if a request is sent again, or the same invoice arrives twice, the purchase can be recorded twice.

What I built.

Operations Ledger records purchases from invoices. Each invoice arrives already split across its lines, and that split has been checked. First the ledger reads the request and turns money and amounts into whole numbers, so nothing is lost to rounding. Then a calculator works out the discounts, the invoice's separate amounts and the split again. If anything is off by even a little, nothing is saved. Last, the ledger saves the purchase and its lines. With them it saves the stock records, a history entry and the answer a repeated request will get. All of these are saved in one SQLite A technical worddatabase transactionA group of database changes saved together, so either all of them are saved or none are., so either all of it is saved or none of it is.

The ledger

TypeScript, Node.js, SQLite, MCP, Zod

Request reader
Checks the input, then turns money and amounts into whole numbers of the smallest unit.
Purchase calculator
Works out the discounts, the invoice's separate amounts and the split again. It stops if anything is off at all.
Retry check
Matches the key, the action's name and a short code made from the request. An exact repeat gets the first answer back, and a changed one is refused.The storySaving a purchase and its retry answer together
Invoice check
Finds a purchase that is already saved, even when it comes with a new request key.
Purchase write
Locks the database, then saves the purchase, its lines and its stock records. The history entry and the retry answer are saved with them, all or nothing.The storySaving a purchase and its retry answer together

The dashboard

TypeScript, Node.js, MCP, HTML, CSS, JavaScript

Operations Snapshot Dashboard
Request guard
Checks each request before fetching anything. The request must name the right site and only ask to read. Its web address must be short enough, and its report options must make sense.
Source connections
One connection per system starts and refreshes on its own, so one failure doesn't throw away the other's data.
Snapshot checks
Picks the newest record first. Then it checks the format version and the features the system says it has. Last, it checks that the content matches its fingerprint code and that the times make sense.The storyChecking the newest snapshot so a broken update stays visible
Combined view
Keeps each system's status, the data it accepted and the reason for any error. Expired data gets an out-of-date label.The storyChecking the newest snapshot so a broken update stays visible
Background service
A background service for my user account starts the server when I sign in, and restarts it if it stops by surprise.

Confidential work. Names and identifying business details have been changed.

02The journey

What broke, and what changed.

Broke, then fixedA decisionA milestone

  1. 01 of 08DecidedOperations Snapshot Dashboard

    Pick the newest snapshot first, then check it

    The questionEach system sends copies of its data, called Operations Ledger · Operations Snapshot Dashboard · The dashboardSnapshot checksPicks the newest record first. Then it checks the format version and the features the system says it has. Last, it checks that the content matches its fingerprint code and that the times make sense.See it in the map above. When the newest snapshot fails a check, the dashboard could look back for an older one that passes. That would hide a failure in the system behind old data.

    What I choseThe newest record is chosen first and checked second. A broken update stays on screen as broken.

03Today

Where it stands.

Work done in another system still needs its own check, to make sure the two records match. Some kinds of correction are not supported yet.