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
- Single immutable State object eliminates race conditions from parallel async operations
- Feature component encapsulates business logic with Wish, State, and News parameters
- Built-in middleware enables logging and time-travel debugging out of the box
- A/B tests showed message-sending gaps even after Clean Architecture rewrite
MVICore treats state changes as serialized transactions through a central Reducer, making complex async behavior predictable and debuggable.
About This Article
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.
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.
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.