How yulianmartinez/b-weather works
1. Repository shape
This is a modular Android app built around three top-level concerns: :app for the Android shell, :core for shared foundations, and :feature for user-facing flows. The codebase is organized to support Clean Architecture and feature isolation.
2. App bootstrap
The :app module contains the Android entry point: BWeatherApplication, MainActivity, and the root Compose app (BWeatherApp). Its job is to initialize dependency injection, apply app-wide state, and host the navigation graph.
3. Shared core layer
core/common holds cross-cutting utilities and contracts such as Resource, TemperatureUtils, and shared destination definitions. core/designsystem centralizes Compose theme, typography, colors, shapes, icons, and reusable UI primitives like cards, text, images, loading indicators, and dialogs.
4. Domain model boundary
core/model defines the pure business objects used across features: weather types (Weather, ForecastDay, WeatherCondition), location data (LocationData), and user preferences (UserSettings). It also includes the SettingsRepository contract, which is consumed by feature-specific implementations.
5. Network boundary
core/network is the infrastructure module for WeatherAPI integration. It contains Retrofit APIs (WeatherApi, SearchApi), DTOs, a NetworkModule for DI, and an ApiKeyInterceptor that injects the API key into requests. This module is the app’s main external-service boundary.
6. Feature modules as vertical slices
Each feature module (feature/splash, feature/home, feature/settings) is self-contained and follows the same layering: data, domain, presentation, navigation, and di. That makes each feature independently diagrammable as a mini clean-architecture stack.
7. Home flow
feature/home is the primary weather experience. Its data layer has WeatherRepositoryImpl, domain layer exposes WeatherRepository plus use cases for current weather, refresh, and location search, and the presentation layer is split into Compose screens/components, MVI state contracts, and HomeViewModel.
8. Settings flow
feature/settings manages app preferences. SettingsRepositoryImpl persists and streams user settings, UpdateSettingsUseCase encapsulates preference updates, and the Compose/MVI presentation layer renders the settings screen and dispatches intents like language and temperature-unit changes.
9. Splash/init flow
feature/splash is the startup gate. InitializeAppUseCase performs app initialization work, SplashViewModel drives the splash state/effects, and navigation hands off to the next destination once initialization is complete.
10. Presentation pattern
The UI is Compose-first and follows MVI. Screens are stateless composables, Intent objects describe user actions, State objects hold immutable UI state, and Effect objects carry one-off events such as navigation. ViewModels translate intents into state updates using coroutines and flows.
11. Navigation structure
Navigation is split between a shared destination contract in core/common and feature-local navigation entry points (HomeNavigation, SettingsNavigation, SplashNavigation). The app-level AppNavHost stitches the feature routes together into a single navigation graph.
12. Dependency injection
Koin is the DI mechanism across the repo. The network, splash, home, and settings modules each expose their own Koin module, and the app bootstraps them at startup so repositories, use cases, and ViewModels can be resolved without manual wiring.
13. Main data flow
User actions enter the feature UI as intents, flow into ViewModels, then into use cases and repositories. Repositories talk either to WeatherAPI through core/network or to local preference storage for settings, then return domain models back up to the UI as state.
14. Testing and quality
The project has unit and Compose UI tests across core utilities, network interception, repositories, use cases, ViewModels, and screens. Kover is used for coverage reporting, which reinforces the module boundaries and the MVI/domain logic.
15. Architecture diagram takeaway
A correct diagram should show :app at the top, feature modules as vertical slices, core/designsystem and core/common as shared dependencies, core/network as the external API boundary, and core/model as the shared domain model boundary.
Main entry points: AppNavHost.kt Nav host · Theme.kt Design system · KoinInitializer.kt App init · Resource.kt Common
Components 19
App
Android shell and startup wiring
- :app · Android entry module and root composition
app/src/main/java/com/ymd/bweather/BWeatherApplication.kt - App init · Application, activity, DI bootstrap, and root UI host
app/src/main/java/com/ymd/bweather/di/KoinInitializer.kt - Nav host · Stitches feature routes into one app graph
app/src/main/java/com/ymd/bweather/navigation/AppNavHost.kt - Root UI · App-wide Compose state and theme entrypoint
app/src/main/java/com/ymd/bweather/ui/BWeatherApp.kt
Core
Shared foundations and external boundaries
- Common · Cross-cutting contracts, results, and shared navigation destinations
core/common/src/main/java/com/bold/core/common/result/Resource.kt - Design system · Theme, tokens, icons, and reusable UI primitives
core/designsystem/src/main/java/com/bold/core/designsystem/theme/Theme.kt - Domain model · Pure weather, location, and settings models plus repository contracts
core/model/src/main/java/com/bold/core/model/weather/Weather.kt - Network · Retrofit APIs, DTOs, interceptor, and network DI
core/network/src/main/java/com/bold/core/network/di/NetworkModule.kt
Features
Vertical slices for user flows
- Splash · Startup gate and initialization flow
feature/splash/src/main/java/com/bold/feature/splash/presentation/SplashScreen.kt - Splash VM · Drives splash state and completion effects
feature/splash/src/main/java/com/bold/feature/splash/presentation/SplashViewModel.kt - Init use case · Performs startup initialization work
feature/splash/src/main/java/com/bold/feature/splash/domain/usecase/InitializeAppUseCase.kt - Home · Primary weather experience and search flow
feature/home/src/main/java/com/bold/feature/home/presentation/screen/HomeScreen.kt - Home VM · Coordinates weather state, refresh, and search intents
feature/home/src/main/java/com/bold/feature/home/presentation/viewmodel/HomeViewModel.kt - Weather repo · Implements weather data access against network APIs
feature/home/src/main/java/com/bold/feature/home/data/repository/WeatherRepositoryImpl.kt - Weather use cases · Current weather, refresh, and location search logic
feature/home/src/main/java/com/bold/feature/home/domain/usecase/GetCurrentWeatherUseCase.kt - Settings · Preferences flow for language and temperature units
feature/settings/src/main/java/com/bold/feature/settings/presentation/screen/SettingsScreen.kt - Settings VM · Handles settings intents and state updates
feature/settings/src/main/java/com/bold/feature/settings/presentation/viewmodel/SettingsViewModel.kt - Settings repo · Persists and streams user settings
feature/settings/src/main/java/com/bold/feature/settings/data/repository/SettingsRepositoryImpl.kt - Update settings · Encapsulates preference mutations
feature/settings/src/main/java/com/bold/feature/settings/domain/usecase/UpdateSettingsUseCase.kt
Connections 27
- App init → :app: starts · Application bootstraps the Android shell
- App init → Common: uses · Relies on shared contracts and result wrappers
- App init → Design system: themes · Root UI is wrapped in the shared design system
- App init → Nav host: hosts · Launches the app navigation graph
- Root UI → Design system: applies · Uses shared theme and UI primitives
- Nav host → Common: routes · Uses shared destination definitions
- Nav host → Splash: enters · Starts at the splash flow
- Nav host → Home: navigates · Routes into the home flow
- Nav host → Settings: navigates · Routes into settings flow
- Splash → Splash VM: binds · Screen is driven by splash state and effects
- Splash VM → Init use case: runs · ViewModel triggers initialization logic
- Init use case → Domain model: reads · Initialization may depend on domain contracts
- Home → Home VM: binds · Screen is driven by MVI state
- Home VM → Weather use cases: executes · ViewModel delegates work to domain use cases
- Weather use cases → Weather repo: depends on · Use cases read weather data through the repository
- Weather repo → Network: calls · Repository fetches weather data from network APIs
- Weather repo → Domain model: maps to · Converts DTOs into shared domain models
- Settings → Settings VM: binds · Screen is driven by settings state
- Settings VM → Update settings: executes · ViewModel delegates preference updates
- Update settings → Settings repo: depends on · Use case mutates settings through repository
- Settings repo → Domain model: contracts · Implements shared settings repository contract
- Settings repo → Common: uses · Shares result and utility types
- Network → Common: uses · Network layer shares result and utility helpers
- Network → Domain model: maps to · DTOs are translated into domain models
- Design system → Home: ui primitives · Feature screens reuse cards, text, loading, and images
- Design system → Settings: ui primitives · Feature screens reuse shared Compose UI
- Design system → Splash: ui primitives · Splash uses shared loading and themed assets