Android Tutorial #3: Repository Pattern — Single Source of Truth

Your app calls an API. It also reads from a local database. Sometimes the API is down. Sometimes the user has no internet. Where does the data come from? Without a clear answer, your app becomes unpredictable. One screen shows fresh data from the API. Another screen shows stale data from the database. The user sees different information depending on which screen they check first. The repository pattern solves this. It gives your app a single source of truth — one place where data lives. Every screen reads from the same source. ...

July 4, 2026 · 9 min

KMP Tutorial #16: Building the Shared Data Layer — Offline-First with Ktor and SQLDelight

In the previous tutorial, we set up the Notes app architecture with a local database and shared ViewModels. Everything works offline. But real apps need to sync with a server. In this tutorial, we build the shared data layer — adding a Ktor API client, Data Transfer Objects (DTOs), an offline-first sync pattern, and a database migration. All of this code lives in commonMain and runs on both Android and iOS. ...

April 6, 2026 · 8 min