What We Learned When We Rewrote Zainpay's Backend in Rust

In early 2021, Zainpay’s entire backend ran on a technology stack most business owners have never heard of: Scala and something called Akka. To our engineering team, it was elegant. The “actor model” — a way of handling thousands of simultaneous payment requests without them crashing into each other — felt like the right foundation for a payments company.

And for a while, it was.

But two years later, that same foundation became a technical debt.

The Licensing Shock #

In 2022, the company behind Akka changed its license. What had been free to use now required a commercial contract for production environments. The bill wasn’t public, but for a startup operating on Nigerian margins, “enterprise pricing” meant one thing: unaffordable.

We looked at staying on the old open-source version. It was technically possible — like driving a car with no service history. It moves, until it doesn’t. For a platform handling other people’s money, “probably fine” isn’t a strategy.

The Talent Wall #

Here’s something they don’t tell you in startup blogs: your technology choices determine who you can hire.

Scala is powerful. It’s also difficult. The learning curve isn’t steep — it’s a cliff. Advanced type systems, functional programming patterns, and the mental model of actors managing messages across a system… these aren’t skills you pick up in bootcamps.

In northern Nigeria (Kano, to be precise), where Zainpay is based, the pool of developers with production Scala experience was practically a puddle. Every new hire required months of training before they could touch production code. Every departure cost us institutional knowledge we couldn’t afford to lose.

We were optimizing for engineering purity while our hiring pipeline dried up.

The Search #

We needed something different. Four things, specifically:

Safety first. When you’re moving money, a memory leak isn’t a bug — it’s a liability. We needed guarantees, not hope.

Predictable speed. Payment processing doesn’t pause for garbage collection. We needed performance we could count on under load.

Future-proofing. Crypto and blockchain weren’t buzzwords to us. They were directions we needed the option to go.

People we could actually hire. A brilliant language means nothing if you can’t find developers to write in it.

We evaluated options. Rust kept surfacing.

Building something on Nigerian payment rails?

Zainpay's API handles virtual accounts, cards and settlements so you don't have to integrate each bank yourself.

Explore the docs

Why Rust #

Rust’s core idea is simple: the compiler prevents you from writing code that crashes or leaks memory. Not through runtime checks that slow things down — through rules enforced before your code ever runs. Data races? Caught. Memory leaks? Prevented. The guarantees are mathematical, not managerial.

For concurrency, we moved from Akka’s actor model to Tokio, Rust’s async runtime. It gave us the same ability to handle thousands of simultaneous payment flows, but without the licensing baggage or the cognitive overhead of managing actor lifecycles.

For our web layer, Actix — a Rust framework — benchmarked among the top three globally for speed and concurrency. We weren’t sacrificing performance for safety. We were getting both.

The Migration #

Rewriting a live payments platform is like replacing an engine while the car is on the highway. One wrong move and you’re explaining to merchants why their money disappeared.

We didn’t rush.

We started with the most critical piece: the transaction engine. Ported it to Rust. Kept the same API endpoints and request formats so our merchants wouldn’t notice. Ran both systems side by side under a single load balancer, watching every metric.

Our clients noticed something eventually. Payments settled faster. Downtime became rare. The platform felt… solid.

Then we looked at our infrastructure bill.

A basic server — 2 GB of RAM, 80 GB of storage — was now handling workloads that previously demanded far more. The efficiency wasn’t marginal. It was transformative.

Where We Are Now #

Rust runs 80% of Zainpay’s backend today.

The decision wasn’t about chasing a trendy language. It was about three hard realities: a license we couldn’t afford, a talent market we couldn’t access, and a reliability standard we couldn’t compromise.

Every technology choice is a bet. Some bets pay off immediately. Others cost you before you realize you’re losing. Our Scala bet was right until it wasn’t. The Rust bet? So far, it’s holding.

The lesson, if there is one: the best technology for your business isn’t the most elegant. It’s the one you can afford, the one your team can master, and the one that keeps working when everything else breaks.