Skip to content

nitinmohan18/windly-frontend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

27 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌬️ Windly β€” Feel the Weather Breathe.

A cinematic, AI-powered weather experience built for the modern web.

Live Demo: windly-weather.vercel.app Β |Β  Backend: windly-backend Β |Β  Status: Deployed Vanilla JS No Build Step


🌊 About Windly

Most weather apps show you numbers. Windly makes you feel the weather.

Every condition β€” a thunderstorm rolling in, a heatwave baking the afternoon, a clear starlit night β€” is translated into a living, breathing visual experience. Rain falls across your screen. Lightning flickers in the dark. The sky shifts gradients as the sun traces its arc. An ML model reads the atmosphere and tells you what's coming before it arrives.

Windly was built on a simple idea: weather is cinematic, and your app should be too.

No frameworks. No bloat. Just the browser, raw JavaScript, and a backend doing real machine learning.


✨ Features

πŸ€– Atmospheric Intelligence

A Random Forest ML model analyses 5 real atmospheric inputs β€” temperature, humidity, pressure, wind speed, and cloud cover β€” and returns a calibrated rain probability. The result is visualised as a live animated gauge, a spectrum risk marker, and individual contributing factor bars, all updating in a single requestAnimationFrame pass to avoid layout thrashing.

🎬 Cinematic Weather Stage

A full-screen GPU-composited stage renders the weather as it actually feels:

  • Rain β€” individual drop elements with tilted variants for wind-driven storms
  • Snow β€” drifting flake particles with sinusoidal horizontal sway
  • Lightning β€” full-screen flash overlay + SVG bolt strikes with double-flash timing
  • Wind β€” flowing gradient lines blowing across the viewport
  • Heat β€” a pulsating blazing sun corona fixed in the corner
  • Night β€” animated shooting stars across a deep space gradient

🎨 Dynamic Weather Themes

The entire UI repaints to match the sky: sunny, sunny-extreme, rainy, cloudy, night, snowy, stormy-dark, and stargazer. Background gradients, card tones, and text contrast all shift as one.

β˜€οΈ Sun Arc Tracker

A real-time sunrise-to-sunset arc animates the sun's current position across the sky, calculated from the API's actual sunrise and sunset timestamps.

πŸ“‘ Smart City Autocomplete

City suggestions appear as you type, debounced and cached for 15 minutes on the backend. Results never duplicate and degrade gracefully on network failure.

πŸ”Š Ambient Sound Design

Weather-matched audio β€” heavy rain, light rain, thunder, wind, birds, crickets, snow footsteps, water drops β€” toggled by a single button and tied to live condition flags in app state.

πŸ“Š Hourly & 7-Day Forecast

An interactive graph and a 7-day expandable forecast card, with flip-in row animations and collapsible day detail panels.

🌑️ Live Unit Toggle

Switch between Β°C and Β°F instantly β€” every displayed value, including the AI card factor bars, recalculates without a network call.

πŸ“± Mobile-First Responsive

Breakpoints at 1050px, 768px, and 480px. The AI card repositions itself between desktop and mobile layouts at runtime via a MutationObserver. Safe-area insets support notched iPhones. Reduced-motion media queries respected throughout.


πŸ’‘ Why Vanilla JavaScript?

Windly is built without React, Vue, or any framework β€” and that's a deliberate engineering choice, not a limitation.

Advantage Detail
Zero build step No Webpack, Vite, or compiler. Open index.html and it runs.
Direct browser performance No VDOM diff overhead. DOM updates happen exactly when and where needed.
Lightweight delivery No framework runtime shipped to the client. The entire JS payload is your app.
Trivial deployment Any static host works β€” Vercel, Netlify, GitHub Pages, or a plain CDN.
Full control Animation timing, DOM batching, and render cycles are owned entirely by the app, not a framework scheduler.

ES Modules (import/export) give clean code organisation without the complexity of a bundler.


⚑ Performance Engineering

Windly treats the browser's rendering pipeline as a first-class concern. Every animation-heavy feature was profiled and optimised.

GPU Compositing

The weather stage uses contain: strict so all particle repaints are isolated from the rest of the page β€” a layout change inside the stage cannot trigger a full-page reflow. Individual particles carry will-change: transform so the browser promotes them to dedicated compositor layers, keeping animations on the GPU thread.

RequestAnimationFrame Batching

All visual updates on the AI card β€” the gauge arc, spectrum marker, and five factor bars β€” are batched into a single requestAnimationFrame call. Spreading them across separate frames would cause multiple style recalculations per paint cycle. One frame = one pass = no jank.

Smooth Counters

The probability percentage counter uses a cubic ease-out easing function inside requestAnimationFrame, not setInterval. This produces silky 60fps deceleration rather than mechanical ticking.

Mobile Particle Reduction

On screens ≀768px, backdrop-filter blur radius is halved, the sun corona is downsized, and cloud particle blur is reduced from 25px to 18px. Mid-range Android GPUs handle these passes significantly better without a visible quality loss.

Passive Event Listeners

Scroll and touch listeners are registered as { passive: true } so the browser never waits on JavaScript before committing a scroll frame β€” critical for smooth mobile interactions.

Cold-Start Resilience

Render's free tier sleeps after ~10 minutes of inactivity. Windly handles this with a 50-second AbortController timeout and a neutral waiting message shown after 7 seconds β€” so users aren't left staring at a blank screen wondering if the app is broken.


πŸ—‚οΈ File Structure

frontend/
β”œβ”€β”€ index.html
β”œβ”€β”€ style.css                   # Imports all CSS modules
β”œβ”€β”€ css/
β”‚   β”œβ”€β”€ base.css                # Reset, typography, body
β”‚   β”œβ”€β”€ themes.css              # Weather-driven backgrounds + safe-area insets
β”‚   β”œβ”€β”€ layout.css              # Responsive grid & breakpoints (1050 / 768 / 480px)
β”‚   β”œβ”€β”€ components.css          # Cards, buttons, inputs, forecast rows
β”‚   β”œβ”€β”€ animations.css          # Particle keyframes, lightning, sun, shooting stars
β”‚   └── enhancements.css        # Polish & micro-interactions
β”œβ”€β”€ js/
β”‚   β”œβ”€β”€ main.js                 # Entry point, event listeners
β”‚   β”œβ”€β”€ api.js                  # Weather fetch, AI prediction, error handling
β”‚   β”œβ”€β”€ ui.js                   # DOM rendering β€” conditions, forecast, hourly
β”‚   β”œβ”€β”€ state.js                # Global app state (single source of truth)
β”‚   β”œβ”€β”€ config.js               # Base URL β€” dev/prod auto-detection
β”‚   β”œβ”€β”€ features.js             # Particle spawning, ambient sound, animation flags
β”‚   β”œβ”€β”€ graph.js                # Hourly temperature/rain graph
β”‚   └── ai-manager.js           # AI card desktop↔mobile placement + collapse observer
└── sound/
    β”œβ”€β”€ heavy-rain.mp3
    β”œβ”€β”€ light-rain.mp3
    β”œβ”€β”€ thunder.mp3
    β”œβ”€β”€ wind.mp3
    β”œβ”€β”€ bird.mp3
    β”œβ”€β”€ crickets.mp3
    β”œβ”€β”€ water-drop.mp3
    └── floraphonic-foot-step-snow-*.mp3

πŸ—οΈ Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         User's Browser          β”‚
β”‚   Vanilla JS + CSS (Vercel)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚ HTTPS
                 β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      FastAPI Backend (Render)   β”‚
β”‚  β€’ WeatherAPI proxy (TTL cache) β”‚
β”‚  β€’ /predict β€” ML inference      β”‚
β”‚  β€’ GZip compression             β”‚
β”‚  β€’ Shared async httpx client    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚              β”‚
           β–Ό              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  WeatherAPI  β”‚  β”‚  Random Forest    β”‚
β”‚  (forecast,  β”‚  β”‚  Classifier       β”‚
β”‚   search)    β”‚  β”‚  (random_forest   β”‚
β”‚              β”‚  β”‚   .pkl β€” sigmoid  β”‚
β”‚              β”‚  β”‚   calibrated)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The frontend never touches WeatherAPI directly β€” all calls go through the FastAPI proxy, which handles caching, key security, and error normalisation.


πŸ“Έ Screenshots & Preview

Desktop UI Desktop UI
Mobile UI Mobile UI
AI Atmospheric Analysis Card AI Card
Hourly Forecast Graph Graph
Storm Theme Storm
Night / Stargazer Theme Night

πŸ“± Mobile & Accessibility

Windly is built mobile-first, not mobile-adapted.

  • Safe-area insets β€” env(safe-area-inset-*) padding on all sides for notched iPhones (iPhone X+) and Android. Requires viewport-fit=cover in the meta tag.
  • Three responsive breakpoints β€” 1050px (tablet/small laptop), 768px (mobile), 480px (small phone). Each breakpoint has intentional layout changes, not just scaled-down desktop styles.
  • Touch-optimised interactions β€” hover states are disabled on touch screens (pointer: none guard). The AI card relocates to the Forecast tab panel on mobile so it's always visible in context.
  • Reduced-motion support β€” @media (prefers-reduced-motion: reduce) disables all particle animations and shortens transitions. The app remains fully functional; it just stops moving.
  • OLED battery consideration β€” The stormy-dark theme lightens slightly on mobile to reduce pure-black pixel stress on OLED screens during long sessions.

πŸš€ Running Locally

No build step. No package install. Just serve and run.

# Clone the repo
git clone https://github.com/nitinmohan18/windly-frontend.git
cd windly-frontend

# Serve with any static server
npx serve .

Open http://localhost:3000. That's it.

The backend should be running on port 8000 locally. config.js points there automatically when it detects localhost.


βš™οΈ Configuration

js/config.js auto-detects environment β€” no .env file needed on the frontend:

const isDev = location.hostname === 'localhost'
           || location.hostname === '127.0.0.1'
           || location.hostname.startsWith('192.168.')
           ...

export const CONFIG = {
    BASE_URL: isDev
        ? `http://${location.hostname}:8000`      // local FastAPI
        : 'https://windly-backend.onrender.com',  // production
};

🌐 Deployment

Frontend β†’ Vercel

  1. Push this repo to GitHub
  2. Import on Vercel
  3. No build command β€” set output directory to . (root)
  4. Deploy

Vercel serves the static files directly. All API calls route to the Render backend via config.js.


πŸ› οΈ Tech Stack

Frontend

Language Vanilla JavaScript (ES Modules)
Styling CSS3 β€” modular, no preprocessor
Animations CSS keyframes + requestAnimationFrame
State Single shared appState object (no store library)
Build None β€” runs directly in the browser

Backend

Framework FastAPI
Server Uvicorn
HTTP Client httpx (async, connection-pooled)
Caching In-memory TTL dict (5 min forecast, 15 min search)
Compression GZipMiddleware (β‰₯500 byte responses)

Machine Learning

Algorithm Random Forest Classifier
Calibration Sigmoid (CalibratedClassifierCV, 5-fold CV)
Library scikit-learn
Training Data Global Weather Repository (Kaggle)
Features Temperature, Humidity, Pressure, Wind, Cloud

Deployment

Frontend Vercel
Backend Render
Weather Data WeatherAPI.com

πŸ“„ License

MIT β€” fork it, extend it, make it your own.


Built with obsessive attention to detail.
Feel the Weather .

About

Interactive AI-powered weather application with immersive UI, animated forecasts, soundscapes, and ML-based rain prediction.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors