How yulianmartinez/movienik works
1. Overall structure
- This is a multi-module Android app in Kotlin, organized around Clean Architecture + MVVM.
- The modules are:
- app: presentation/UI layer
- domain: business rules and contracts
- infrastructure: API access, data mapping, and repository implementations
- Dependency direction is intended to flow inward: presentation → domain ← infrastructure.
2. Primary business purpose
- The app is a TV series search client for the TVMaze public API.
- Users can:
- search for shows,
- open show details,
- browse episodes.
- The architecture is centered on these three use cases, which are reflected in the domain and infrastructure packages.
3. Presentation layer (app)
- The presentation module contains the Android UI surface:
- activity: SplashActivity, HomeActivity, DetailActivity
- fragment: HomeFragment
- widget: custom search UI (SearchMovienik)
- adapter: RecyclerView adapters/view holders for shows and episodes
- viewmodel: SearchViewModel, DetailViewModel, EpisodeViewModel
- This layer owns user interaction, rendering, and navigation, but should not contain API logic.
4. Navigation and screen flow
- The likely user flow is:
- SplashActivity opens the app,
- HomeActivity / HomeFragment presents search and results,
- selecting a show navigates to DetailActivity,
- episodes are fetched/displayed from the detail path.
- A router/HomeRouting.kt file suggests a centralized navigation helper rather than scattered intent handling.
5. ViewModel boundary
- The ViewModels are the bridge between UI and domain services.
- They likely orchestrate:
- search queries,
- show detail loading,
- episode loading,
- state presentation to adapters/views.
- The presence of extension files like CoroutineExtension, ViewModelExtension, and MessageExtension suggests common UI state/error handling patterns are standardized here.
6. Domain layer (domain)
- The domain module defines the core contracts and models:
- model: Show, Episode, Image
- dto: SearchResultDto
- repository: SearchRepository, DetailRepository, EpisodeRepository
- service: SearchService, DetailService, EpisodeService
- exception: domain-specific exceptions for each flow
- This module contains the business-facing API of the app and is intentionally independent of Android and network libraries.
7. Infrastructure layer (infrastructure)
- This module implements the domain repository contracts and handles all back-end communication.
- Key responsibilities:
- HTTP/API access through rest/endpoint and rest/manager
- request customization in rest/interceptor/RequestInterceptor
- mapping from network/entity objects into domain models via mapper
- repository implementations in repository
- This is the only layer that should know the details of the TVMaze API.
8. Data model translation
- Infrastructure uses its own transport/storage shapes:
- ShowEntity, EpisodeEntity, ImageEntity, SearchResultEntity
- Mappers such as ShowTranslate, EpisodeTranslate, ImageTranslate, and SearchResultTranslate convert between infrastructure entities and domain models.
- This mapping boundary is important: it isolates the rest of the app from API shape changes.
9. Networking and API composition
- The REST stack is split into:
- endpoint: API interface definitions for search, detail, and episodes
- manager: API manager wrappers for those endpoints
- interceptor: shared request behavior
- The DI modules (HttpClientModule, DispatcherModule, and feature modules under di/search, di/detail, di/episode) wire these pieces together.
- This suggests the app uses dependency injection to assemble networking, threading, and repositories per feature.
10. Feature-specific flows
- There are three clear vertical slices:
- Search: query TVMaze, receive a list of shows, render in the home screen
- Detail: fetch one show’s detail payload
- Episode: fetch episodes for a selected show
- Each slice has its own repository/service/endpoint/DI wiring, which keeps feature responsibilities separated.
11. UI rendering primitives
- Result lists are rendered through ShowAdapter/ShowViewHolder and EpisodeAdapter/EpisodeViewHolder.
- Selection callbacks are abstracted via OnShowSelectedListener and OnEpisodeSelectedListener.
- This keeps the adapters generic and lets the fragment/activity own navigation or detail actions.
12. Shared presentation utilities
- The extension package contains reusable UI helpers:
- image loading
- logging
- navigation
- click safety
- visibility helpers
- edit text validation
- These are cross-cutting presentation concerns and reduce boilerplate across activities, fragments, and ViewModels.
13. Android-specific resource layer
- The app includes standard Android resources for layouts, drawables, themes, and raw assets.
- Notable raw assets like empty_effect.json and nothing_here.json indicate the app uses visual empty-state animations/effects in the UI.
14. Testing boundaries
- The repository includes:
- unit tests in app/src/test
- instrumentation tests in app/src/androidTest
- infrastructure unit tests
- The README indicates tests exist for:
- ViewModels in presentation
- services in domain
- mappers in infrastructure
- That matches the layered architecture: each layer is tested at its own boundary.
15. Architecture summary for diagramming
- If you draw this repo, model it as:
- UI layer at the top, handling screens, adapters, and ViewModels
- Domain layer in the middle, exposing services, repository interfaces, models, and exceptions
- Infrastructure layer at the bottom, implementing repositories and calling the TVMaze API
- The key data flow is:
- user input → ViewModel → domain service → repository interface → infrastructure implementation → TVMaze API → mapper → domain model → UI state/rendering
Main entry points: infrastructure infrastructure · app app · ui Screens · service Services
Components 15
Presentation
Android UI, navigation, and ViewModels
- app · Presentation module with activities, fragments, adapters, and ViewModels
app - Screens · Splash, home, and detail screens plus the main fragment and custom widget
app/src/main/java/com/ymd/movienik/ui - ViewModels · Search, detail, and episode state orchestration for the UI
app/src/main/java/com/ymd/movienik/viewmodel - Adapters · RecyclerView adapters and holders for shows and episodes
app/src/main/java/com/ymd/movienik/adapter - Router · Centralized navigation and cross-cutting presentation helpers
app/src/main/java/com/ymd/movienik/router
Domain
Business rules, models, services, and repository contracts
- domain · Pure business layer with models, services, and contracts
domain - Services · Search, detail, and episode business operations
domain/src/main/java/com/ymd/domain/service - Repos · Repository interfaces consumed by the services
domain/src/main/java/com/ymd/domain/repository - Models · Show, episode, image, and search result types plus exceptions
domain/src/main/java/com/ymd/domain/model
Infrastructure
API access, mapping, repository implementations, and DI
- infrastructure · TVMaze API integration, translation, and repository implementations
infrastructure - DI · Modules that assemble HTTP clients, dispatchers, and feature bindings
infrastructure/src/main/java/com/ymd/infrastructure/di - Repo impls · Concrete implementations of the domain repositories
infrastructure/src/main/java/com/ymd/infrastructure/repository - REST stack · Endpoints, API managers, and request interception for TVMaze
infrastructure/src/main/java/com/ymd/infrastructure/rest - Mappers · Converts API entities into domain models
infrastructure/src/main/java/com/ymd/infrastructure/mapper - Entities · Network-facing data shapes for shows, episodes, images, and search results
infrastructure/src/main/java/com/ymd/infrastructure/entity
Connections 22
- app → Screens: contains · Android presentation surface
- app → ViewModels: contains · ViewModels live in the app module
- app → Adapters: contains · List adapters and view holders
- app → Router: contains · Navigation and shared UI helpers
- Screens → ViewModels: binds to · Screens observe and drive ViewModels
- Adapters → Screens: renders in · Adapters are hosted by screens
- Screens → Services: requests · User actions trigger domain use cases through ViewModels
- ViewModels → Services: orchestrates · ViewModels coordinate search/detail/episode flows
- domain → Services: contains · Core use-case services
- domain → Repos: contains · Repository contracts
- domain → Models: contains · Core data and exceptions
- Services → Repos: depends on · Services call repository interfaces
- infrastructure → DI: contains · Dependency wiring
- infrastructure → Repo impls: contains · Repository implementations
- infrastructure → REST stack: contains · HTTP and API composition
- infrastructure → Mappers: contains · Domain translation boundary
- infrastructure → Entities: contains · API transport shapes
- Repo impls → Repos: implements · Concrete data access behind contracts
- Repo impls → REST stack: fetches from · Repositories call API managers
- REST stack → Entities: returns · API responses are shaped as entities
- Mappers → Models: maps to · Transforms transport data into business models
- Entities → Mappers: translated by · Entities feed the mapping layer