# sukhpreetsingh04/weather-app architecture

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

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

## Overview

This is a Kotlin/Jetpack Compose Android weather app. The user enters a city and selects units in the weather screen; the screen asks the ViewModel to fetch weather, which calls the OpenWeather endpoint and exposes the response through StateFlow. The Compose UI then renders weather details in reusable cards. The graph also includes the app shell, navigation drawer, and theme. Unsampled drawer and theme internals are represented only where the README or shown calls establish their role.

Main entry points: [`app/src/main/java/com/sukhpreet/weatherapp/view/WeatherLazyColumn.kt`](https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/view/WeatherLazyColumn.kt) (Weather screen), [`app/src/main/java/com/sukhpreet/weatherapp/view/Homescreen.kt`](https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/view/Homescreen.kt) (Home screen), [`app/src/main/java/com/sukhpreet/weatherapp/viewmodel/WeatherViewModel.kt`](https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/viewmodel/WeatherViewModel.kt) (Weather ViewModel), [`app/src/main/java/com/sukhpreet/weatherapp/data/remote/WeatherApi.kt`](https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/data/remote/WeatherApi.kt) (Weather API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App shell"]
  node_activity["Main activity<br/>[MainActivity.kt]"]
  node_theme["App theme<br/>[Theme.kt]"]
end

subgraph group_presentation["Compose presentation"]
  node_home["Home screen<br/>[Homescreen.kt]"]
  node_drawer["Navigation drawer"]
  node_maincontent["Main content<br/>[MainContent.kt]"]
  node_weatherui["Weather screen"]
  node_measurement["Unit selector"]
  node_infocard["Weather cards<br/>[WeatherInfoCard.kt]"]
end

subgraph group_state["Weather state"]
  node_viewmodel["Weather ViewModel"]
end

subgraph group_remote["Remote weather data"]
  node_api["Weather API client<br/>[WeatherApi.kt]"]
  node_response["Weather response model<br/>[WeatherResponse.kt]"]
end

node_user(("User"))
node_openweather{{"OpenWeather API"}}

node_user -->|"enters city"| node_weatherui
node_activity -->|"applies theme"| node_theme
node_activity -->|"shows screen"| node_home
node_home -->|"wraps content"| node_drawer
node_home -->|"renders content"| node_maincontent
node_maincontent -->|"renders list"| node_weatherui
node_weatherui -->|"renders selector"| node_measurement
node_weatherui -->|"renders details"| node_infocard
node_weatherui -->|"requests and observes"| node_viewmodel
node_viewmodel -->|"fetches weather"| node_api
node_api -->|"requests weather"| node_openweather
node_api -->|"decodes response"| node_response
node_viewmodel -->|"publishes data"| node_response

click node_activity "https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/MainActivity.kt"
click node_theme "https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/ui/theme/Theme.kt"
click node_home "https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/view/Homescreen.kt"
click node_drawer "https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/view/uicomponents/WeatherNavigationDrawer.kt"
click node_maincontent "https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/view/MainContent.kt"
click node_weatherui "https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/view/WeatherLazyColumn.kt"
click node_measurement "https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/view/uicomponents/MeasurementButton.kt"
click node_infocard "https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/view/uicomponents/WeatherInfoCard.kt"
click node_viewmodel "https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/viewmodel/WeatherViewModel.kt"
click node_api "https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/data/remote/WeatherApi.kt"
click node_response "https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/data/model/WeatherResponse.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_theme,node_user toneBlue
class node_home,node_drawer,node_maincontent,node_weatherui,node_measurement,node_infocard toneAmber
class node_viewmodel,node_openweather toneMint
class node_api,node_response toneRose
```

## Components

### App shell

- [Main activity](https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/MainActivity.kt): `app/src/main/java/com/sukhpreet/weatherapp/MainActivity.kt`
- [App theme](https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/ui/theme/Theme.kt): `app/src/main/java/com/sukhpreet/weatherapp/ui/theme/Theme.kt`

### Compose presentation

- [Home screen](https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/view/Homescreen.kt): `app/src/main/java/com/sukhpreet/weatherapp/view/Homescreen.kt`
- [Navigation drawer](https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/view/uicomponents/WeatherNavigationDrawer.kt): `app/src/main/java/com/sukhpreet/weatherapp/view/uicomponents/WeatherNavigationDrawer.kt`
- [Main content](https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/view/MainContent.kt): `app/src/main/java/com/sukhpreet/weatherapp/view/MainContent.kt`
- [Weather screen](https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/view/WeatherLazyColumn.kt): `app/src/main/java/com/sukhpreet/weatherapp/view/WeatherLazyColumn.kt`
- [Unit selector](https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/view/uicomponents/MeasurementButton.kt): `app/src/main/java/com/sukhpreet/weatherapp/view/uicomponents/MeasurementButton.kt`
- [Weather cards](https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/view/uicomponents/WeatherInfoCard.kt): `app/src/main/java/com/sukhpreet/weatherapp/view/uicomponents/WeatherInfoCard.kt`

### Weather state

- [Weather ViewModel](https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/viewmodel/WeatherViewModel.kt): `app/src/main/java/com/sukhpreet/weatherapp/viewmodel/WeatherViewModel.kt`

### Remote weather data

- [Weather API client](https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/data/remote/WeatherApi.kt): `app/src/main/java/com/sukhpreet/weatherapp/data/remote/WeatherApi.kt`
- [Weather response model](https://github.com/sukhpreetsingh04/weather-app/blob/main/app/src/main/java/com/sukhpreet/weatherapp/data/model/WeatherResponse.kt): `app/src/main/java/com/sukhpreet/weatherapp/data/model/WeatherResponse.kt`

### Other components

- **User**
- **OpenWeather API**

## Connections

- User → Weather screen: enters city (evidence: `app/src/main/java/com/sukhpreet/weatherapp/view/WeatherLazyColumn.kt`)
- Main activity → App theme: applies theme (evidence: `app/src/main/java/com/sukhpreet/weatherapp/MainActivity.kt`)
- Main activity → Home screen: shows screen (evidence: `app/src/main/java/com/sukhpreet/weatherapp/MainActivity.kt`)
- Home screen → Navigation drawer: wraps content (evidence: `app/src/main/java/com/sukhpreet/weatherapp/view/Homescreen.kt`)
- Home screen → Main content: renders content (evidence: `app/src/main/java/com/sukhpreet/weatherapp/view/Homescreen.kt`)
- Main content → Weather screen: renders list (evidence: `app/src/main/java/com/sukhpreet/weatherapp/view/MainContent.kt`)
- Weather screen → Unit selector: renders selector (evidence: `app/src/main/java/com/sukhpreet/weatherapp/view/WeatherLazyColumn.kt`)
- Weather screen → Weather cards: renders details (evidence: `app/src/main/java/com/sukhpreet/weatherapp/view/WeatherLazyColumn.kt`)
- Weather screen → Weather ViewModel: requests and observes (evidence: `app/src/main/java/com/sukhpreet/weatherapp/view/WeatherLazyColumn.kt`)
- Weather ViewModel → Weather API client: fetches weather (evidence: `app/src/main/java/com/sukhpreet/weatherapp/viewmodel/WeatherViewModel.kt`)
- Weather API client → OpenWeather API: requests weather (evidence: `app/src/main/java/com/sukhpreet/weatherapp/data/remote/WeatherApi.kt`)
- Weather API client → Weather response model: decodes response (evidence: `app/src/main/java/com/sukhpreet/weatherapp/data/remote/WeatherApi.kt`)
- Weather ViewModel → Weather response model: publishes data (evidence: `app/src/main/java/com/sukhpreet/weatherapp/viewmodel/WeatherViewModel.kt`)
