Skip to content

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

Notifications You must be signed in to change notification settings

ihebchiha/ApolloRickAndMorty

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

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. the repository is the single source of truth (maybe i'll add room to support local data source later)
  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 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- networking
  • Dagger Hilt - dependency injector
  • 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

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 100.0%