Weather Dashboard
Table of Contents
Project Overview
An interactive meteorological analytics dashboard rendering multi-day forecasts, atmospheric variations, and historical trends. Built with Next.js and TypeScript, the application features responsive temporal visualization charts, location auto-complete, and caching strategies.
Problem Statement
Consolidating meteorological data from third-party APIs often results in slow load times, unhandled upstream rate limits, and fragile client code susceptible to unexpected null values or schema modifications. A reliable weather dashboard must cache queries, handle intermittent network failures gracefully, and transform complex tabular data into digestible visualizations.
Solution Architecture
Requests are routed through a Next.js API proxy backed by a 15-minute TTL cache. Cache hits return immediately; misses fetch from the upstream API, then every payload is validated and normalized before reaching the charts.
Technical Deep Dives
Intelligent Server-Side Caching
- Designed a proxy API route that enforces a 15-minute Time-To-Live (TTL) cache key based on normalized city and coordinate hashes.
- Mitigated upstream provider rate limits (e.g., 60 calls/minute caps) while maintaining acceptable forecast accuracy for end users.
Temporal Data Visualization (Chart.js)
- Parsed 3-hour forecast vectors into multi-axis line and bar charts tracking temperature, humidity, and barometric pressure over 7-day windows.
- Implemented canvas resize observers to prevent chart re-draw layout shifts across mobile, tablet, and desktop viewports.
End-to-End Type Safety
- Created strict TypeScript interfaces matching the OpenWeather response schema (
Coordinates,WeatherMetric,HourlyForecast). - Implemented validation fallbacks so missing secondary metrics (e.g., wind gust or UV index) render graceful empty states rather than throwing uncaught
undefinedruntime exceptions.
Algorithm & Complexity Benchmarks
Coordinate TTL Cache Lookup
vs ~320ms upstream fetchO(1) Space: O(C) Hash-keyed 15-minute cache serves repeat queries under 90ms TTFB.
7-Day Forecast Vector Transform
single-pass normalizationO(H) Space: O(H) Streams H = 56 3-hour telemetry intervals into typed Chart.js datasets.
Architecture Trade-Offs
API Key Security & Rate Limiting
Keeps OpenWeather API credentials off the client bundle and cuts redundant upstream requests by ~60% with <90ms cached TTFB.
Payload Reliability
Normalizes missing precipitation/gust fields at the API boundary so Chart.js rendering never crashes on partial upstream responses.
Project Results
API Call Reduction
Slashed redundant upstream API queries by ~60% through route-level caching.
Sub-Second TTFB
Cached queries deliver a Time to First Byte (TTFB) under 90ms.
Resilient UI
Zero uncaught runtime errors during simulated API timeout or rate-limit test scenarios.