ApolloRickAndMorty Save

just a side project to try out GraphQL and Dagger Hilt with Clean architecture and MVVM

Project README

About ApolloRickAndMorty

Hello there , In this project I tried showcasing how to build an Android Application with clean architecture and MVVM using some of the jetpack libraries with Kotlin Coroutines & Dagger Hilt. This App is using the Rick and Morty GraphQl as a remote data source.

This app is based on the Guide to app architecture article, Kotlin 1.4, and coroutine. I also used some android architecture components like LiveData, ViewModel.

I wrote a medium article to talk about GraphQL and how to implement it in an android application, feel free to check it out.

Project Architecture

Communication between layers

  1. UI calls method from ViewModel.
  2. ViewModel executes Use case.
  3. Use case executes one or multiple Repositorie function.
  4. The Repository returns data from one or multiple Data Sources(Remote-Rick and morty GraphQL , Local-Room DB). the repository is the single source of truth
  5. Information flows back to the UI where we display the data fetched from data sources.

I made a diagram to show the flow of the data between the three layers(data, domain , presentation) data flow diagram

Project Structure

  • Data
    • This is my data layer and consists of the Repository implementation class as well as the remote and local data sources and mappers
  • Domain
    • This is the domain layer and consists of the domain models as well as the usecases.
  • UI
    • This is the presentation layer. I have set up packages by feature here. This consists of the view related code.
  • DI
    • This is where Dagger related code lives , I wanted to try out Hilt and see what it can deliver.
  • Utils
    • This is where most extension functions and constants.

Libraries Used

  • ViewModel - store and manage UI-related data in a lifecycle conscious way
  • LiveData - notify the view when data changes .
  • ViewBinding - easily write code that interacts with view
  • Material - Material Components.
  • Coroutine - performs background tasks
  • Flows - for asynchronous data streams
  • Coil - An image loading library for Android backed by Kotlin Coroutines
  • Gson - JSON Parser
  • Apollo- GraphQL client for the JVM, Android and Kotlin multiplatform
  • Dagger Hilt - dependency injector
  • Room - Save data in a local database
  • Espresso // UI test
  • Barsita -UI tests Built on top of Espresso
  • Junit // unit tests
  • Truth // Makes your test assertions and failure messages more readable

Screenshots

CharactersActivity DetailsActivity

Open Source Agenda is not affiliated with "ApolloRickAndMorty" Project. README Source: HamdiBoumaiza/ApolloRickAndMorty
Stars
45
Open Issues
0
Last Commit
3 years ago

Open Source Agenda Badge

Open Source Agenda Rating