Anders has been working as a software engineer at Bontouch, a digital design agency, for eight years – mainly with Android, but recently also with multiplatform including Kotlin and Wasm. He enjoys learning from the community and sharing his own knowledge – the best way to learn is to teach others!
Building a real-time collaboration tool using CRDTs and Kotlin Multiplatform
13:10 > 40 min
A quick introduction to conflict-free replicated data types (CRDTs) and how you can use these to build a real-time collaborative tool, where multiple clients can make edits to the same data without conflicts, even while offline. We will go through an example of a solution we’ve built that relies on CRDTs in a Kotlin Multiplatform library, for native mobile, web frontend, and backend, with some learnings and tips along the way.
You will learn:
- The basics of Conflict-free Replicated Data Types and Hybrid Logical Clocks which enables distributed computing, where operations can be sent and received from other nodes and data ends up in an eventually consistent state.
- Learnings and tips from building such a realtime CRDT solution in a Kotlin Multiplatform library, consumed in Android, iOS, Web (TypeScript), and backend (Ktor), with communication via websockets.
- The effects on the way data is modeled and stored when using CRDTs, and solutions for common operations (deletion, maintaining ordering of objects, relations between objects, undo/redo, etc).
- How you can use CRDTs to build an offline-first and realtime multi-client app without worrying about complex syncing logic.
- Some recommendations and advice for architectural decisions regarding Kotlin Multiplatform, especially as consumed from non-JVM targets.