DevPrep
  • Interview Prep
  • Projects
  • Resources
  • Pricing
  • About Us
Submit Question
DevPrep
  • Pricing
  • About Us
Submit Question
← From Beginner to Expert in Fundamentals of Frontend
  • Project 1: The Performance-First Dashboard
  • Project 2: Accessible Video Player
  • Project 3: Markdown Blog Engine
  • Project 4: Browser-Based Code Editor
  • Project 5: Multi-Tab Whiteboard
  • Project 6: Infinite Scroll Image Gallery
  • Project 7: Recipe Optimizer & Converter
  • Project 8: Budget Tracker with Charts
  • Project 9: Typing Speed Test
  • Project 10: Weather App with Time-Travel
  • Project 11: CSS Grid Layout Builder
  • Project 12: Password Vault (Frontend Only)
  • Project 13: Kanban Board (Trello Clone)
  • Project 14: Quiz App with Leaderboard
  • Project 15: Habit Tracker (GitHub Style)
  • Project 16: E-commerce Product Page
  • Project 17: Unit Converter (Expert Mode)
  • Project 18: Music Visualizer
  • Project 19: Flashcard Learning App
  • Project 20: Custom Form Validator
  • Project 21: Virtual Terminal
  • Project 22: Pomodoro Timer (Focus Pro)
  • Project 23: SVG Path Editor
  • Project 24: Movie Database Matchmaker
  • Project 25: Interactive Resume / Portfolio
  • Project 26: Recipe Scraper UI
  • Project 27: Crypto Tracker (Real-Time)
  • Project 28: Find My Pet (PWA)
  • Project 29: Markdown-to-Slide Tool
  • Project 30: Browser Health Dashboard
← From Beginner to Expert in Fundamentals of Frontend

Project 10: Weather App with Time-Travel

45 min read
Fetch APIPromise.allSettledGeolocation APISVG IconsCSS GradientsData Storytelling

📋 Project Brief

Build a weather application that combines current atmospheric data with historical climate records to create "data stories." Using the Fetch API, you will orchestrate multiple parallel API calls, render dynamic SVG weather icons, and implement a "Time Travel" feature showing how weather in a location has changed over decades.

🎯 Learning Objectives

  • Orchestrate multiple asynchronous API calls with Promise.all
  • Use the Geolocation API for automatic location detection
  • Build dynamic SVG icons that respond to data
  • Implement CSS gradient backgrounds that shift based on temperature and time of day
  • Handle unit conversion (Celsius, Fahrenheit, Kelvin) with state management

✅ Feature Requirements

Feature 1: Geolocation Integration

Acceptance Criteria:

  • On first visit, prompt the user for location permission
  • If granted, auto-detect city and fetch weather data
  • If denied, show a search bar for manual city entry
  • Provide a "Use My Location" button that re-triggers geolocation
  • Handle the "Permission Denied" and "Position Unavailable" error cases gracefully

Feature 2: Dynamic Backgrounds

Acceptance Criteria:

  • Background gradient changes based on: time of day (sunrise/sunset) AND current temperature
  • Cold temperatures: blue/purple tones; Hot temperatures: orange/red tones
  • Nighttime: dark navy/black gradients; Daytime: bright sky blue
  • Transitions must be smooth (CSS transition on background, ~1 second)

Feature 3: Historical "Time Travel"

Acceptance Criteria:

  • A "This Day in History" widget shows the temperature on this date in 1970, 1990, and 2010
  • Display as a comparison card: "Today: 28°C | 1990: 24°C | Change: +4°C"
  • If historical data is unavailable, show "Data not available" gracefully
  • Include a mini line chart showing the temperature trend across decades

Feature 4: Multi-Unit Support

Acceptance Criteria:

  • Toggle between Celsius, Fahrenheit, and Kelvin
  • The selected unit persists in localStorage
  • All temperatures across the app update instantly (no re-fetch required)
  • Wind speed also converts: km/h ↔ mph ↔ m/s

Feature 5: UV Index & Air Quality

Acceptance Criteria:

  • Fetch UV Index and Air Quality Index (AQI) from specialized APIs
  • Display UV level with a color-coded badge: Low (green), Moderate (yellow), High (orange), Very High (red), Extreme (purple)
  • AQI displayed with a health recommendation: "Good — Safe for outdoor activities"
  • Both must handle API failures independently (one failing doesn't break the other)

📊 API Orchestration

API CallData ReturnedDependency
Current WeatherTemperature, humidity, wind, conditionsNone (primary)
5-Day ForecastDaily highs/lows for next 5 daysRequires city/coordinates
Historical DataTemperature on this date in past yearsRequires city/coordinates
UV IndexCurrent UV levelRequires coordinates
Air QualityAQI and pollutant breakdownRequires coordinates

Use Promise.allSettled to fetch all APIs in parallel. Render available data immediately; show "Unavailable" for any that fail.

🧪 Testing Checklist

  • Unit test temperature conversion functions (C↔F↔K)
  • Unit test wind speed conversion
  • Mock API responses and test UI rendering for each weather condition
  • Test graceful degradation when one or more APIs fail
  • A11y: weather data must be readable by screen readers (not just icons)

🚀 Stretch Goals

  • Add a "Saved Locations" feature to compare weather across cities
  • Implement weather alerts/warnings
  • Add a rain radar map using Leaflet.js
  • Create a "Dress Suggestion" feature based on conditions

Practice

  • JavaScript
  • DSA
  • Machine Coding
  • System Design

Resources

  • Learning Tracks
  • Articles
  • Roadmaps
  • Compare Concepts
  • Glossary
  • Developer Tools
  • All Questions

Company

  • About
  • Pricing

Legal

  • Privacy Policy
  • Terms of Service
DevPrep

© 2026 DevPrep. All rights reserved.