Back to sketch

SYSTEM DESIGN SKETCHBOOK / PRACTICE SHEET / NO. 36

Design a weather app

Intermediate · 35 min · Caching & read paths

A mobile and web app shows current conditions, an hourly forecast and a 10-day outlook for where you are and for places you saved, and warns you when severe weather is coming. The forecasts come from paid upstream weather providers; the app does no meteorology of its own.

Requirements

  • Show current conditions, a 48-hour hourly forecast and a 10-day daily forecast for the device location or a saved place.
  • Users save up to 10 places; the app opens instantly with the last data it had, even with no network.
  • Push severe-weather alerts (tornado, flash flood) to devices whose saved places or recent location fall inside the alert area.
  • Keep working, possibly with older data, when the primary provider is down.

Constraints and assumptions

  • 20M monthly users, 4M daily; peak 30,000 forecast reads/s during morning hours and during big storms.
  • The primary provider bills per call and allows at most 500 calls/s. Its forecasts update about hourly; current conditions about every 10 minutes. A secondary provider is available at higher cost.
  • Official alerts arrive as polygons from a government feed: about 5,000 a day, up to 300 in a bad hour. A tornado warning must reach phones within 60 seconds of arrival.
  • One coverage region of about 10M km² (roughly a large country); phones are often on slow or flaky networks.

Out of scope for the first sketch

Radar and map tiles · User accounts (a device id is enough) · Historical climate data · Ads

Draw your design

Rough math and notes

Done on paper? Compare with the worked approaches