1. Home
  2. News
  3. Case study
Case study

What taking over a live production system looks like – lessons from the ReVend takeover

A software project takeover step by step: how a live system running ~170 reverse vending machines moved from Laravel 5.8 to Laravel 12 without downtime.

What taking over a live production system looks like – lessons from the ReVend takeover

Taking over a live production system means changing the team, and eventually the code, without the business or its users noticing. In practice that comes down to five steps: take an honest inventory, freeze the contracts the outside world depends on, build a safety net of tests and automation, replace the system piece by piece, and only then deliver the new features on the new foundation. Below we walk through each step using the ReVend takeover, where the inherited software ran a fleet of about 170 reverse vending machines that could not stop working.

The situation: inherited code and machines that cannot stop

ReVend supplies and runs reverse vending machines in Poland's deposit return system. A machine recognises a PET bottle or can by EAN and weight, collects it in a sealed bag and prints a deposit coupon redeemable at the till. Every transaction and every bag must be reported to the right deposit operator, and the machines generate 500–1300 requests per minute.

What we inherited was a common picture for a system that has grown under pressure:

  • a back office on Laravel 5.8, with code bypassing the framework – 87 routes plus 51 scripts living outside it,
  • an unversioned database schema, with only 2 migrations in the repository,
  • 2 automated tests and no automated deployment,
  • machine software written as procedural PHP, with settlement logic built for another market.

On top of that, the launch of the deposit system required integrating several operators at once, each with its own API and rules. Machines working in shops could not stop during the rebuild. That combination – fragile code, hard external deadline, zero tolerance for downtime – is exactly when a takeover needs a method rather than optimism.

Step 1: Inventory before you change anything

The first weeks of any takeover should produce a map, not new features. In projects like this we go through the repository, the servers and the database and write down what actually runs: which entry points exist, which scripts are called from outside the framework, which jobs run on a timer, what talks to the system from outside and what the system calls in turn.

In ReVend, the facts that shaped the whole plan were exactly of this kind: 51 scripts outside the framework and a production database schema that the repository, with its 2 migrations, could not recreate. Neither is visible from a feature list or a demo of the admin panel. Both decide how risky every later change will be.

A useful output of this step is a short list of "things we must not break", ranked by the damage a failure would cause. For a fleet of devices, the top of that list is obvious: the machines must keep talking to the server, and coupons and bag reports must not be lost or doubled.

Step 2: Freeze the contracts the outside world depends on

The hardest part of a live system to change is usually not the code, but whatever sits on the other side of its interfaces. In ReVend those were machines spread across shops. Updating software on all of them on a single day was never a realistic option.

So two things were treated as fixed:

  • The machine API (v1) kept the same contract. Same endpoints, same request and response formats. On switch-over day no machine needed an update.
  • The database schema moved unchanged into migrations of a new Laravel 12 application. Old and new code could work on the same data, and there was no one-off conversion that would be hard to roll back.

New requirements went into a separate version instead of breaking the old one. Machine API v2 for manufacturers adds per-machine credentials with encrypted secrets and scopes, HMAC-SHA256 request signing with replay protection, idempotency keys, an OpenAPI 3.1 specification and a test console in the panel. Today both versions run side by side.

Step 3: Build the safety net – tests and CI

You cannot change a live system quickly if every change has to be checked by hand. At takeover ReVend had 2 automated tests. Today there are about 980 in 146 files, and every change is tested in CI – GitHub Actions – on MariaDB, the same database engine as production.

The order in which tests are written matters. In takeovers we start with tests that protect external contracts: API responses the devices rely on, export formats sent to partners, amount calculations. These let the team refactor the inside of the system while knowing that nothing visible from the outside has changed. Unit tests for new logic follow with each new feature.

The schema work belongs here too. Going from 2 migrations to 206 migrations describing 81 tables means the database can be rebuilt from the repository on a clean environment – a precondition for meaningful automated testing.

Step 4: Replace in pieces, remove old code last

The new application took over functions gradually. The rule was simple: old code was removed only when nothing used it any more. There was no "big night" when the old system was switched off and everyone hoped the new one would hold. The machines never noticed the switch.

The result is one application with 295 routes instead of 87 routes plus 51 standalone scripts, and 39 scheduled jobs running as managed processes. If you want the broader reasoning behind this approach, we covered it in our article on legacy PHP modernisation without a big-bang rewrite.

The same discipline applied to performance. Every fix started with a measurement of real production traffic and ended with a before/after comparison. On a system handling hundreds of requests per minute, guessing where the bottleneck is tends to produce complexity rather than speed.

Step 5: Deliver what the business actually needed

A takeover that only stabilises the system is half the job. ReVend needed the deposit return integrations, and the new foundation is where they were built:

  • one pipeline for seven deposit operators – Kaucja, Polka, PSK, Reselekt, Zwrotka, COMP and Forcom – over REST, OAuth and Apache Kafka with TLS/SASL, with a synchronisation queue and export status per operator,
  • integrations with the national product register CBDOK, three coupon APIs for POS systems and company verification by tax ID in the VAT white list,
  • an operations panel with machine availability learned from 28 days of history, bag-fill forecasts every 10 minutes with collection plans and a morning email, and anomaly detection feeding tasks into a built-in CRM.

Idempotency ran through all of it. Machines resend data, and 89% of machine packets turned out to be repeats. They are now discarded before processing, and idempotency keys and duplicate filtering mean a resent transaction never doubles a coupon or a bag report. The full story, with the before/after numbers, is in the ReVend case study.

What to ask before handing a live system to a new vendor

Whether the new team sits down the corridor or works nearshore from another country, the questions are the same. Before you sign, ask the vendor:

  1. What will the first weeks produce – a written inventory and risk list, or new features straight away?
  2. Which external contracts will you freeze, and how will you prove they still behave the same?
  3. Which tests will you write first, and will they run on the same database engine as production?
  4. How will you replace the old code, and how will you know a piece can be removed?
  5. How do you handle data that partners or devices send twice?
  6. How will performance changes be measured on real traffic?

If the answers are vague, the takeover will be too. For the practical side of working with a team in Poland – time zones, contracts and IP – see our guide to nearshore software development in Poland.

Next step

If you are about to take a live system away from its current vendor, or you have inherited one that cannot stop, take a look at how we approach backend modernisation or get in touch. We usually start by agreeing what must not break, and work out the plan from there.

FAQ

Frequently asked questions

How long does it take a new vendor to take over a live system?

It depends on the size of the system and on how much is documented, so any fixed number quoted before an inventory is a guess. A good vendor will first deliver a written map of the system and a risk list, and only then commit to a plan for changes.

Do we need the previous vendor's cooperation to switch software agency?

It helps, but the essentials are repository access, server and database access, and credentials to the external services the system uses. Without the previous vendor, the inventory step simply takes longer, because the knowledge has to be recovered from the code and the running system.

Should a takeover start with a rewrite?

Rarely. A rewrite changes everything at once, while a live system needs its external behaviour to stay predictable. In ReVend the database schema and the machine API contract stayed the same, and the old code was replaced gradually.

Can new features be delivered during a project rescue?

Yes, once the safety net is in place. In ReVend the integrations with seven deposit operators were built on the new Laravel 12 application, covered by automated tests running in CI.

How to turn this topic into a project

JiraSoft looks at topics like this through the lens of a real system: data, backend, API integrations, B2B workflows, Google visibility and content prepared for AI answers. This article is a starting point for a practical workflow conversation.

Turn this topic into a concrete project

Send the current situation, system stack and business goal. We will suggest the first delivery step.

Book a free call +48 887 883 084

#softwareThatDelivers

No noise. Real systems. Software that runs in production.

Talk about the project