A modern, responsive weather application built with React and Vite that provides real-time weather information for any city worldwide.
- 🌍 Real-time Weather Data: Get current weather conditions for any city
- 🎨 Beautiful UI: Clean, modern interface with gradient backgrounds and smooth animations
- 🌦️ Weather Icons: Dynamic weather icons that change based on current conditions
- 📊 Detailed Information: Temperature, humidity, and wind speed data
- 🔍 Search Functionality: Easy city search with Enter key support
- 📱 Responsive Design: Works seamlessly on desktop and mobile devices


The app displays:
- 🌡️ Current temperature in Celsius
- 🏙️ City name
- 🌤️ Weather icon based on conditions
- 💧 Humidity percentage
- 💨 Wind speed in km/h
- ⚛️ React 19.1.0 – Frontend framework
- ⚡ Vite – Build tool and development server
- 📜 JavaScript (ES6+) – Core programming language for app logic
- 🧱 HTML5 – Semantic markup structure
- 🎨 CSS3 – Styling with gradients and modern layouts
- 🌐 OpenWeatherMap API – Weather data source
Before running this application, make sure you have:
- 📦 Node.js (version 14 or higher)
- 🔧 npm or yarn package manager
- 🔑 An API key from OpenWeatherMap
-
📥 Clone the repository
git clone <repository-url> cd weather-app
-
📦 Install dependencies
npm install
-
⚙️ Set up environment variables Create a
.env
file in the root directory and add your OpenWeatherMap API key:VITE_API_KEY=your_openweathermap_api_key_here
-
▶️ Start the development servernpm run dev
-
🌐 Open your browser Navigate to
http://localhost:5173
to view the application
- 🌐 Visit OpenWeatherMap
- 📝 Sign up for a free account
- 🔑 Generate an API key
- ⚙️ Add the key to your
.env
file as shown above
npm run dev
- 🚀 Start development servernpm run build
- 📦 Build for productionnpm run preview
- 👀 Preview production build
- 🔍 Search for a city: Type the city name in the search bar
- 📊 Get weather data: Press Enter or click the search icon
- 👀 View results: The app will display current weather conditions including:
- 🌡️ Temperature
- 🌤️ Weather icon
- 💧 Humidity
- 💨 Wind speed
The app includes icons for various weather conditions:
- ☀️ Clear sky (day/night)
- ☁️ Clouds
- 🌦️ Drizzle
- 🌧️ Rain
- ❄️ Snow
- 🌫️ Mist/Fog
The application includes error handling for:
- ❌ Invalid city names
- 🌐 Network errors
- 🔧 API failures
- 🔍 Empty search queries
- 🍴 Fork the repository
- 🌟 Create a feature branch (
git checkout -b feature/amazing-feature
) - 💾 Commit your changes (
git commit -m 'Add some amazing feature'
) - 📤 Push to the branch (
git push origin feature/amazing-feature
) - 🔀 Open a Pull Request
This project is open source and available under the MIT License.
- 🌐 Weather data provided by OpenWeatherMap
- 🎥 This project was inspired by tutorials from the GreatStack YouTube channel.
If you find this project useful, consider showing your support:
-
If you encounter any issues or have questions, please open an issue on the GitHub repository.
-
⭐ Star the repository on GitHub
.env
file is already included in .gitignore
for security.