How misterjedu/githubreposearch works
Project Type & Purpose
• Type: Native Android client app
• Purpose: Search GitHub repositories via the public GitHub REST API and display paginated results
• Architecture: MVVM + Repository pattern + Hilt DI + Paging 3 + Coroutines Flow
Main Components
1. Presentation Layer
– MainActivity
– GithubSearchFragment
– GithubSearchViewModel
– Adapters & ViewHolders (Paging adapters + RecyclerView)
2. Domain Layer
– GithubRepository interface
– GithubRepositoryImpl (business logic, orchestrates paging and network calls)
3. Data Layer
– NetworkModule (provides Retrofit, OkHttpClient)
– ApiService (Retrofit interface)
– Data models (Item, Owner, RepoData)
– PagingSource (GithubRepoPagingSource)
4. External System
– GitHub REST API (over HTTPS)
5. Dependency Injection
– Hilt Modules: NetworkModule, RepositoryModule, FragmentModule
Relationships & Data Flow
• User taps search in UI → Fragment
• Fragment calls ViewModel.search(query)
• ViewModel requests data from GithubRepository (exposed as Flow<PagingData<RepoData>>)
• Repository uses PagingSource which calls ApiService.searchRepos()
• Retrofit executes HTTP GET → GitHub API → JSON models → parsed into data classes
• Paging library assembles pages, emits to ViewModel → Fragment observes and updates RecyclerView via adapters
Architectural Patterns & Principles
• MVVM separates UI, state logic, and data
• Repository abstracts data retrieval/paging logic
• DI (Hilt) decouples component creation & lifecycles
• Paging 3 for incremental loading and back-pressure
• Coroutines + Flow for asynchronous, reactive streams
• Clear labels (e.g., “GithubSearchViewModel”)