Skip to content
Yasir Uslu
All work

Turkish weather from official MGM data

Weather

A weather app built on data from Turkey’s State Meteorological Service (MGM). Search all 81 provinces and their districts or use your location; see current conditions, a 30-hour sky and a 5-day forecast. It suggests an umbrella and an outfit, and sends official warnings and a morning summary as notifications. It works in Turkish and English and installs to the home screen.

Status
Live
Tools
Next.js 16 · React 19 · TypeScript · Canvas · Web Push · Upstash Redis · PWA · Vitest
Weather screenshot

The problem

MGM has no public API; the endpoints its site uses are undocumented and district data comes from a separate endpoint. The feels-like value usually equals the air temperature, and there is no chance of rain at all. The raw data had to be turned into a reliable answer to “do I need an umbrella, what should I wear?”

My role

Sole developer: MGM client, calculations, UI, notification server and tests.

Approach

  1. 01

    A server-side MGM client

    Current observations, hourly and daily forecasts and official warnings are merged in a Next.js route, cached and rate limited. The province and district index is generated from MGM; search folds Turkish characters and the nearest place is found from coordinates.

  2. 02

    From data to a decision

    Feels-like is recomputed from humidity and wind (Steadman, wind chill, heat index). With no rain probability, the umbrella call comes from hourly weather codes, wind, measured rain and official warnings; the outfit plan looks at the rest of the day.

  3. 03

    A scrubbable sky

    The next 30 hours are painted once as a panorama on a single canvas; scrubbing moves the reading to that hour. The canvas repaints only when data or size changes, and scrolling only writes transform and opacity. The same painter draws the shareable image card.

  4. 04

    Notifications without a server

    Subscriptions live in Upstash Redis per device; a Vercel cron sends the morning summary and new official warnings over Web Push. The same warning never reaches a device twice.

The hard part

Districts were never found

In the first version, searching a district always returned the province centre: the endpoint in use only lists centres. Districts now come from a separate endpoint and are matched with their province; when a district has no station of its own, the UI says the hourly forecast comes from the centre.

Quality

Parsing, feels-like, umbrella, outfit, warnings and notification texts are covered by Vitest.