Enterprise software: the case for pulling billing out of the monolith
Mon, 30th Nov 2026 (Today)
Our current project has turned out to be the perfect study of an issue impacting enterprise software today. Over time, crucial business functions get deeply embedded in the large system around them. Not necessarily a problem, until one part of the business needs to change faster than the system it depends on. These days, a lot of things are moving fast.
Ask anyone who works at a cargo terminal where the money is lost, and billing is sure to come up. A ship is unloaded, cargo sits in the yard, it is moved, inspected, stored, reloaded. Each step is a chargeable event. Miss one and the revenue is gone. Charge one wrongly and the dispute costs more than the charge.
For decades that billing logic has lived inside the terminal operating system (TOS) itself: the large application that plans the yard, runs the cranes and records every move. It works, but it ties invoicing to everything else. A pricing change waits for a TOS upgrade. A billing bug can hold up an operational release.
That's far from ideal, so at Kaleris we're pulling billing out entirely. We're still in development, but we've learnt too much to keep it to ourselves.
Boundaries create options
The most important design rule is one we repeat constantly: the invoicing service must never reach into the operating system's tables. It doesn't query the TOS database, share its schema or assume its data model.
Instead, it receives small JSON messages when something billable happens. A container was discharged. A reefer was plugged in for 36 hours. A truck was weighed. Where the message came from is configuration, not code.
That boundary may feel unnecessarily rigid, but it has a practical payoff. Many terminals run more than one system, or are midway through replacing one. A billing service that accepts events from different sources works in a mixed environment.
It also separates operational risk. Invoicing can be released and scaled independently and, if something goes wrong, it fails on its own as well. A problem in pricing should never stop a crane.
Configuration only works when people can test it
Moving business rules out of code is often presented as an obvious win. In billing, it means commercial teams can update tariffs and message formats without waiting for a development project. But that configuration also transfers responsibility. The people making those changes will only feel confident if they can see and trust the results.
For us, that made testing tools just as important as the pricing engine itself. Users can test the structure of an incoming transaction and price a sample against a contract before anything goes live.
The broader lesson? Any move towards configurable enterprise software must include a safe way for users to validate what they have configured. Otherwise, flexibility simply moves the risk from the development team to the business.
Explainability is part of the product
Terminal tariffs are rarely simple. Pricing can depend on quantities, minimum and maximum charges, storage days, annual volume thresholds and negotiated discounts. Producing the correct number is essential, but a correct number that nobody can explain is nearly as bad as a wrong one.
Every priced line therefore keeps a record of how it was calculated: which contract matched, which band applied, which formula ran and what quantity went in. When a customer queries a charge, the answer should be on the screen, not in a developer's head.
Explainability is sometimes treated as supporting documentation or something to add once a system is working. In serious enterprise systems, it belongs in the design from the start. The calculation, the evidence behind it and the audit trail should be delivered together.
AI rewards clear engineering rules
As you would expect, we are also using AI coding assistants alongside our engineers to draft code, tests and migrations, including some of the repetitive work of keeping two database schemas aligned. Before a change is committed, two independent AI reviewers check it, seeing only the code and the ticket, while a human reviewer and QA still sign off every change.
A small team can now move at the pace of a much larger one, without lowering the bar for review. But productivity isn't the most useful lesson, we all know that AI can produce code quickly.
Instead, our key takeaway is that AI requires explicit engineering rules to work at its best. An airtight constraint such as "the invoicing service never accesses the TOS database" gives an assistant a clear boundary to work within and gives reviewers something concrete to test.
Writing those rules down for the AI has also made them clearer for the people on the team. That discipline matters as AI becomes part of more development workflows. The value comes not from handing over judgement, but from making the architecture, acceptance criteria and review process precise enough that both people and tools can apply them consistently.
Start with the boundaries, not the technology
There is a temptation when modernising enterprise software to start with technology choices: microservices, events, databases, APIs and, increasingly, AI-assisted development. Our experience has been that there are far more important decisions that need to come first.
Decide where the boundaries belong. Make the rules explicit. Give users a way to understand and test the outcomes. Then choose the technology that supports those decisions.
Billing happened to be our starting point. The lesson applies much more widely to the large enterprise systems many organisations are now trying to untangle.