# yulianmartinez/b-weather architecture

> Architecture diagram of the GitHub repository yulianmartinez/b-weather, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yulianmartinez/b-weather
- Repository: https://github.com/yulianmartinez/b-weather

## Overview

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: [`app/src/main/java/com/ymd/bweather/navigation/AppNavHost.kt`](https://github.com/yulianmartinez/b-weather/blob/main/app/src/main/java/com/ymd/bweather/navigation/AppNavHost.kt) (Nav host), [`core/designsystem/src/main/java/com/bold/core/designsystem/theme/Theme.kt`](https://github.com/yulianmartinez/b-weather/blob/main/core/designsystem/src/main/java/com/bold/core/designsystem/theme/Theme.kt) (Design system), [`app/src/main/java/com/ymd/bweather/di/KoinInitializer.kt`](https://github.com/yulianmartinez/b-weather/blob/main/app/src/main/java/com/ymd/bweather/di/KoinInitializer.kt) (App init), [`core/common/src/main/java/com/bold/core/common/result/Resource.kt`](https://github.com/yulianmartinez/b-weather/blob/main/core/common/src/main/java/com/bold/core/common/result/Resource.kt) (Common)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App"]
  node_app_module[":app<br/>android app"]
  node_application["App init<br/>bootstrap<br/>[KoinInitializer.kt]"]
  node_nav_host["Nav host<br/>navigation host<br/>[AppNavHost.kt]"]
  node_root_ui["Root UI<br/>compose shell<br/>[BWeatherApp.kt]"]
end

subgraph group_core["Core"]
  node_core_common["Common<br/>shared util<br/>[Resource.kt]"]
  node_core_design["Design system<br/>compose ui kit<br/>[Theme.kt]"]
  node_core_model["Domain model<br/>business models<br/>[Weather.kt]"]
  node_core_network["Network<br/>weather api boundary<br/>[NetworkModule.kt]"]
end

subgraph group_feature["Features"]
  node_splash_feat["Splash<br/>feature slice<br/>[SplashScreen.kt]"]
  node_splash_vm["Splash VM<br/>mvi viewmodel<br/>[SplashViewModel.kt]"]
  node_splash_init["Init use case<br/>domain use case"]
  node_home_feat["Home<br/>feature slice<br/>[HomeScreen.kt]"]
  node_home_vm["Home VM<br/>mvi viewmodel<br/>[HomeViewModel.kt]"]
  node_home_repo["Weather repo<br/>data repository"]
  node_home_usecases["Weather use cases<br/>domain use cases"]
  node_settings_feat["Settings<br/>feature slice<br/>[SettingsScreen.kt]"]
  node_settings_vm["Settings VM<br/>mvi viewmodel"]
  node_settings_repo["Settings repo<br/>data repository"]
  node_settings_usecase["Update settings<br/>domain use case"]
end

node_application -->|"starts"| node_app_module
node_application -->|"uses"| node_core_common
node_application -->|"themes"| node_core_design
node_application -->|"hosts"| node_nav_host
node_root_ui -->|"applies"| node_core_design
node_nav_host -->|"routes"| node_core_common
node_nav_host -->|"enters"| node_splash_feat
node_nav_host -->|"navigates"| node_home_feat
node_nav_host -->|"navigates"| node_settings_feat
node_splash_feat -->|"binds"| node_splash_vm
node_splash_vm -->|"runs"| node_splash_init
node_splash_init -->|"reads"| node_core_model
node_home_feat -->|"binds"| node_home_vm
node_home_vm -->|"executes"| node_home_usecases
node_home_usecases -->|"depends on"| node_home_repo
node_home_repo -->|"calls"| node_core_network
node_home_repo -->|"maps to"| node_core_model
node_settings_feat -->|"binds"| node_settings_vm
node_settings_vm -->|"executes"| node_settings_usecase
node_settings_usecase -->|"depends on"| node_settings_repo
node_settings_repo -->|"contracts"| node_core_model
node_settings_repo -->|"uses"| node_core_common
node_core_network -->|"uses"| node_core_common
node_core_network -->|"maps to"| node_core_model
node_core_design -->|"ui primitives"| node_home_feat
node_core_design -->|"ui primitives"| node_settings_feat
node_core_design -->|"ui primitives"| node_splash_feat

click node_app_module "https://github.com/yulianmartinez/b-weather/blob/main/app/src/main/java/com/ymd/bweather/BWeatherApplication.kt"
click node_application "https://github.com/yulianmartinez/b-weather/blob/main/app/src/main/java/com/ymd/bweather/di/KoinInitializer.kt"
click node_nav_host "https://github.com/yulianmartinez/b-weather/blob/main/app/src/main/java/com/ymd/bweather/navigation/AppNavHost.kt"
click node_root_ui "https://github.com/yulianmartinez/b-weather/blob/main/app/src/main/java/com/ymd/bweather/ui/BWeatherApp.kt"
click node_core_common "https://github.com/yulianmartinez/b-weather/blob/main/core/common/src/main/java/com/bold/core/common/result/Resource.kt"
click node_core_design "https://github.com/yulianmartinez/b-weather/blob/main/core/designsystem/src/main/java/com/bold/core/designsystem/theme/Theme.kt"
click node_core_model "https://github.com/yulianmartinez/b-weather/blob/main/core/model/src/main/java/com/bold/core/model/weather/Weather.kt"
click node_core_network "https://github.com/yulianmartinez/b-weather/blob/main/core/network/src/main/java/com/bold/core/network/di/NetworkModule.kt"
click node_splash_feat "https://github.com/yulianmartinez/b-weather/blob/main/feature/splash/src/main/java/com/bold/feature/splash/presentation/SplashScreen.kt"
click node_splash_vm "https://github.com/yulianmartinez/b-weather/blob/main/feature/splash/src/main/java/com/bold/feature/splash/presentation/SplashViewModel.kt"
click node_splash_init "https://github.com/yulianmartinez/b-weather/blob/main/feature/splash/src/main/java/com/bold/feature/splash/domain/usecase/InitializeAppUseCase.kt"
click node_home_feat "https://github.com/yulianmartinez/b-weather/blob/main/feature/home/src/main/java/com/bold/feature/home/presentation/screen/HomeScreen.kt"
click node_home_vm "https://github.com/yulianmartinez/b-weather/blob/main/feature/home/src/main/java/com/bold/feature/home/presentation/viewmodel/HomeViewModel.kt"
click node_home_repo "https://github.com/yulianmartinez/b-weather/blob/main/feature/home/src/main/java/com/bold/feature/home/data/repository/WeatherRepositoryImpl.kt"
click node_home_usecases "https://github.com/yulianmartinez/b-weather/blob/main/feature/home/src/main/java/com/bold/feature/home/domain/usecase/GetCurrentWeatherUseCase.kt"
click node_settings_feat "https://github.com/yulianmartinez/b-weather/blob/main/feature/settings/src/main/java/com/bold/feature/settings/presentation/screen/SettingsScreen.kt"
click node_settings_vm "https://github.com/yulianmartinez/b-weather/blob/main/feature/settings/src/main/java/com/bold/feature/settings/presentation/viewmodel/SettingsViewModel.kt"
click node_settings_repo "https://github.com/yulianmartinez/b-weather/blob/main/feature/settings/src/main/java/com/bold/feature/settings/data/repository/SettingsRepositoryImpl.kt"
click node_settings_usecase "https://github.com/yulianmartinez/b-weather/blob/main/feature/settings/src/main/java/com/bold/feature/settings/domain/usecase/UpdateSettingsUseCase.kt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_module,node_application,node_nav_host,node_root_ui toneBlue
class node_core_common,node_core_design,node_core_model,node_core_network toneAmber
class node_splash_feat,node_splash_vm,node_splash_init,node_home_feat,node_home_vm,node_home_repo,node_home_usecases,node_settings_feat,node_settings_vm,node_settings_repo,node_settings_usecase toneMint
```

## Components

### App

Android shell and startup wiring

- [:app](https://github.com/yulianmartinez/b-weather/blob/main/app/src/main/java/com/ymd/bweather/BWeatherApplication.kt): android app · Android entry module and root composition · `app/src/main/java/com/ymd/bweather/BWeatherApplication.kt`
- [App init](https://github.com/yulianmartinez/b-weather/blob/main/app/src/main/java/com/ymd/bweather/di/KoinInitializer.kt): bootstrap · Application, activity, DI bootstrap, and root UI host · `app/src/main/java/com/ymd/bweather/di/KoinInitializer.kt`
- [Nav host](https://github.com/yulianmartinez/b-weather/blob/main/app/src/main/java/com/ymd/bweather/navigation/AppNavHost.kt): navigation host · Stitches feature routes into one app graph · `app/src/main/java/com/ymd/bweather/navigation/AppNavHost.kt`
- [Root UI](https://github.com/yulianmartinez/b-weather/blob/main/app/src/main/java/com/ymd/bweather/ui/BWeatherApp.kt): compose shell · App-wide Compose state and theme entrypoint · `app/src/main/java/com/ymd/bweather/ui/BWeatherApp.kt`

### Core

Shared foundations and external boundaries

- [Common](https://github.com/yulianmartinez/b-weather/blob/main/core/common/src/main/java/com/bold/core/common/result/Resource.kt): shared util · Cross-cutting contracts, results, and shared navigation destinations · `core/common/src/main/java/com/bold/core/common/result/Resource.kt`
- [Design system](https://github.com/yulianmartinez/b-weather/blob/main/core/designsystem/src/main/java/com/bold/core/designsystem/theme/Theme.kt): compose ui kit · Theme, tokens, icons, and reusable UI primitives · `core/designsystem/src/main/java/com/bold/core/designsystem/theme/Theme.kt`
- [Domain model](https://github.com/yulianmartinez/b-weather/blob/main/core/model/src/main/java/com/bold/core/model/weather/Weather.kt): business models · Pure weather, location, and settings models plus repository contracts · `core/model/src/main/java/com/bold/core/model/weather/Weather.kt`
- [Network](https://github.com/yulianmartinez/b-weather/blob/main/core/network/src/main/java/com/bold/core/network/di/NetworkModule.kt): weather api boundary · 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](https://github.com/yulianmartinez/b-weather/blob/main/feature/splash/src/main/java/com/bold/feature/splash/presentation/SplashScreen.kt): feature slice · Startup gate and initialization flow · `feature/splash/src/main/java/com/bold/feature/splash/presentation/SplashScreen.kt`
- [Splash VM](https://github.com/yulianmartinez/b-weather/blob/main/feature/splash/src/main/java/com/bold/feature/splash/presentation/SplashViewModel.kt): mvi viewmodel · Drives splash state and completion effects · `feature/splash/src/main/java/com/bold/feature/splash/presentation/SplashViewModel.kt`
- [Init use case](https://github.com/yulianmartinez/b-weather/blob/main/feature/splash/src/main/java/com/bold/feature/splash/domain/usecase/InitializeAppUseCase.kt): domain use case · Performs startup initialization work · `feature/splash/src/main/java/com/bold/feature/splash/domain/usecase/InitializeAppUseCase.kt`
- [Home](https://github.com/yulianmartinez/b-weather/blob/main/feature/home/src/main/java/com/bold/feature/home/presentation/screen/HomeScreen.kt): feature slice · Primary weather experience and search flow · `feature/home/src/main/java/com/bold/feature/home/presentation/screen/HomeScreen.kt`
- [Home VM](https://github.com/yulianmartinez/b-weather/blob/main/feature/home/src/main/java/com/bold/feature/home/presentation/viewmodel/HomeViewModel.kt): mvi viewmodel · Coordinates weather state, refresh, and search intents · `feature/home/src/main/java/com/bold/feature/home/presentation/viewmodel/HomeViewModel.kt`
- [Weather repo](https://github.com/yulianmartinez/b-weather/blob/main/feature/home/src/main/java/com/bold/feature/home/data/repository/WeatherRepositoryImpl.kt): data repository · Implements weather data access against network APIs · `feature/home/src/main/java/com/bold/feature/home/data/repository/WeatherRepositoryImpl.kt`
- [Weather use cases](https://github.com/yulianmartinez/b-weather/blob/main/feature/home/src/main/java/com/bold/feature/home/domain/usecase/GetCurrentWeatherUseCase.kt): domain use cases · Current weather, refresh, and location search logic · `feature/home/src/main/java/com/bold/feature/home/domain/usecase/GetCurrentWeatherUseCase.kt`
- [Settings](https://github.com/yulianmartinez/b-weather/blob/main/feature/settings/src/main/java/com/bold/feature/settings/presentation/screen/SettingsScreen.kt): feature slice · Preferences flow for language and temperature units · `feature/settings/src/main/java/com/bold/feature/settings/presentation/screen/SettingsScreen.kt`
- [Settings VM](https://github.com/yulianmartinez/b-weather/blob/main/feature/settings/src/main/java/com/bold/feature/settings/presentation/viewmodel/SettingsViewModel.kt): mvi viewmodel · Handles settings intents and state updates · `feature/settings/src/main/java/com/bold/feature/settings/presentation/viewmodel/SettingsViewModel.kt`
- [Settings repo](https://github.com/yulianmartinez/b-weather/blob/main/feature/settings/src/main/java/com/bold/feature/settings/data/repository/SettingsRepositoryImpl.kt): data repository · Persists and streams user settings · `feature/settings/src/main/java/com/bold/feature/settings/data/repository/SettingsRepositoryImpl.kt`
- [Update settings](https://github.com/yulianmartinez/b-weather/blob/main/feature/settings/src/main/java/com/bold/feature/settings/domain/usecase/UpdateSettingsUseCase.kt): domain use case · Encapsulates preference mutations · `feature/settings/src/main/java/com/bold/feature/settings/domain/usecase/UpdateSettingsUseCase.kt`

## Connections

- 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
