Welcome to the Weather App! This project is a simple yet dynamic weather application that provides real-time weather updates and a 5-day forecast for any city in the world. It also allows users to get weather updates based on their current location.
The app is built using React for the frontend and Flask for the backend, utilizing the OpenWeatherMap API for fetching weather data.
- 🌍 Search Weather by City: Enter the name of a city to get the current weather and a 5-day forecast.
- 📍 Get Weather by Location: Click "Use My Location" to get the weather for your current location using the browser's geolocation API.
- 📅 5-Day Forecast: Provides a 5-day weather forecast with detailed weather icons.
- Frontend: React, Axios, CSS
- Backend: Flask, Python
- API: OpenWeatherMap API
To run this project locally, follow these steps:
- Node.js and npm installed
- Python and pip installed
git clone https://github.com/yourusername/weather-app.git
cd weather-app
- Navigate to the
backend
directory:
cd weather-app/backend
- Create and activate a virtual environment:
python -m venv venv
.\venv\Scripts\activate # On MAC, use `source venv/bin/activate`
- Install the required dependencies using
requirements.txt
:
pip install -r requirements.txt
- Create a
config.json
file in thebackend
directory and add your OpenWeatherMap API key.
{
"OPENWEATHERMAP_API_KEY": "your_api_key_here"
}
- Run the Flask server:
python app.py
- Navigate to the
frontend
directory:
cd weather-app/frontend
- Install the required dependencies:
npm install
- Start the React development server:
npm start
- Open your browser and go to
http://localhost:3000
to see the app in action.
This project is open source and available under the MIT License.
- OpenWeatherMap API for providing the weather data.