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 smooth transitions
- 🌦️ Weather Icons: Dynamic weather icons that change based on current conditions
- 📊 Detailed Information: Temperature, humidity, and wind speed data
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 modern layouts and smooth transitions
- 🌐 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
.envfile 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:5173to view the application
- 🌐 Visit OpenWeatherMap
- 📝 Sign up for a free account
- 🔑 Generate an API key
- ⚙️ Add the key to your
.envfile 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 basic error handling for:
- ❌ Invalid city names (404 responses)
- 🔍 Empty search queries
- ⚡ Basic fetch failures
- 💬 User-friendly error messages via alerts
- 🍴 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 is based on the weather app tutorial by 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.