Badoo Zsolt Kocsi Aug 8, 2018

A Modern Kotlin-Based MVI Architecture

Article Summary

Zsolt Kocsi from Badoo reveals how their chat module kept losing first messages despite a full Clean Architecture rewrite. The culprit? Uncontrolled state mutations in a massively asynchronous app.

Badoo's engineering team open-sourced MVICore, their Kotlin-based MVI framework, after traditional architecture patterns failed to solve race conditions and edge cases in their chat feature. This deep dive explains how they moved beyond simple state reducers to build a production-ready solution.

Key Takeaways

Critical Insight

MVICore treats state changes as serialized transactions through a central Reducer, making complex async behavior predictable and debuggable.

The article breaks down optional components like Actor, NewsPublisher, and Bootstrapper that handle the messy real-world scenarios reducers alone can't solve.

About This Article

Problem

Badoo's chat module had bugs that were hard to reproduce because the app used lots of asynchronous operations with server pushes. Developers couldn't easily figure out what state the application was actually in without manually checking every variable.

Solution

MVICore solves this by using deterministic mappers built as internal Feature components. These can be wrapped in middleware to automatically log everything and provide a time-travel debugger for tracking how state changes over time.

Impact

The framework uses a centralized Reducer that treats state changes like transactions. This prevents race conditions and makes async behavior predictable and debuggable, which helps all teams working with the open-source library.