MARS ROVER PHOTOS
An android app built using Kotlin that consumes NASA’s API to Mars photos captured by Curiosity, Spirit and Opportunity rovers. It has been built following Clean Architecture Principle, Repository Pattern, MVVM Architecture in the presentation layer as well as Jetpack components.
To run the app from Android Studio on your local machine you’ll need to add
api_key value in your
The API key can be generated from this link.
The app is split into 3 layer:
This is the core layer of the application. The domain layer is independent of any other layers thus domain models and business logic can be independent from other layers.This means that changes in other layers will have no effect on domain layer eg. screen UI (presentation layer) or changing database (data layer) will not result in any code change in domain layer.
Components of domain layer include:
- Models: Defines the core structure of the data that will be used within the application.
- Repositories: Interfaces used by the data sources classes implemented in the data layer.
The data layer is responsibile for selecting the proper data source for the domain layer. It contains the implementations of the repositories declared in the domain layer.
Components of data layer include:
- Models: Network models eg. RoverDto
- Repositories: Responsible for exposing data to the domain layer.
- Mappers: They perform data transformation between domain and dto models.
- Network: This is responsible for performing network operations eg. defining API endpoints using Ktor.
- Data Sources: Responsible for deciding which data to fetch from data sources eg. network or cache.
The presentation layer contains components involved in displaying information to the user. The main part of this layer are the composables(activity and screens) and viewmodels.
- Koin – Dependency Injection framework
- Compose – Modern toolkitfor building native UI.
- Palette API – Generate color palette from images
- Coil – Load images from network source.
- Compose Navigation – Navigation to composables.
- Ktor Client
- KotlinX Serialization – Serialization/Desirialization of JSON response from network.
- Paging 3 – Paging data fetched from network source.
- Mockk – Mocking library for Kotlin.
- Robolectric – Framework used to quickly and reliably run unit tests quick using the JVM
- KtLint – Kotlin linter.
- Detekt – Static code analysis tool for the Kotlin programming language
- KotlinX Kover – Gradle plugin for Kotlin code coverage tools.
This projects uses GitHub actions to run a build and execute all tests when creating a new PR.