A simple weather application that fetches and displays real-time weather information for a given city using the OpenWeather API.
- Displays temperature, humidity, wind speed, and weather icon.
- Supports search functionality by city name.
- Handles errors for invalid city names or empty inputs.
- Automatically converts temperatures from Kelvin to Celsius.
- React: For building the user interface.
- OpenWeather API: For fetching real-time weather data.
- CSS: For styling the application.
- Node.js installed.
- OpenWeather API key. You can get one by signing up at OpenWeather.
-
Clone the repository:
git clone https://github.com/Choubi-Mohammed/Weather-App.git
-
Navigate to the project directory:
cd Weather-App
-
Install dependencies:
npm install
-
Create a
.env
file in the root directory and add your OpenWeather API key:VITE_APP_ID=your_api_key_here
-
Start the development server:
npm run dev
-
Open your browser and navigate to:
http://localhost:5173
- Enter the name of a city in the search bar.
- Click the search button or press Enter.
- View the weather information, including:
- Temperature (in Celsius).
- Humidity.
- Wind speed.
- Weather icon.
- Displays a message if:
- The input field is empty.
- The city is not found in the OpenWeather database.
Weather-App/
├── public/
├── src/
│ ├── assets/
│ │ ├── clear.png
│ │ ├── cloud.png
│ │ ├── drizzle.png
│ │ ├── humidity.png
│ │ ├── rain.png
│ │ ├── search.png
│ │ ├── snow.png
│ │ └── wind.png
│ ├── components/
│ │ ├── Weather.css
│ │ ├── Weather.jsx
│ ├── App.jsx
│ ├── index.css
│ ├── main.jsx
├── .env
├── .gitignore
├── eslint.config.js
├── index.html
├── package-lock.json
├── package.json
├── README.md
└── vite.config.js
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add feature-name"
- Push to the branch:
git push origin feature-name
- Create a pull request.
For any inquiries, please reach out to Choubi Mohammed.