The Weather App is a web-based application that provides real-time weather information. It intelligently caches data for offline use. The weather was developed as a part of my college project.
Real-time Weather Data – Fetches live weather updates from OpenWeatherMap.
Smart Caching – Uses localStorage for offline access and backend storage for optimization.
Efficient API Calls – Requests new data only if the last update is older than 2 hours.
Offline Support – Displays cached data when the user is offline.
PHP Backend – Manages data requests and reduces direct API dependencies.
- Frontend: HTML, CSS, JavaScript
- Backend: PHP
- API: OpenWeatherMap
- Storage: LocalStorage & MySQL Database
- User enters a city name.
- The app checks internet connectivity:
- If offline, it retrieves data from localStorage.
- If online, it sends a request to the backend.
- The backend checks if weather data is available and up-to-date:
- If fresh data exists, it is returned to the frontend.
- If data is outdated or missing, the backend fetches new data from OpenWeatherMap.
- New data is stored in the database and localStorage.
- Weather details are displayed to the user.
git clone https://github.com/Aadithapa456/Weather-app.git
cd weather-app- Ensure you have a PHP server running (XAMPP, MAMP, or any live server).
- Set up a MySQL database and update credentials in the backend.
- Open
index.htmlin your browser.
Improve UI/UX – Enhance styling for better user experience.
Geolocation Support – Automatically fetch weather based on user location.
Unit Selection – Allow users to switch between Celsius and Fahrenheit.
Progressive Web App (PWA) – Enable installation and offline-first experience.
For questions or collaboration, feel free to reach out!