Sample app for searching github users.
This application is using the latest tools and libraries with Hexagonal Architecture + MVI pattern.
- Application entirely written in Kotlin
- Jetpack Compose for the ui
- Asynchronous processing using Coroutines
- Dependency injection with Hilt
- Retrofit for the HTTP client
- Image loading with Coil, it's written in Kotlin, uses coroutines, and supports Jetpack Compose.
- Robolectric for faster ui tests
- Mockk for mocking objects
- MockWebServer for mocking apis
All used dependencies can be accessed in the DependenciesFile
This project is based on the Hexagonal Architecture by Alistair Cockburn. The application also relies heavily on modularization for better separation of concerns and encapsulation.
- app - The Application module. It contains all the initialization logic for the Android environment and starts the Jetpack Navigation Compose Graph.
- features - The module/folder containing all the features (visual or not) from the application
- search-api - Search feature port.
- search - Search screen of the application used for searching users the adapter for the search-api.
- user-detail-api - User detail feature port.
- user-detail - User detail screen to show user detailed info and the adapter for the user-detail-api.
- domain - The modules containing the most important part of the application: the business logic. This module depends only on itself and all interaction it does is via dependency inversion.
- data - The module containing the data (repository, remote) from the app and uses the repository pattern.
- repository - The port for data layer.
- remote - The remote adapter for the data layer.
- libraries - The module that contains libraries that may be used by any module of the app.
- core - Includes common components, functions, and resources that may be needed to share between several modules.
- design - Includes common components and resource for the UI.
- navigation - Only containing the UI destinations and destination arguments.
- test - The module that shares common components and functions for testing.
To better represents the idea behind the modules, here is an architecture image representing the flow of dependency:
This application uses MVI pattern for the presentation module, the key advantages of MVI is:
- Single source of truth - one immutable state common to all layers, as the only source of truth
- Unidirectional and cyclic data flow
- Easiness of catching and fixing bugs
- Easiness of code testability
The project uses BDD (Behaviour Driven Development) and Robot pattern, cucumber library is not used and decided to go with a simpler approach. Using BDD along with the Robot pattern makes test cases look simpler and more human-readable.