# nullablev1/weather-app architecture

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

- Interactive diagram: https://gitdiagram.com/nullablev1/weather-app
- Repository: https://github.com/nullablev1/weather-app

## Overview

This is a Kotlin/XML Android weather app. The principal workflow is a user viewing the home or search screen, whose fragments request weather through the ViewModel and Retrofit; the app displays current conditions and hourly forecasts. Search also supports recent and suggested cities. Source excerpts were not provided, so implementation-level wiring beyond the README’s documented MVVM/API flow is left unverified.

Main entry points: [`app/src/main/java/com/example/weatherapp/fragments/SearchFragment.kt`](https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/fragments/SearchFragment.kt) (Search screen), [`app/src/main/java/com/example/weatherapp/fragments/HomeFragment.kt`](https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/fragments/HomeFragment.kt) (Home screen), [`app/src/main/java/com/example/weatherapp/viewmodels/WeatherViewModel.kt`](https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/viewmodels/WeatherViewModel.kt) (Weather ViewModel), [`app/src/main/java/com/example/weatherapp/adapters/HourlyForecastAdapter.kt`](https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/adapters/HourlyForecastAdapter.kt) (Hourly list)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_screens["Screens and UI"]
  node_main["Main activity<br/>[MainActivity.kt]"]
  node_home["Home screen<br/>[HomeFragment.kt]"]
  node_searchscreen["Search screen<br/>[SearchFragment.kt]"]
  node_hourlyui["Hourly list"]
  node_cityui["City list<br/>[CityAdapter.kt]"]
end

subgraph group_weather["Weather data"]
  node_vm["Weather ViewModel"]
  node_retrofit["Retrofit client"]
  node_api["Weather API interface<br/>[WeatherApi.kt]"]
  node_weatherdata["Weather response models"]
  node_hourmodel["Hourly weather model<br/>[HourlyWeather.kt]"]
end

subgraph group_search["City search"]
  node_preferences["Search preferences"]
  node_citymodel["City item model<br/>[CityItem.kt]"]
end

subgraph group_service["External service"]
  node_weatherapi["WeatherAPI service"]
end

node_user(("User"))

node_user -->|"views"| node_home
node_user -->|"searches"| node_searchscreen
node_home -->|"requests weather"| node_vm
node_searchscreen -->|"requests weather"| node_vm
node_vm -->|"makes requests"| node_retrofit
node_retrofit -.->|"uses interface"| node_api
node_api -->|"queries"| node_weatherapi
node_weatherapi -.->|"returns forecasts"| node_weatherdata
node_searchscreen -.->|"stores recents"| node_preferences
node_searchscreen -.->|"shows cities"| node_cityui
node_home -.->|"shows hourly forecast"| node_hourlyui
node_hourlyui -.->|"renders forecast"| node_hourmodel
node_cityui -.->|"renders cities"| node_citymodel

click node_main "https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/activities/MainActivity.kt"
click node_home "https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/fragments/HomeFragment.kt"
click node_searchscreen "https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/fragments/SearchFragment.kt"
click node_hourlyui "https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/adapters/HourlyForecastAdapter.kt"
click node_cityui "https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/adapters/CityAdapter.kt"
click node_vm "https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/viewmodels/WeatherViewModel.kt"
click node_retrofit "https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/apis/RetrofitInstance.kt"
click node_api "https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/apis/WeatherApi.kt"
click node_weatherdata "https://github.com/nullablev1/weather-app/tree/master/app/src/main/java/com/example/weatherapp/apis/respone"
click node_hourmodel "https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/models/HourlyWeather.kt"
click node_preferences "https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/local/PreferencesManager.kt"
click node_citymodel "https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/models/CityItem.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_main,node_home,node_searchscreen,node_hourlyui,node_cityui,node_user toneBlue
class node_vm,node_retrofit,node_api,node_weatherdata,node_hourmodel toneAmber
class node_preferences,node_citymodel toneMint
class node_weatherapi toneRose
```

## Components

### Screens and UI

- [Main activity](https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/activities/MainActivity.kt): `app/src/main/java/com/example/weatherapp/activities/MainActivity.kt`
- [Home screen](https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/fragments/HomeFragment.kt): `app/src/main/java/com/example/weatherapp/fragments/HomeFragment.kt`
- [Search screen](https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/fragments/SearchFragment.kt): `app/src/main/java/com/example/weatherapp/fragments/SearchFragment.kt`
- [Hourly list](https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/adapters/HourlyForecastAdapter.kt): `app/src/main/java/com/example/weatherapp/adapters/HourlyForecastAdapter.kt`
- [City list](https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/adapters/CityAdapter.kt): `app/src/main/java/com/example/weatherapp/adapters/CityAdapter.kt`

### Weather data

- [Weather ViewModel](https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/viewmodels/WeatherViewModel.kt): `app/src/main/java/com/example/weatherapp/viewmodels/WeatherViewModel.kt`
- [Retrofit client](https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/apis/RetrofitInstance.kt): `app/src/main/java/com/example/weatherapp/apis/RetrofitInstance.kt`
- [Weather API interface](https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/apis/WeatherApi.kt): `app/src/main/java/com/example/weatherapp/apis/WeatherApi.kt`
- [Weather response models](https://github.com/nullablev1/weather-app/tree/master/app/src/main/java/com/example/weatherapp/apis/respone): `app/src/main/java/com/example/weatherapp/apis/respone`
- [Hourly weather model](https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/models/HourlyWeather.kt): `app/src/main/java/com/example/weatherapp/models/HourlyWeather.kt`

### City search

- [Search preferences](https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/local/PreferencesManager.kt): `app/src/main/java/com/example/weatherapp/local/PreferencesManager.kt`
- [City item model](https://github.com/nullablev1/weather-app/blob/master/app/src/main/java/com/example/weatherapp/models/CityItem.kt): `app/src/main/java/com/example/weatherapp/models/CityItem.kt`

### External service

- **WeatherAPI service**

### Other components

- **User**

## Connections

- User → Home screen: views (evidence: `README.md`)
- User → Search screen: searches (evidence: `README.md`)
- Home screen → Weather ViewModel: requests weather (evidence: `README.md`)
- Search screen → Weather ViewModel: requests weather (evidence: `README.md`)
- Weather ViewModel → Retrofit client: makes requests (evidence: `README.md`)
- Retrofit client → Weather API interface: uses interface
- Weather API interface → WeatherAPI service: queries (evidence: `README.md`)
- WeatherAPI service → Weather response models: returns forecasts
- Search screen → Search preferences: stores recents
- Search screen → City list: shows cities
- Home screen → Hourly list: shows hourly forecast
- Hourly list → Hourly weather model: renders forecast
- City list → City item model: renders cities
