gitmyhub

architecture-samples

Kotlin ★ 46k updated 2d ago

A collection of samples to discuss and showcase different architectural tools and patterns for Android apps.

Android Architecture Samples is Google's official reference app showing developers how to correctly structure a modern Android app using Kotlin, Jetpack Compose, and a recommended set of architecture patterns.

KotlinAndroidJetpack ComposeRoomHiltCoroutinessetup: moderatecomplexity 3/5

Android Architecture Samples is an official Google repository that demonstrates how to properly structure Android applications using modern tools and architectural patterns. Rather than being a finished product you ship, it is a reference implementation meant to be read, studied, and learned from.

The core of the repository is a deliberately simple to-do list app — the kind where you add tasks, mark them complete, and delete them. The app itself is not the point; it is intentionally simple so all the attention can go to studying how it is built rather than what it does. The same app is implemented across different branches of the repository, with each branch exploring a slightly different architectural approach, so developers can compare patterns side by side.

The current main branch showcases the recommended modern Android stack. The UI is built entirely with Jetpack Compose, which is Google's newer system for building Android interfaces using code rather than XML layout files. Navigation between screens uses the Navigation Compose library. Each screen is paired with a ViewModel — a class responsible for holding and managing the data that screen displays, surviving things like screen rotations without losing state. Data flows through the app reactively using Kotlin Coroutines and Flow, meaning the UI automatically updates when underlying data changes rather than needing to be told to refresh. Data is stored locally using Room, which is Android's recommended SQLite wrapper library. Dependency injection is handled by Hilt, which automatically provides components with the other components they depend on. The project also includes a comprehensive suite of unit, integration, and end-to-end tests.

An intermediate Android developer, or a beginner who has learned the basics, would use this when they want to understand how to connect all the modern Android pieces together in a maintainable, testable way.

The tech stack is Kotlin with the Android Jetpack suite.

Where it fits