Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/cristhianblaffita-web/Weather-App-Ts/llms.txt

Use this file to discover all available pages before exploring further.

Weather App TS fetches all weather data from the Open-Meteo forecast endpoint. A single request returns current conditions (temperature, humidity, wind speed, cloud cover, and more), hourly forecasts for multiple days, and a 7-day daily summary including highs, lows, sunrise, and sunset times. Open-Meteo is a free, open-source weather API that requires no authentication, no API key, and no account registration — making it ideal for client-side React applications.

Endpoint

The forecast endpoint accepts GET requests and returns a JSON payload containing all three forecast horizons in one response.
GET https://api.open-meteo.com/v1/forecast

Query Parameters

The app constructs the URL using the resolved latitude and longitude from the Geocoding API, then appends fixed variable lists for each forecast horizon.
latitude
number
required
Geographic latitude of the target location, in decimal degrees (e.g., 52.52437). Sourced from the Place object returned by the Geocoding API.
longitude
number
required
Geographic longitude of the target location, in decimal degrees (e.g., 13.41053). Sourced from the Place object returned by the Geocoding API.
current
string
Comma-separated list of current-weather variables to include in the response. The app requests:
temperature_2m,relative_humidity_2m,apparent_temperature,is_day,weather_code,cloud_cover,wind_speed_10m
hourly
string
Comma-separated list of hourly forecast variables. The app requests:
temperature_2m,weather_code
daily
string
Comma-separated list of daily forecast variables. The app requests:
weather_code,temperature_2m_max,temperature_2m_min,sunrise,sunset
timezone
string
Timezone used to align returned timestamps. The app passes auto, which instructs Open-Meteo to use the local timezone of the requested coordinates automatically.

Full Request URL

The following URL template shows the complete request the app sends, with {latitude} and {longitude} replaced at runtime by the coordinates of the selected city.
https://api.open-meteo.com/v1/forecast
  ?latitude={latitude}
  &longitude={longitude}
  &daily=weather_code,temperature_2m_max,temperature_2m_min,sunrise,sunset
  &hourly=temperature_2m,weather_code
  &current=temperature_2m,relative_humidity_2m,apparent_temperature,is_day,weather_code,cloud_cover,wind_speed_10m
  &timezone=auto

Response Structure

The API returns a single JSON object. The app maps this directly to the WeatherResponse TypeScript type defined in src/types/api.ts.
type WeatherResponse = {
  utc_offset_seconds: number;               // UTC offset for the location
  timezone: string;                         // IANA timezone string
  current_units: Record<any, string>;       // unit labels for current fields
  current: CurrentWeatherResponse;
  hourly_units: Record<any, string>;        // unit labels for hourly fields
  hourly: HourlyWeatherResponse;
  daily_units: Record<any, string>;         // unit labels for daily fields
  daily: DailyWeatherResponse;
};
utc_offset_seconds
number
The UTC offset of the requested location in seconds. Used to convert UTC timestamps to local time.
timezone
string
The IANA timezone identifier for the location (e.g., "Europe/Berlin"). Returned when timezone=auto is set.
current_units
Record<any, string>
A map of each requested current-weather variable name to its unit string (e.g., { "temperature_2m": "°C", "wind_speed_10m": "km/h" }). The app reads these directly to display unit labels without hardcoding.
current
CurrentWeatherResponse
Object containing the latest observed weather values. See Current Weather Fields below.
hourly_units
Record<any, string>
A map of each requested hourly variable name to its unit string.
hourly
HourlyWeatherResponse
Object containing parallel arrays of hourly forecast values. See Hourly Weather Fields below.
daily_units
Record<any, string>
A map of each requested daily variable name to its unit string.
daily
DailyWeatherResponse
Object containing parallel arrays of daily forecast values. See Daily Weather Fields below.

Current Weather Fields

The current object holds a single snapshot of current conditions at the requested location. Every field corresponds to one of the variable names passed in the current query parameter.
FieldTypeDescription
timestringISO 8601 datetime string of the most recent observation
intervalnumberUpdate interval for the current data, in seconds
temperature_2mnumberAir temperature measured at 2 metres above ground (°C)
relative_humidity_2mnumberRelative humidity at 2 metres above ground (%)
apparent_temperaturenumberFeels-like (apparent) temperature accounting for wind and humidity (°C)
is_daybooleantrue if the sun is currently above the horizon at the location
weather_codenumberWMO weather interpretation code describing the current condition
cloud_covernumberTotal sky cloud cover as a percentage (%)
wind_speed_10mnumberWind speed at 10 metres above ground (km/h)

Hourly Weather Fields

The hourly object uses parallel arrays — each index across all arrays corresponds to the same point in time. The arrays cover multiple days of hourly data starting from the current hour.
FieldTypeDescription
timestring[]Array of ISO 8601 datetime strings, one entry per hour
temperature_2mnumber[]Hourly air temperature at 2 metres above ground (°C)
weather_codenumber[]Hourly WMO weather interpretation code

Daily Weather Fields

The daily object also uses parallel arrays indexed by day. The app renders 7 days of daily forecast data from these arrays.
FieldTypeDescription
timestring[]Array of ISO 8601 date strings in YYYY-MM-DD format, one per day
weather_codenumber[]Representative WMO weather code for the day
temperature_2m_maxnumber[]Daily maximum temperature at 2 metres (°C)
temperature_2m_minnumber[]Daily minimum temperature at 2 metres (°C)
sunrisestring[]Local sunrise time for each day as an ISO 8601 datetime string
sunsetstring[]Local sunset time for each day as an ISO 8601 datetime string
No API key or authentication header is required to call this endpoint. Open-Meteo is a free, open-source weather API — requests can be made directly from the browser without any credentials or proxy layer.

Build docs developers (and LLMs) love