# noorthistime/sunblock architecture

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

- Interactive diagram: https://gitdiagram.com/noorthistime/sunblock
- Repository: https://github.com/noorthistime/sunblock

## Overview

SunBlock is a Next.js weather dashboard. Users choose or search for a location, then view current conditions, a forecast, and interactive map layers with a time scrubber. The graph highlights the page-to-hook workflow and map composition. README capabilities include radar playback, temperature interpolation, wind flow, and satellite overlays. API-handler internals and some hook wiring were not excerpted, so those relationships are omitted or marked unverified.

Main entry points: [`app/page.tsx`](https://github.com/noorthistime/sunblock/blob/main/app/page.tsx) (Dashboard page), [`components/WeatherMap.tsx`](https://github.com/noorthistime/sunblock/blob/main/components/WeatherMap.tsx) (Interactive weather map), [`hooks/useWeather.ts`](https://github.com/noorthistime/sunblock/blob/main/hooks/useWeather.ts) (Weather state hook), [`types/weather.ts`](https://github.com/noorthistime/sunblock/blob/main/types/weather.ts) (Weather data types)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard UI"]
  node_page["Dashboard page<br/>[page.tsx]"]
  node_header["Search and controls<br/>[Header.tsx]"]
  node_current["Current conditions<br/>[WeatherCard.tsx]"]
  node_forecast["Forecast cards"]
  node_progress["Progress indicator<br/>[DottedProgress.tsx]"]
end

subgraph group_weather["Weather Data"]
  node_weather_hook["Weather state hook<br/>[useWeather.ts]"]
  node_weather_api["Weather API handler<br/>[route.ts]"]
  node_search_api["Location search handler<br/>[route.ts]"]
end

subgraph group_mapping["Map Visualizations"]
  node_map_wrapper["Map loader<br/>[MapWrapper.tsx]"]
  node_map["Interactive weather map<br/>[WeatherMap.tsx]"]
  node_timeline["Radar timeline"]
  node_lightning_layer["Lightning overlay<br/>[LightningLayer.tsx]"]
  node_lightning_hook["Lightning strike generation"]
end

subgraph group_domain["Weather Domain"]
  node_weather_types["Weather data types<br/>[weather.ts]"]
  node_weather_codes["Weather code display mapping<br/>[weatherCodes.ts]"]
end

node_visitor(("Dashboard visitor"))
node_open_meteo["Open-Meteo"]
node_rainviewer["RainViewer"]

node_visitor -->|"opens"| node_page
node_page -->|"uses state"| node_weather_hook
node_page -->|"renders"| node_header
node_page -->|"renders"| node_current
node_page -->|"renders"| node_forecast
node_page -->|"renders"| node_map_wrapper
node_page -->|"renders"| node_progress
node_weather_hook -.->|"requests weather"| node_weather_api
node_weather_hook -.->|"requests search"| node_search_api
node_weather_api -.->|"fetches weather"| node_open_meteo
node_search_api -.->|"geocodes"| node_open_meteo
node_map_wrapper -->|"loads"| node_map
node_map -->|"renders"| node_timeline
node_map -->|"renders"| node_lightning_layer
node_map -->|"uses strikes"| node_lightning_hook
node_map -.->|"loads radar frames"| node_rainviewer
node_map -->|"uses data types"| node_weather_types
node_weather_hook -->|"uses data types"| node_weather_types
node_current -->|"formats conditions"| node_weather_codes
node_forecast -->|"formats conditions"| node_weather_codes
node_lightning_hook -->|"uses point type"| node_weather_types

click node_page "https://github.com/noorthistime/sunblock/blob/main/app/page.tsx"
click node_header "https://github.com/noorthistime/sunblock/blob/main/components/Header.tsx"
click node_current "https://github.com/noorthistime/sunblock/blob/main/components/WeatherCard.tsx"
click node_forecast "https://github.com/noorthistime/sunblock/blob/main/components/ForecastOverlay.tsx"
click node_progress "https://github.com/noorthistime/sunblock/blob/main/components/DottedProgress.tsx"
click node_weather_hook "https://github.com/noorthistime/sunblock/blob/main/hooks/useWeather.ts"
click node_weather_api "https://github.com/noorthistime/sunblock/blob/main/app/api/weather/route.ts"
click node_search_api "https://github.com/noorthistime/sunblock/blob/main/app/api/search/route.ts"
click node_map_wrapper "https://github.com/noorthistime/sunblock/blob/main/components/MapWrapper.tsx"
click node_map "https://github.com/noorthistime/sunblock/blob/main/components/WeatherMap.tsx"
click node_timeline "https://github.com/noorthistime/sunblock/blob/main/components/PrecipitationTimeline.tsx"
click node_lightning_layer "https://github.com/noorthistime/sunblock/blob/main/components/LightningLayer.tsx"
click node_lightning_hook "https://github.com/noorthistime/sunblock/blob/main/hooks/useLightningStrikes.ts"
click node_weather_types "https://github.com/noorthistime/sunblock/blob/main/types/weather.ts"
click node_weather_codes "https://github.com/noorthistime/sunblock/blob/main/utils/weatherCodes.ts"

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_page,node_header,node_current,node_forecast,node_progress,node_rainviewer toneBlue
class node_weather_hook,node_weather_api,node_search_api toneAmber
class node_map_wrapper,node_map,node_timeline,node_lightning_layer,node_lightning_hook toneMint
class node_weather_types,node_weather_codes toneRose
class node_visitor,node_open_meteo toneIndigo
```

## Components

### Dashboard UI

- [Dashboard page](https://github.com/noorthistime/sunblock/blob/main/app/page.tsx): `app/page.tsx`
- [Search and controls](https://github.com/noorthistime/sunblock/blob/main/components/Header.tsx): `components/Header.tsx`
- [Current conditions](https://github.com/noorthistime/sunblock/blob/main/components/WeatherCard.tsx): `components/WeatherCard.tsx`
- [Forecast cards](https://github.com/noorthistime/sunblock/blob/main/components/ForecastOverlay.tsx): `components/ForecastOverlay.tsx`
- [Progress indicator](https://github.com/noorthistime/sunblock/blob/main/components/DottedProgress.tsx): `components/DottedProgress.tsx`

### Weather Data

- [Weather state hook](https://github.com/noorthistime/sunblock/blob/main/hooks/useWeather.ts): `hooks/useWeather.ts`
- [Weather API handler](https://github.com/noorthistime/sunblock/blob/main/app/api/weather/route.ts): `app/api/weather/route.ts`
- [Location search handler](https://github.com/noorthistime/sunblock/blob/main/app/api/search/route.ts): `app/api/search/route.ts`

### Map Visualizations

- [Map loader](https://github.com/noorthistime/sunblock/blob/main/components/MapWrapper.tsx): `components/MapWrapper.tsx`
- [Interactive weather map](https://github.com/noorthistime/sunblock/blob/main/components/WeatherMap.tsx): `components/WeatherMap.tsx`
- [Radar timeline](https://github.com/noorthistime/sunblock/blob/main/components/PrecipitationTimeline.tsx): `components/PrecipitationTimeline.tsx`
- [Lightning overlay](https://github.com/noorthistime/sunblock/blob/main/components/LightningLayer.tsx): `components/LightningLayer.tsx`
- [Lightning strike generation](https://github.com/noorthistime/sunblock/blob/main/hooks/useLightningStrikes.ts): `hooks/useLightningStrikes.ts`

### Weather Domain

- [Weather data types](https://github.com/noorthistime/sunblock/blob/main/types/weather.ts): `types/weather.ts`
- [Weather code display mapping](https://github.com/noorthistime/sunblock/blob/main/utils/weatherCodes.ts): `utils/weatherCodes.ts`

### Other components

- **Dashboard visitor**
- **Open-Meteo**
- **RainViewer**

## Connections

- Dashboard visitor → Dashboard page: opens (evidence: `README.md`)
- Dashboard page → Weather state hook: uses state (evidence: `app/page.tsx`)
- Dashboard page → Search and controls: renders (evidence: `app/page.tsx`)
- Dashboard page → Current conditions: renders (evidence: `app/page.tsx`)
- Dashboard page → Forecast cards: renders (evidence: `app/page.tsx`)
- Dashboard page → Map loader: renders (evidence: `app/page.tsx`)
- Dashboard page → Progress indicator: renders (evidence: `app/page.tsx`)
- Weather state hook → Weather API handler: requests weather
- Weather state hook → Location search handler: requests search
- Weather API handler → Open-Meteo: fetches weather
- Location search handler → Open-Meteo: geocodes
- Map loader → Interactive weather map: loads (evidence: `components/MapWrapper.tsx`)
- Interactive weather map → Radar timeline: renders (evidence: `components/WeatherMap.tsx`)
- Interactive weather map → Lightning overlay: renders (evidence: `components/WeatherMap.tsx`)
- Interactive weather map → Lightning strike generation: uses strikes (evidence: `components/WeatherMap.tsx`)
- Interactive weather map → RainViewer: loads radar frames
- Interactive weather map → Weather data types: uses data types (evidence: `components/WeatherMap.tsx`)
- Weather state hook → Weather data types: uses data types (evidence: `hooks/useWeather.ts`)
- Current conditions → Weather code display mapping: formats conditions (evidence: `components/WeatherCard.tsx`)
- Forecast cards → Weather code display mapping: formats conditions (evidence: `components/ForecastOverlay.tsx`)
- Lightning strike generation → Weather data types: uses point type (evidence: `hooks/useLightningStrikes.ts`)
