A browser weather app for looking up current conditions and a 7-day outlook for any city or country. Search from a minimal landing screen, then explore a glass-style dashboard with live temperature, “feels like,” daily highs and lows, humidity, wind, sunrise/sunset, precipitation, and a week of forecast cards – all driven by the Visual Crossing Timeline Weather API.
There is no backend. The app runs entirely in the browser: Webpack bundles vanilla JavaScript modules, and each search fetches fresh JSON from Visual Crossing. The UI uses plain HTML and CSS (warm neutrals, terracotta accent, Fraunces display type, DM Sans UI type) with two views — an idle search screen and a ready layout with sidebar — toggled by adding or removing a hide utility class. A full-screen loading overlay appears while a request is in flight; inline errors show under the active search form when a location fails or the network drops.
This was built as a learning / portfolio piece (thanks to The Odin Project community), with my own Current·ly branding and styling. If you are reading the repo, you will see how data models, API orchestration, and DOM rendering are kept in separate modules, how async fetch/render flows use try/catch/finally, and how icon assets are loaded on demand to match API icon ids.
The default branch uses ES6 classes for Weather and MiniWeather, plus IIFE-style modules:
AppController— fetches from Visual Crossing, maps API JSON intoWeather/MiniWeatherinstances, storescurrentWeatherandweeklyForcast, tracks °F/°C preference, and exposes conversion helpersUiController— wires idle and ready search forms, validates empty input, shows/hides loading, renders the hero, metrics, and weekly grid, toggles idle/ready views, and handles unit buttons (re-render without refetch)Weather— full snapshot for “right now” (location, temps, atmosphere, wind, sun, precipitation, condition, icon, description)MiniWeather— lightweight shape for one forecast day (day of the week, min/max, icon, condition)
The UI is bundled with Webpack 5 (dev server, production build, GitHub Pages deploy). Runtime code is still vanilla JavaScript — no React, Vue, or similar.
WeatherandMiniWeatheras ES6 classes —Weathernormalizes API fields (e.g. sunrise/sunset viadate-fns);MiniWeatherholds only what the weekly cards need- IIFE modules —
AppControllerandUiControllerexport a small public API without polluting the global scope - Separation of concerns — API + state vs DOM + events; the UI never calls
fetchdirectly - Idle / ready views — two search UIs share one
fetchWeatherpipeline; success switches from#app-idleto#app-ready async/awaitwithtry/catch/finally— loading overlay shown at fetch start, hidden infinally; API errors surfaced in context-appropriate error elements- HTML5 constraint validation —
setCustomValidity+reportValidityfor empty location on submit - Client-side °F → °C toggle — API data stored in US units; conversion at render time via
AppController.convertToCelcius(no refetch on unit change) - Dynamic SVG imports — webpack resolves
../assets/weather-icons/${icon}.svgfor hero and weekly icons (Visual Crossing icon ids) - Sequential weekly render —
for...of+awaitkeeps forecast cards in order; grid cleared before each render - Loading overlay —
#loadingwithloading--hidden; fixed spinner panel over a dimmed backdrop - Glass layout — sidebar + hero + metric cards + 7-column weekly grid; responsive grid for metrics and forecast
Live app: https://soikat27.github.io/currently/ — opens in the browser; requires network access for weather data.
Note: The live demo uses a Visual Crossing API key bundled in the client. For your own fork, replace it with your key (see API key below).
You need Node.js and npm for the Webpack dev server and production build.
- Node.js (LTS recommended) and npm
- Git (only if you use
git clonebelow; otherwise use GitHub Code → Download ZIP) - A free Visual Crossing Weather API key
git --versiongit clone https://github.com/soikat27/currently.gitcd currentlynpm installSign up at Visual Crossing, create an API key, and set it in src/modules/app-controller.js (replace the placeholder API_KEY constant). Do not commit a personal key if you plan to open-source a fork — use environment injection or a private config for production.
Start the development server (opens in the browser with hot reload):
npm run devnpm run buildBuilt files are written to dist/. You can serve that folder with any static host or use npm run deploy for GitHub Pages.
The same behavior applies on the live demo and when you run the dev server locally.
- Location search — city or country from the idle landing page or the ready sidebar
- Current conditions — large temp, condition, feels like, today’s low/high, description, and weather icon
- At a glance — humidity, pressure, UV index, wind, gust, sunrise, sunset, precipitation (chance, amount, type)
- 7-day forecast — seven cards starting with Tomorrow, then weekday labels; high/low, icon, and short condition per day
- °F / °C toggle — switches display units on the current dashboard and weekly highs/lows without a new API call
- Loading state — full-screen “Fetching weather…” overlay during search
- Validation — empty search shows the browser’s native validation message
- Errors — bad location vs generic network message under the form that submitted the search; last good weather stays visible on the ready page when a later search fails
- Open the app → idle view with centered brand and search
- Enter a location → Go → loading overlay → ready view with weather
- Use the sidebar search to change location without returning to idle
- Toggle °C / °F in the sidebar to convert displayed temperatures
- On failure, read the red message under the search field and try again
- Move API key to an environment variable (keep secrets out of the bundle)
- Geolocation or remembered last city on load
- Metric wind / precipitation units when °C is selected
- Fallback icon when the API returns an id missing from the local icon set
npm run dev— Webpack Dev Server with hot reloadnpm run build— production build intodist/npm run deploy—npm run buildthen publishdist/to thegh-pagesbranch viagh-pagesnpm run lint/npm run lint:fix— ESLintnpm run format/npm run format:check— Prettier
The deploy script runs:
npm run build && gh-pages -d distThat builds the project, then publishes the generated dist/ folder to GitHub Pages. This repo is set up for https://soikat27.github.io/currently/ — update homepage in package.json if you fork or rename the repository.
You could also host the same dist/ output on Netlify, Cloudflare Pages, or any static file host.
- Plain HTML, CSS, and JavaScript (no UI framework)
- Visual Crossing Timeline Weather API — current conditions + daily timeline
- Webpack 5 —
webpack.common.js,webpack.dev.js,webpack.prod.js - HtmlWebpackPlugin + html-loader — builds from
src/template.html date-fns— sunrise/sunset formatting and forecast day labels- ES6 classes —
Weather,MiniWeather - IIFE modules —
AppController,UiController - Dynamic
import()— on-demand SVG weather icons - Google Fonts (bundled) — Fraunces, DM Sans
Monochrome SVG icons are from Visual Crossing WeatherIcons (LGPL-3.0). They align with the icon field returned by the Visual Crossing API. Icons live in src/assets/weather-icons/.
Contributions are welcome. Open an issue or send a PR if you want to improve error handling, accessibility, unit conversion, icon fallbacks, or teach me something I missed.
- Soikat Saha — design and implementation
This project is licensed under the MIT License — see the LICENSE file for details.
Weather icon assets are subject to the LGPL-3.0 license from visualcrossing/WeatherIcons.
- Shoutout to the Odin Project community and curriculum for overall guidance and the push toward modular JavaScript.
- Visual Crossing for the Timeline Weather API and the matching WeatherIcons set.
- Thanks to everyone who maintains solid MDN docs —
fetch, forms, and constraint validation got plenty of use. - Built on my own Webpack starter template; kept the runtime vanilla on purpose so the module boundaries stay easy to follow in a portfolio read-through.
