Simple weather app built with React + TypeScript + Vite and deployed to GitHub Pages.
Check it out here: https://weather.berk.au
- Visit "https://weather.berk.au"
- Type in a city name (e.g. Melbourne)
- The backend looks up that place using Open-Meteo geocoding
- Fetches current weather + a 4-day forecast for that location
- Shows an easy-to-read dashboard with temperature, conditions, wind, humidity, rain chance, and daily highs/lows.
Note
Automatic location detection is available but still WIP. Need to fix!
Main app code is in weather/.
weather/src/App.tsx- Page layout and wiring between UI + hooks.
weather/src/hooks/useWeather.ts- Main weather logic/state (loading, errors, search, location flow).
weather/src/services/openMeteo.ts- API calls to Open-Meteo (city search, reverse geocode, forecast fetch).
weather/src/components/*- UI pieces:
SearchPanelfor input/location promptCurrentWeatherCardfor current conditionsForecastGridfor 4-day outlookTopActionsBarfor theme toggle and top actions
- UI pieces:
weather/src/hooks/useTheme.ts- Light/dark theme handling (system-aware, persisted in localStorage).
weather/src/utils/*- Helpers:
geolocation.ts: browser geolocation wrappers + friendly error messagesformat.ts: temperature/wind/percent/date formattingrateLimit.ts: local lookup throttling (500 requests/hour in localStorage)
- Helpers:
weather/src/types/weather.ts- Shared TypeScript types.
- User searches city or taps "Use my location".
useWeathertriggers an API call viaopenMeteo.ts.- Raw API response is transformed into a
WeatherSnapshot. - React state updates, and UI components render the new weather data.
- Geolocation prompt preference is saved in localStorage.
- Theme preference is saved in localStorage (
auto,light,dark). - A client-side lookup cap is enforced to reduce abuse:
- 500 lookups per rolling 1-hour window (localStorage-based).
From the repo root:
cd weather
npm install
npm run devThen open the local Vite URL shown in the terminal.
cd weather
npm run build
npm run previewPush to GitHub (main branch), then let GitHub actions take care of the rest (see the dotfile).