# lylio/kotlinweatherapp architecture

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

- Interactive diagram: https://gitdiagram.com/lylio/kotlinweatherapp
- Repository: https://github.com/lylio/kotlinweatherapp

## Overview

BasicWeatherApp is an Android weather app: users can view current conditions and forecasts for their device location or search for a city. The documented and sampled flow runs from app navigation into a screen and its ViewModel, through use cases and repositories, to OpenWeatherMap; weather responses then supply the UI. The graph also preserves forecast presentation, location access, data models, and dependency wiring. Source excerpts confirm key calls; some unsampled ViewModel and location connections are shown only where the README documents the layered architecture.

Main entry points: [`app/src/main/java/com/botsheloramela/basicweatherapp/ui/viewmodel/HomeViewModel.kt`](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/ui/viewmodel/HomeViewModel.kt) (Home ViewModel), [`app/src/main/java/com/botsheloramela/basicweatherapp/ui/components`](https://github.com/lylio/kotlinweatherapp/tree/main/app/src/main/java/com/botsheloramela/basicweatherapp/ui/components) (Weather cards), [`app/src/main/java/com/botsheloramela/basicweatherapp/data/repository/WeatherRepositoryImpl.kt`](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/data/repository/WeatherRepositoryImpl.kt) (Weather repository), [`app/src/main/java/com/botsheloramela/basicweatherapp/navigation/NavGraph.kt`](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/navigation/NavGraph.kt) (App navigation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["App and presentation"]
  node_activity["Main activity<br/>[MainActivity.kt]"]
  node_navigation["App navigation<br/>[NavGraph.kt]"]
  node_home["Home screen<br/>[HomeView.kt]"]
  node_forecast["Forecast screen<br/>[ForecastView.kt]"]
  node_homevm["Home ViewModel<br/>[HomeViewModel.kt]"]
  node_forecastvm["Forecast ViewModel"]
end

subgraph group_domain["Weather domain"]
  node_device["Device location"]
  node_current["Current weather use cases"]
  node_city["City search use case"]
  node_forecastcase["Forecast use case"]
end

subgraph group_data["Data and services"]
  node_locationrepo["Location repository"]
  node_weatherrepo["Weather repository"]
  node_api["Weather API client<br/>[WeatherApi.kt]"]
  node_di["Dependency wiring<br/>[AppModule.kt]"]
  node_locationdi["Location wiring<br/>[LocationModule.kt]"]
end

subgraph group_support["Models and presentation support"]
  node_models["Weather response models"]
  node_cards["Weather cards"]
  node_time["Date and time helpers<br/>[DateTimeUtils.kt]"]
  node_weatherutils["Weather display mapping<br/>[WeatherUtils.kt]"]
  node_theme["Color theme<br/>[Color.kt]"]
end

node_user(("Weather user"))
node_openweather{{"OpenWeatherMap"}}

node_user -->|"opens app"| node_activity
node_activity -->|"shows navigation"| node_navigation
node_navigation -->|"routes to"| node_home
node_navigation -->|"routes to"| node_forecast
node_home -->|"requests weather"| node_homevm
node_forecast -->|"observes state"| node_forecastvm
node_homevm -->|"gets location"| node_device
node_homevm -->|"fetches conditions"| node_current
node_homevm -->|"searches city"| node_city
node_homevm -->|"fetches forecast"| node_forecastcase
node_forecastvm -.->|"requests forecast"| node_forecastcase
node_device -.->|"gets device location"| node_locationrepo
node_current -.->|"requests conditions"| node_weatherrepo
node_city -.->|"requests city data"| node_weatherrepo
node_forecastcase -->|"requests forecast"| node_weatherrepo
node_weatherrepo -->|"calls endpoints"| node_api
node_api -->|"fetches weather"| node_openweather
node_di -->|"binds implementation"| node_weatherrepo
node_locationdi -->|"binds implementation"| node_locationrepo
node_home -->|"renders weather"| node_cards
node_forecast -->|"renders forecast"| node_cards
node_cards -->|"formats dates"| node_time
node_cards -->|"maps weather icons"| node_weatherutils
node_cards -->|"uses colors"| node_theme
node_api -->|"decodes responses"| node_models
node_homevm -->|"processes weather data"| node_models

click node_activity "https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/MainActivity.kt"
click node_navigation "https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/navigation/NavGraph.kt"
click node_home "https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/ui/views/HomeView.kt"
click node_forecast "https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/ui/views/ForecastView.kt"
click node_homevm "https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/ui/viewmodel/HomeViewModel.kt"
click node_forecastvm "https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/ui/viewmodel/ForecastViewModel.kt"
click node_device "https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/domain/usecase/GetDeviceLocationUseCase.kt"
click node_current "https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/domain/usecase/GetCurrentWeatherUseCase.kt"
click node_city "https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/domain/usecase/GetCurrentWeatherByCityUseCase.kt"
click node_forecastcase "https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/domain/usecase/GetWeatherForecastUseCase.kt"
click node_locationrepo "https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/data/repository/LocationRepositoryImpl.kt"
click node_weatherrepo "https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/data/repository/WeatherRepositoryImpl.kt"
click node_api "https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/data/remote/WeatherApi.kt"
click node_di "https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/di/AppModule.kt"
click node_locationdi "https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/di/LocationModule.kt"
click node_models "https://github.com/lylio/kotlinweatherapp/tree/main/app/src/main/java/com/botsheloramela/basicweatherapp/data/model"
click node_cards "https://github.com/lylio/kotlinweatherapp/tree/main/app/src/main/java/com/botsheloramela/basicweatherapp/ui/components"
click node_time "https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/utils/DateTimeUtils.kt"
click node_weatherutils "https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/utils/WeatherUtils.kt"
click node_theme "https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/ui/theme/Color.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_activity,node_navigation,node_home,node_forecast,node_homevm,node_forecastvm,node_user toneBlue
class node_device,node_current,node_city,node_forecastcase toneAmber
class node_locationrepo,node_weatherrepo,node_api,node_di,node_locationdi toneMint
class node_models,node_cards,node_time,node_weatherutils,node_theme toneRose
class node_openweather toneIndigo
```

## Components

### App and presentation

- [Main activity](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/MainActivity.kt): `app/src/main/java/com/botsheloramela/basicweatherapp/MainActivity.kt`
- [App navigation](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/navigation/NavGraph.kt): `app/src/main/java/com/botsheloramela/basicweatherapp/navigation/NavGraph.kt`
- [Home screen](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/ui/views/HomeView.kt): `app/src/main/java/com/botsheloramela/basicweatherapp/ui/views/HomeView.kt`
- [Forecast screen](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/ui/views/ForecastView.kt): `app/src/main/java/com/botsheloramela/basicweatherapp/ui/views/ForecastView.kt`
- [Home ViewModel](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/ui/viewmodel/HomeViewModel.kt): `app/src/main/java/com/botsheloramela/basicweatherapp/ui/viewmodel/HomeViewModel.kt`
- [Forecast ViewModel](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/ui/viewmodel/ForecastViewModel.kt): `app/src/main/java/com/botsheloramela/basicweatherapp/ui/viewmodel/ForecastViewModel.kt`

### Weather domain

- [Device location](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/domain/usecase/GetDeviceLocationUseCase.kt): `app/src/main/java/com/botsheloramela/basicweatherapp/domain/usecase/GetDeviceLocationUseCase.kt`
- [Current weather use cases](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/domain/usecase/GetCurrentWeatherUseCase.kt): `app/src/main/java/com/botsheloramela/basicweatherapp/domain/usecase/GetCurrentWeatherUseCase.kt`
- [City search use case](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/domain/usecase/GetCurrentWeatherByCityUseCase.kt): `app/src/main/java/com/botsheloramela/basicweatherapp/domain/usecase/GetCurrentWeatherByCityUseCase.kt`
- [Forecast use case](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/domain/usecase/GetWeatherForecastUseCase.kt): `app/src/main/java/com/botsheloramela/basicweatherapp/domain/usecase/GetWeatherForecastUseCase.kt`

### Data and services

- [Location repository](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/data/repository/LocationRepositoryImpl.kt): `app/src/main/java/com/botsheloramela/basicweatherapp/data/repository/LocationRepositoryImpl.kt`
- [Weather repository](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/data/repository/WeatherRepositoryImpl.kt): `app/src/main/java/com/botsheloramela/basicweatherapp/data/repository/WeatherRepositoryImpl.kt`
- [Weather API client](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/data/remote/WeatherApi.kt): `app/src/main/java/com/botsheloramela/basicweatherapp/data/remote/WeatherApi.kt`
- [Dependency wiring](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/di/AppModule.kt): `app/src/main/java/com/botsheloramela/basicweatherapp/di/AppModule.kt`
- [Location wiring](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/di/LocationModule.kt): `app/src/main/java/com/botsheloramela/basicweatherapp/di/LocationModule.kt`

### Models and presentation support

- [Weather response models](https://github.com/lylio/kotlinweatherapp/tree/main/app/src/main/java/com/botsheloramela/basicweatherapp/data/model): `app/src/main/java/com/botsheloramela/basicweatherapp/data/model`
- [Weather cards](https://github.com/lylio/kotlinweatherapp/tree/main/app/src/main/java/com/botsheloramela/basicweatherapp/ui/components): `app/src/main/java/com/botsheloramela/basicweatherapp/ui/components`
- [Date and time helpers](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/utils/DateTimeUtils.kt): `app/src/main/java/com/botsheloramela/basicweatherapp/utils/DateTimeUtils.kt`
- [Weather display mapping](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/utils/WeatherUtils.kt): `app/src/main/java/com/botsheloramela/basicweatherapp/utils/WeatherUtils.kt`
- [Color theme](https://github.com/lylio/kotlinweatherapp/blob/main/app/src/main/java/com/botsheloramela/basicweatherapp/ui/theme/Color.kt): `app/src/main/java/com/botsheloramela/basicweatherapp/ui/theme/Color.kt`

### Other components

- **Weather user**
- **OpenWeatherMap**

## Connections

- Weather user → Main activity: opens app (evidence: `README.md`)
- Main activity → App navigation: shows navigation (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/MainActivity.kt`)
- App navigation → Home screen: routes to (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/navigation/NavGraph.kt`)
- App navigation → Forecast screen: routes to (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/navigation/NavGraph.kt`)
- Home screen → Home ViewModel: requests weather (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/ui/views/HomeView.kt`)
- Forecast screen → Forecast ViewModel: observes state (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/ui/views/ForecastView.kt`)
- Home ViewModel → Device location: gets location (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/ui/viewmodel/HomeViewModel.kt`)
- Home ViewModel → Current weather use cases: fetches conditions (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/ui/viewmodel/HomeViewModel.kt`)
- Home ViewModel → City search use case: searches city (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/ui/viewmodel/HomeViewModel.kt`)
- Home ViewModel → Forecast use case: fetches forecast (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/ui/viewmodel/HomeViewModel.kt`)
- Forecast ViewModel → Forecast use case: requests forecast (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/ui/viewmodel/ForecastViewModel.kt`)
- Device location → Location repository: gets device location
- Current weather use cases → Weather repository: requests conditions
- City search use case → Weather repository: requests city data
- Forecast use case → Weather repository: requests forecast (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/domain/usecase/GetWeatherForecastUseCase.kt`)
- Weather repository → Weather API client: calls endpoints (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/data/repository/WeatherRepositoryImpl.kt`)
- Weather API client → OpenWeatherMap: fetches weather (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/data/remote/WeatherApi.kt`)
- Dependency wiring → Weather repository: binds implementation (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/di/AppModule.kt`)
- Location wiring → Location repository: binds implementation (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/di/LocationModule.kt`)
- Home screen → Weather cards: renders weather (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/ui/views/HomeView.kt`)
- Forecast screen → Weather cards: renders forecast (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/ui/views/ForecastView.kt`)
- Weather cards → Date and time helpers: formats dates (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/ui/components/FiveDayWeatherForecastCard.kt`)
- Weather cards → Weather display mapping: maps weather icons (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/ui/components/FiveDayWeatherForecastCard.kt`)
- Weather cards → Color theme: uses colors (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/ui/components/MainWeatherCard.kt`)
- Weather API client → Weather response models: decodes responses (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/data/remote/WeatherApi.kt`)
- Home ViewModel → Weather response models: processes weather data (evidence: `app/src/main/java/com/botsheloramela/basicweatherapp/ui/viewmodel/HomeViewModel.kt`)
