Skip to content

saantoshh/Weatherly

Repository files navigation

🌀 Weatherly β€” Live Weather App

Java Spring Boot React WeatherAPI License

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


✨ Features

  • 🌍 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

πŸ›  Tech Stack

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

πŸ“ Project Structure

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

πŸš€ Getting Started

Prerequisites

  • Java 17 or higher
  • Maven 3.6+
  • Node.js 18+ and npm
  • A free API key from WeatherAPI.com

1. Clone the repository

git clone https://github.com/saantoshh/Weatherly.git
cd Weatherly

2. Configure your API key

Open 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. Add application.properties to .gitignore and commit an .example file with placeholder values instead.


3. Run the backend

./mvnw spring-boot:run

The Spring Boot server starts at http://localhost:8080.


4. Run the React frontend

cd frontend
npm install
npm run dev

The React dev server starts at http://localhost:5173 and proxies API calls to localhost:8080.

For production: run npm run build inside frontend/, then copy the dist/ output into src/main/resources/static/ so Spring Boot serves it directly.


πŸ“‘ API Reference

Get current weather

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

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
    }
  ]
}

Test endpoint

GET /weather/test/{city}

Returns "Good" if the server is reachable.


🎨 Frontend Architecture

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.


πŸ” Keeping Your API Key Safe

# application.properties contains secrets β€” never commit it
src/main/resources/application.properties

Commit 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 it

🌐 CORS

The controller uses @CrossOrigin(origins = "*") for development convenience. Restrict this to your frontend domain in production.


🀝 Contributing

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/hourly-forecast
  3. Commit your changes: git commit -m 'feat: add hourly forecast endpoint'
  4. Push to the branch: git push origin feature/hourly-forecast
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


πŸ™ Acknowledgements


Made with β˜• Spring Boot and βš›οΈ React

🌐 Live Demo

About

🌀 Weatherly β€” Full Stack Weather Application Weatherly is a full-stack weather application I built to practice Spring Boot architecture and push the boundaries of what a weather app's frontend can feel like. Rather than displaying numbers on a plain card, I wanted the UI to actually feel like the weather

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages