Skip to content
CASE STUDY

Weather App

React · Open-Meteo · offline-first

React · LocalStorage · Testing

Problem

Weather apps usually fail in the moment they matter most — bad signal, no signal, or a flaky API. I wanted a small app that worked offline by default, kept favourites and travel notes between sessions, and stayed accessible without relying on a service worker setup that would itself become a maintenance burden.

Approach

  • 01

    Treated the most recent forecast as cached state in `localStorage` so the last good view was always available offline.

  • 02

    Used Open-Meteo (no API key, no quota) and a thin fetch wrapper that fell back to cached data with a clear "stale" indicator.

  • 03

    Modelled favourites and per-city notes as plain serialisable objects — easy to migrate, easy to back up, easy to test.

  • 04

    Wrote unit tests around the storage layer because that is where this kind of app actually breaks.

Outcome

  • 01

    The app survived flaky networks and full offline mode without a blank screen or crash.

  • 02

    Favourites and notes persisted across reloads with zero backend.

  • 03

    Test coverage on the storage and formatting modules made future changes safe.

Lessons

  • 01

    Offline-first does not require a service worker. `localStorage` plus a stale indicator solves 80% of the same problem with 5% of the complexity.

  • 02

    For tiny apps, plain serialisable objects beat heavyweight state libraries every time.

  • 03

    The valuable tests are around the boundaries: storage, formatting, fetch fallback. Snapshot tests on the UI add little.