A full-stack weather application featuring a Spring Boot REST API backend and a stunning React frontend with real-time animated sky scenes, canvas particle effects, and a glassmorphism UI.
Features β’ Tech Stack β’ Getting Started β’ API Reference β’ Project Structure
- π Real-time weather for any city worldwide via WeatherAPI.com
- π Multi-day forecast β 1, 3, 5, or 7 days
- π¦ Animated sky scenes β rain, snow, thunder, fog, aurora, clear skies and more
- β‘ Live lightning bolt effects rendered on canvas during storm conditions
- βοΈ Particle system β animated rain drops and snowflakes via
requestAnimationFrame - π‘οΈ Β°C / Β°F toggle with smooth color transitions per temperature range
- π§ Humidity bar, pressure, wind speed, and visibility stats
- π¨ Glassmorphism UI with
backdrop-filter, frosted cards, and aurora blobs - π½ Custom portal dropdown β fully themed day-selector that escapes stacking contexts
- π± Fully responsive design
- ποΈ Clean REST API with proper exception handling
| Layer | Technology |
|---|---|
| Backend | Java 17+, Spring Boot 3.x |
| HTTP Client | Spring RestTemplate |
| Weather Data | WeatherAPI.com |
| Frontend | React 18+, CSS-in-JS inline styles |
| Animations | Canvas API (requestAnimationFrame), CSS keyframes |
| Fonts | Google Fonts β Fraunces (display) + DM Sans (body) |
| Build Tool | Maven + Vite (or CRA) |
| Deployment | Vercel |
Weather_app/
βββ src/
β βββ main/
β βββ java/com/cfs/Weather_app/
β β βββ controller/
β β β βββ Controller.java # REST endpoints
β β βββ dto/
β β β βββ Root.java # WeatherAPI root response
β β β βββ Location.java
β β β βββ Current.java
β β β βββ Condition.java
β β β βββ Forecast.java
β β β βββ Forecastday.java
β β β βββ Day.java
β β β βββ Hour.java
β β β βββ Astro.java
β β β βββ WeatherResponse.java # Current weather DTO
β β β βββ WeatherForecast.java # Forecast wrapper DTO
β β β βββ DayTemp.java # Per-day forecast DTO
β β βββ exception/
β β β βββ WeatherApiException.java
β β β βββ GlobalExceptionHandler.java
β β βββ service/
β β β βββ WeatherService.java # Business logic
β β βββ WeatherAppApplication.java
β βββ resources/
β βββ static/ # Built React output (after npm run build)
β βββ application.properties
βββ frontend/ # React source
β βββ src/
β β βββ WeatherApp.jsx # Main React component
β βββ package.json
β βββ vite.config.js
βββ .gitignore
βββ pom.xml
βββ README.md
- Java 17 or higher
- Maven 3.6+
- Node.js 18+ and npm
- A free API key from WeatherAPI.com
git clone https://github.com/saantoshh/Weatherly.git
cd WeatherlyOpen src/main/resources/application.properties and set your values:
# WeatherAPI credentials
weather.api.key=YOUR_API_KEY_HERE
weather.api.url=http://api.weatherapi.com/v1/current.json
weather.api.forecast.url=http://api.weatherapi.com/v1/forecast.json
# Server port
server.port=8080
β οΈ Never commit your real API key. Addapplication.propertiesto.gitignoreand commit an.examplefile with placeholder values instead.
./mvnw spring-boot:runThe Spring Boot server starts at http://localhost:8080.
cd frontend
npm install
npm run devThe React dev server starts at http://localhost:5173 and proxies API calls to localhost:8080.
For production: run
npm run buildinsidefrontend/, then copy thedist/output intosrc/main/resources/static/so Spring Boot serves it directly.
GET /weather/current/{city}
Example: GET /weather/current/Mumbai
{
"city": "Mumbai",
"region": "Maharashtra",
"country": "India",
"condition": "Partly cloudy",
"temperature": 31.0,
"feelslike_c": 36.2,
"humidity": 78.0,
"pressure": 1006.0,
"windSpeed": 19.8,
"visibility": 6.0
}GET /weather/forecast/{city}?days={1|3|5|7}
Example: GET /weather/forecast/London?days=3
{
"weatherResponse": { "city": "London", "temperature": 18.0, "..." : "..." },
"dayTemp": [
{
"date": "2026-06-07",
"minTemp": 14.0,
"avgTemp": 18.5,
"maxTemp": 22.0,
"humidity": 65.0,
"condition": "Sunny",
"pressure": 0
}
]
}GET /weather/test/{city}
Returns "Good" if the server is reachable.
The React frontend (WeatherApp.jsx) is a single-file component with these key parts:
| Component | Purpose |
|---|---|
AnimatedScene |
Full-screen canvas background β stars, clouds, rain/snow particles, lightning bolts |
HeroCard |
Current weather β large temperature display, stats pills, humidity bar |
ForecastCard |
Day-by-day forecast grid with animated entrance |
CustomSelect |
Portal-based day-selector dropdown themed to match the dark UI |
Skeleton |
Shimmer loading placeholders |
Placeholder |
Empty state with floating globe animation |
Sky themes (clear, rain, thunder, snow, fog, cloudy, overcast, sunny_warm, sunny_cool) are derived from the API condition string and drive the canvas particle mode, aurora opacity, star visibility, and cloud count.
# application.properties contains secrets β never commit it
src/main/resources/application.propertiesCommit a template instead:
cp src/main/resources/application.properties \
src/main/resources/application.properties.example
# Replace real values with placeholders in the .example file, then commit itThe controller uses @CrossOrigin(origins = "*") for development convenience. Restrict this to your frontend domain in production.
- Fork the repository
- Create your feature branch:
git checkout -b feature/hourly-forecast - Commit your changes:
git commit -m 'feat: add hourly forecast endpoint' - Push to the branch:
git push origin feature/hourly-forecast - Open a Pull Request
This project is licensed under the MIT License β see the LICENSE file for details.
- WeatherAPI.com for the free weather data API
- Google Fonts β Fraunces & DM Sans
- Vercel for free hosting