← All @molecule/* packages · App templates
@molecule/api-weather-open-meteoProvider bond · weather · API (Node) · v1.0.1 · Apache-2.0
Open-Meteo weather provider — keyless, free for non-commercial use, emits WMO 4677 codes natively.
npm install @molecule/api-weather-open-meteonpm · Source on GitHub · Implements @molecule/api-weather
@molecule/api-weather-open-meteo is a provider bond on the API (Node) side: it implements the weather core interface (@molecule/api-weather) with a concrete vendor or library behind it.
Your code calls the core; you wire this provider once at startup. Swapping vendors later is one line in that wiring, not a rewrite.
import { setProvider } from '@molecule/api-weather'
import { provider } from '@molecule/api-weather-open-meteo'
setProvider(provider)Works with: @molecule/api-weather
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Open-Meteo weather provider for molecule.dev.
Implements the WeatherProvider interface against the public Open-Meteo
forecast endpoint (https://api.open-meteo.com/v1/forecast), which is
keyless, free for non-commercial use, and emits WMO 4677 weather codes
directly. Open-Meteo's native units (Celsius, mm, km/h, percent) already
match the core interface, so the provider performs a structural reshape
rather than a unit conversion.
import { setProvider } from '@molecule/api-weather'
import { provider } from '@molecule/api-weather-open-meteo'
setProvider(provider)
provider
npm install @molecule/api-weather-open-meteo @molecule/api-weather
OpenMeteoWeatherConfigConfiguration options for the Open-Meteo weather provider.
Open-Meteo's public forecast endpoint
(https://api.open-meteo.com/v1/forecast) is keyless and free for
non-commercial use, so all fields are optional.
interface OpenMeteoWeatherConfig {
/**
* Base URL override. Defaults to `'https://api.open-meteo.com/v1'`.
* Useful for self-hosted Open-Meteo instances or for the commercial
* `customer-api.open-meteo.com` endpoint.
*/
baseUrl?: string
/**
* API key, sent as the `apikey` query parameter. Only required for the
* commercial customer endpoint; ignored by the public service.
*/
apiKey?: string
/**
* Request timeout in milliseconds. Defaults to `10000`.
*/
timeout?: number
/**
* Default IANA timezone used when {@link WeatherLocation.timezone} is
* omitted. Defaults to `'auto'`, which lets Open-Meteo derive the
* location's local timezone server-side.
*/
defaultTimezone?: string
}
createProvider(config)Creates an Open-Meteo weather provider.
function createProvider(config?: OpenMeteoWeatherConfig): WeatherProvider
config — Provider configuration. All fields are optional.Returns: A WeatherProvider backed by the Open-Meteo forecast API.
summarizeWmoCode(code)Maps a WMO 4677 numeric weather code to a short English summary.
The mapping covers the codes Open-Meteo emits. Unknown codes fall back
to a generic 'Unknown' label so summary always returns a non-empty
string.
function summarizeWmoCode(code: number): string
code — WMO 4677 weather code.Returns: Short English summary suitable for developer-facing logs.
providerThe provider implementation, lazily initialized on first use.
Reads OPEN_METEO_BASE_URL and OPEN_METEO_API_KEY from environment
variables for optional self-hosted or commercial endpoints. The public
Open-Meteo service requires neither.
const provider: WeatherProvider
Implements @molecule/api-weather interface.
Setup function to register this provider with the core interface:
import { setProvider } from '@molecule/api-weather'
import { provider } from '@molecule/api-weather-open-meteo'
export function setupWeatherOpenMeteo(): void {
setProvider(provider)
}
Peer dependencies:
@molecule/api-weather ^1.0.1@molecule/api-weatherIntegration checklist — drive the real UI (live preview, no mocks), adapt each item to this app's actual screens/flows, and check every box off one by one. A box you can't check is an integration bug to fix — not a skip:
getCurrent) renders PLAUSIBLE
current conditions in the UI — a temperature in a sane range (roughly -60
to 60 °C), a non-empty summary/condition, plus the humidity (0–100) and
wind the widget shows — never null, NaN, "--"/placeholder, or a hardcoded
constant that never moves. Reload and confirm values track the provider.getForecast returns MULTIPLE future days with
DISTINCT values (min/max temps and codes vary day to day), and getHourly
likewise — not one row repeated N times or every day identical.