/GitHubUsers

GitHub users sample app.

Primary LanguageKotlin

๐Ÿ‘ฅ GitHubUsers

GitHubUsersUI

Sample app for searching github users.

This application is using the latest tools and libraries with Hexagonal Architecture + MVI pattern.

โš’๏ธ Tools

๐Ÿง‘๐Ÿปโ€๐Ÿ’ป Development

  • 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.

๐Ÿงช Test

๐Ÿ‘Œ Quality

All used dependencies can be accessed in the DependenciesFile

๐Ÿ› Architacture & Patterns

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.

๐Ÿงฉ Application modules

  • 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:

GitHubUsersArchitecture

๐Ÿ‘๏ธ๐Ÿ Presentation Pattern

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

๐Ÿงช๐Ÿ Testing Pattern

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.