# kgund1751/weather-lab architecture

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

- Interactive diagram: https://gitdiagram.com/kgund1751/weather-lab
- Repository: https://github.com/kgund1751/weather-lab

## Overview

Weather Lab is a small Spring Boot service that accepts a weather request, limits requests by client IP, retrieves current conditions from Open-Meteo, and returns a response. The README documents the per-instance fixed-window limit and HTTP 429 behavior. Source excerpts were not provided, so the limiter’s exact wiring and the controller-to-client call structure cannot be confirmed; the graph shows only the documented workflow and avoids asserting those internal links.

Main entry points: [`src/main/java/com/example/weatherlab/weather/WeatherController.java`](https://github.com/kgund1751/weather-lab/blob/main/src/main/java/com/example/weatherlab/weather/WeatherController.java) (Weather endpoint), [`src/main/java/com/example/weatherlab/weather/InMemoryRateLimiter.java`](https://github.com/kgund1751/weather-lab/blob/main/src/main/java/com/example/weatherlab/weather/InMemoryRateLimiter.java) (IP rate limiter), [`src/main/java/com/example/weatherlab/weather/OpenMeteoClient.java`](https://github.com/kgund1751/weather-lab/blob/main/src/main/java/com/example/weatherlab/weather/OpenMeteoClient.java) (Open-Meteo client), [`src/main/resources/application.properties`](https://github.com/kgund1751/weather-lab/blob/main/src/main/resources/application.properties) (Rate-limit settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_request["Request handling"]
  node_controller["Weather endpoint"]
  node_limiter["IP rate limiter"]
  node_error["Error mapping"]
  node_response["Weather response"]
  node_limiterror["Rate-limit exception"]
end

subgraph group_upstream["Weather lookup"]
  node_client["Open-Meteo client"]
  node_meteo["Open-Meteo"]
end

subgraph group_runtime["Application runtime"]
  node_application["Spring application"]
  node_webconfig["Web configuration<br/>[WebConfig.java]"]
  node_properties["Rate-limit settings"]
end

node_caller(("API caller"))

node_caller -->|"requests weather"| node_controller
node_controller -->|"returns response"| node_response
node_client -->|"requests weather"| node_meteo
node_limiter -->|"rejects excess"| node_limiterror
node_properties -->|"configures limit"| node_limiter

click node_controller "https://github.com/kgund1751/weather-lab/blob/main/src/main/java/com/example/weatherlab/weather/WeatherController.java"
click node_limiter "https://github.com/kgund1751/weather-lab/blob/main/src/main/java/com/example/weatherlab/weather/InMemoryRateLimiter.java"
click node_error "https://github.com/kgund1751/weather-lab/blob/main/src/main/java/com/example/weatherlab/weather/WeatherExceptionHandler.java"
click node_response "https://github.com/kgund1751/weather-lab/blob/main/src/main/java/com/example/weatherlab/weather/WeatherResponse.java"
click node_client "https://github.com/kgund1751/weather-lab/blob/main/src/main/java/com/example/weatherlab/weather/OpenMeteoClient.java"
click node_application "https://github.com/kgund1751/weather-lab/blob/main/src/main/java/com/example/weatherlab/WeatherLabApplication.java"
click node_webconfig "https://github.com/kgund1751/weather-lab/blob/main/src/main/java/com/example/weatherlab/weather/WebConfig.java"
click node_properties "https://github.com/kgund1751/weather-lab/blob/main/src/main/resources/application.properties"
click node_limiterror "https://github.com/kgund1751/weather-lab/blob/main/src/main/java/com/example/weatherlab/weather/RateLimitExceededException.java"

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_controller,node_limiter,node_error,node_response,node_limiterror toneBlue
class node_client,node_meteo toneAmber
class node_application,node_webconfig,node_properties,node_caller toneMint
```

## Components

### Request handling

- [Weather endpoint](https://github.com/kgund1751/weather-lab/blob/main/src/main/java/com/example/weatherlab/weather/WeatherController.java): `src/main/java/com/example/weatherlab/weather/WeatherController.java`
- [IP rate limiter](https://github.com/kgund1751/weather-lab/blob/main/src/main/java/com/example/weatherlab/weather/InMemoryRateLimiter.java): `src/main/java/com/example/weatherlab/weather/InMemoryRateLimiter.java`
- [Error mapping](https://github.com/kgund1751/weather-lab/blob/main/src/main/java/com/example/weatherlab/weather/WeatherExceptionHandler.java): `src/main/java/com/example/weatherlab/weather/WeatherExceptionHandler.java`
- [Weather response](https://github.com/kgund1751/weather-lab/blob/main/src/main/java/com/example/weatherlab/weather/WeatherResponse.java): `src/main/java/com/example/weatherlab/weather/WeatherResponse.java`
- [Rate-limit exception](https://github.com/kgund1751/weather-lab/blob/main/src/main/java/com/example/weatherlab/weather/RateLimitExceededException.java): `src/main/java/com/example/weatherlab/weather/RateLimitExceededException.java`

### Weather lookup

- [Open-Meteo client](https://github.com/kgund1751/weather-lab/blob/main/src/main/java/com/example/weatherlab/weather/OpenMeteoClient.java): `src/main/java/com/example/weatherlab/weather/OpenMeteoClient.java`
- **Open-Meteo**

### Application runtime

- [Spring application](https://github.com/kgund1751/weather-lab/blob/main/src/main/java/com/example/weatherlab/WeatherLabApplication.java): `src/main/java/com/example/weatherlab/WeatherLabApplication.java`
- [Web configuration](https://github.com/kgund1751/weather-lab/blob/main/src/main/java/com/example/weatherlab/weather/WebConfig.java): `src/main/java/com/example/weatherlab/weather/WebConfig.java`
- [Rate-limit settings](https://github.com/kgund1751/weather-lab/blob/main/src/main/resources/application.properties): `src/main/resources/application.properties`

### Other components

- **API caller**

## Connections

- API caller → Weather endpoint: requests weather
- Weather endpoint → Weather response: returns response
- Open-Meteo client → Open-Meteo: requests weather
- IP rate limiter → Rate-limit exception: rejects excess
- Rate-limit settings → IP rate limiter: configures limit
