Klementine Ventures

Engineering

Two Systems, One Set of Numbers: Notes on Building Enterprise Integrations

How we approach keeping a maintenance system and an ERP in sync - without breaking either of them.

Most of the companies we work with run two big systems that were never designed to talk to each other.

One is the maintenance system. It's where the technicians live - assets, work orders, preventive schedules, spare parts. The other is the ERP. It's where finance lives - suppliers, stock, purchasing, costs. Both are good at their jobs. Both are convinced they're the source of truth.

And somewhere in between sits a person re-typing purchase orders from one screen into the other, or a monthly spreadsheet that tries to explain why the stock count in maintenance doesn't match the stock count in finance.

An integration fixes that. Here's how we think about building one.

Decide who owns what - before writing any code

The single most important decision isn't technical. It's ownership.

For every piece of data, one system has to be the master. In a typical setup it looks something like this:

  • The ERP owns suppliers, part numbers, stock levels and costs. Money lives there, and so does the audit trail.
  • The maintenance system owns the maintenance work - work orders, which parts were used on which job, and requests to buy more.

Once that's agreed, the direction of every flow follows naturally. Master data flows out of the ERP into the maintenance system. Maintenance activity - parts issued, purchase requests - flows back into the ERP, where it becomes stock movements and costs.

Skip this step and you end up with two systems both editing the same record, quietly overwriting each other. That's not an integration; that's a slow-motion argument.

A handful of flows, not a firehose

It's tempting to "sync everything". We don't. A good integration is a small number of well-defined flows, each with a clear trigger and a clear destination. A typical set:

  1. Parts and suppliers - from the ERP to the maintenance system, so technicians search the same catalogue finance pays for.
  2. Stock levels - from the ERP, so "in stock" means the same thing everywhere.
  3. Approved purchase orders - from maintenance into the ERP, created properly as real purchase orders.
  4. Receipts - from the ERP back to maintenance when the goods arrive.
  5. Parts used on jobs - from maintenance into the ERP as stock issues and returns, so costs land where they should.

Notice the loop: a part issued on a job lowers stock in the ERP, and the new stock level flows back to maintenance. Each system only ever writes the thing it owns.

Always go through the front door

Enterprise systems have rules. A purchase order needs a valid supplier, a valid cost centre, the right tax, the right approval. The ERP enforces all of this - if you go through its supported APIs or business logic layer.

Writing straight into the database is faster to build and a nightmare to live with. You bypass the validation, you skip the audit trail, and the next upgrade breaks you in ways nobody can explain. Our rule is simple: every write goes through the system's own supported interface, as if a very fast, very patient user had typed it in.

Polling is fine. Really.

In an ideal world, every system would tell you the moment something changed. In practice, many enterprise systems don't offer outbound webhooks, or offer them in a form you can't rely on.

So we poll. Every fifteen minutes or so, the integration asks each system "what changed since last time?" and only passes the differences across. It's not glamorous, but it's predictable, easy to reason about, and kind to API rate limits. For stock and purchasing, near-real-time is plenty - nobody needs a spare bearing to appear in the other system within 200 milliseconds.

Make retries boring

Networks drop. APIs time out. A system goes down for maintenance at 2 AM. The integration will retry - and the worst thing it can do on a retry is create the same purchase order twice.

So every record that crosses the boundary is tracked: what it was, where it went, what ID it got on the other side. A retry checks that ledger first. If the record already made it, nothing happens. This one design choice is the difference between an integration people trust and one they quietly stop using.

Mind the other neighbours

The two systems you're connecting are rarely the only ones involved. There's often a warehouse system, a scanning app, or a legacy process already posting stock movements into the ERP.

Part of discovery is mapping who else writes to the same data, so the integration doesn't double-count a stock issue that the warehouse already recorded. It's the kind of thing that never shows up in a requirements document and always shows up in production.

Mapping is where the real work hides

The code is often the easy part. The hard part is agreeing that warehouse "MAIN" in one system is storeroom "Plant 1 Stores" in the other, that "EA" and "Each" are the same unit, and which cost centre a pump repair should land in.

We write this down in a short technical specification - every mapping, every direction, every schedule, every error case - and get it signed off before building. It feels slow. It's actually the fastest path, because it turns surprises into decisions made up front.

Tell someone when it goes wrong

Every integration fails eventually. The question is whether anyone notices.

We build in two things as standard: failure alerts, so a rejected record reaches a human the same day rather than the same quarter, and a daily reconciliation report that compares the two systems and lists any mismatch. The report is boring on a good day. On a bad day, it's the most valuable thing in the project.

Start small

If there's one piece of advice we give every client, it's this: prove it with one or two flows first. Pick the most painful manual process, connect it end to end against test environments, and let the people who'll use it poke holes in it.

A small proof of concept answers the scary questions - can we reach the system, does the API do what the brochure says, is the data cleaner or messier than we thought - for a fraction of the cost of the full build. Everything after that is just more of the same, done with confidence.

The quiet goal

A good integration is invisible. Nobody thanks it. The technician picks a part, finance sees the cost, the stock count matches, and nobody has to open a spreadsheet on the last Friday of the month.

That's the goal. Two systems, one set of numbers.

  • Ronald