1 / 11
Design Android apps that stay easy to change as they grow: Google's recommended UI, domain, and data layers, unidirectional data flow, ViewModel and UiState, MVVM and MVI side by side, one-off events and process death, model mapping, offline-first repositories and sync, use cases, error handling…
MVVM and MVI, Clean Layers, Modularization, and Dependency Injection with Hilt for Apps That Scale
Read before you buy: the PDF here is a free sample — the first 20 pages of the 455-page book (payments, sales and reviews on this demo site are sample data). Get the full e-book at thenexbooks on Gumroad.
Build Android apps a whole team can keep changing, without a rewrite.
Most Android apps do not fail because one screen is hard. They fail slowly: every feature takes longer than the last, a change in one place breaks another, tests are rare because nothing can be created without the whole app, and the build gets slower every month. Architecture is the handful of decisions that prevents this: state that flows in one direction, one source of truth for every piece of data, explicit dependencies, a domain layer that knows nothing about screens or databases, and modules that make the wrong dependency impossible to compile.
This book teaches those decisions on one realistic Kotlin and Jetpack Compose app. Every pattern appears when it solves a real problem, and every chapter explains the trade-off: what the pattern costs and when you should not use it.
What's inside
- Why architecture matters, what it costs, and how Google's recommended UI, domain, and data layers map onto a real app, including when it is reasonable to deviate
- Unidirectional data flow and a single source of truth, traced from a Room table all the way to a composable and back
- ViewModel and immutable UiState, StateFlow, stateIn and WhileSubscribed, lifecycle-aware collection, scopes, and injected dispatchers
- MVVM and MVI in practice on two real screens, an honest comparison, and a clear way to choose and mix them
- One-off events and user messages without duplicates or losses, and surviving process death with SavedStateHandle
- Mapping network DTOs, Room entities, domain models, and UI models, with tested mappers
- Offline-first repositories, local writes synchronized in the background with WorkManager, use cases that earn their place, and errors that cross layers as values
- A testable architecture: fakes over mocks, a shared testing module, fixed clocks, Turbine, and fast JVM tests for Room, Compose UI, and Hilt with Robolectric
- Dependency injection from first principles, then Hilt in depth: components, modules, bindings, scopes, qualifiers, multibindings, entry points, assisted injection, and replacing bindings in tests
- Modularization: core and feature modules, api versus implementation, convention plugins in build-logic, type-safe navigation between feature modules that never depend on each other, and module rules enforced by the build
- Scaling a real app: migrating a legacy feature incrementally with the strangler fig pattern, architecture decision records, conventions, code review, and ownership
One running example, start to finish. You work on Waypoint, a fictional hiking trip planner by Northbeam Labs, a small product studio. Waypoint lets hikers browse and search trails, plan trips with a date and party size, and track their upcoming and finished hikes. You follow a single action, planning a hike on Falcon Crest Trail, through every layer of the app. The project is a modular Gradle build with a pure Kotlin domain, an offline-first data layer over Room and a REST API, Hilt wiring, and convention plugins, and it closes with an end-to-end case study that adds a brand-new Journal feature module. The backend is fictional and the app uses an in-memory demo data source and local test doubles, so you never need a real server.
Current and honest. The code was compiled and its JVM, Robolectric, and Hilt tests were run with Kotlin 2.4, Android Gradle Plugin 9.4, Gradle 9.8, Jetpack Compose, Navigation Compose with type-safe routes, Hilt 2.60, and Room 2.8 at the time of writing. The book contains no invented benchmarks or statistics, discusses third-party libraries neutrally as options, and clearly marks results that need a device. Every chapter includes Kotlin code, Tips, Notes, Warnings, exercises, and Key Takeaways, and the appendices give you a cheat sheet, templates and reference code, a production architecture checklist, and a glossary.
Format: PDF, 455 pages (A4), linked table of contents and bookmarks. English. First Edition, 2026. Published by thenexbooks. Includes the Waypoint starter project (Gradle, Kotlin, multi-module) used throughout the book. Requires JDK 21 and the Android SDK (Android Studio recommended) to build the code. For developers who already know Kotlin and the basics of Jetpack Compose. This book is independent and is not affiliated with, sponsored by, or endorsed by Google LLC, JetBrains, or the Kotlin Foundation.
Table of Contents
Part I — Foundations
- Ch 1 · Why Architecture Matters: Goals, Trade-offs, and Meet Waypoint
- Ch 2 · Google's Recommended Architecture: UI, Domain, and Data Layers
- Ch 3 · Unidirectional Data Flow and a Single Source of Truth
- Ch 4 · ViewModel and UiState: Modeling Screen State
- Ch 5 · Flows, Lifecycles, and Scopes: The Reactive Plumbing
Part II — Presentation Patterns: MVVM and MVI
- Ch 6 · MVVM in Practice: Building the Trails Feature
- Ch 7 · MVI in Practice: Intents, Reducers, and Side Effects
- Ch 8 · MVVM vs MVI: Choosing, Mixing, and Avoiding Cargo Cults
- Ch 9 · One-Off Events, User Messages, and Process Death
- Ch 10 · Mapping Models Between Layers: DTOs, Entities, Domain Models, and UI Models
Part III — Domain and Data Layers
- Ch 11 · Repositories and the Single Source of Truth in the Data Layer
- Ch 12 · Offline-First Writes and Synchronization
- Ch 13 · The Domain Layer: Use Cases That Earn Their Place
- Ch 14 · Error Handling Across Layers
- Ch 15 · Designing a Testable Architecture
Part IV — Dependency Injection with Hilt
- Ch 16 · Dependency Injection Fundamentals: Manual DI and the Composition Root
- Ch 17 · Hilt Essentials: Components, Modules, and Bindings
- Ch 18 · Scopes, Qualifiers, and Multibindings
- Ch 19 · Assisted Injection and Runtime Arguments
- Ch 20 · Testing with Hilt: Replacing Bindings on the JVM
Part V — Modularization
- Ch 21 · Why and How to Modularize: Core and Feature Modules
- Ch 22 · Convention Plugins and build-logic: Taming Gradle Configuration
- Ch 23 · Navigation Between Feature Modules
- Ch 24 · Module Boundaries, API Surfaces, and Dependency Rules
Part VI — Scaling a Real App
- Ch 25 · Migrating Legacy Code Incrementally
- Ch 26 · Architecture Decision Records for Waypoint
- Ch 27 · Scaling the Team and the Codebase
- Ch 28 · Case Study: Adding Waypoint Journal End to End
Appendices
A · Architecture Cheat Sheet
B · Templates and Reference Code
C · Production Architecture Checklist
D · Glossary
Book details
| Detail | |
|---|---|
| Pages | 455 |
| Format | PDF (A4) + Waypoint starter project (Gradle) |
| Language | English |
| Level | Intermediate to Advanced |
| Edition | 1st Edition (2026) |
| Download on this site | Free sample, first 20 pages (PDF) |
| Publisher | thenexbooks |
Files you get
No reviews yet. Only buyers can review.
More from thenexbooks