A simple, client-side weather app that fetches current conditions from OpenWeather API.
A simple, client-side weather app that fetches current conditions from OpenWeather API. No Node.js or backend required — just HTML, CSS, and JavaScript inside docs/.
- Project repository: https://github.com/shivam123-dev/weather-app-oss
This project is a static site located under docs/:
docs/index.html: UI markup and inputsdocs/css/style.css: Stylingdocs/js/index.js: Client-side logic usingfetchto call OpenWeather
Search for a city, and the app shows:
- City and country
- Temperature in °C
- Weather description
- A dynamic background based on the current condition
- A dark/light theme toggle (auto by time, manual toggle saved in localStorage)
- A modern browser (Chrome, Edge, Firefox, Safari)
- An OpenWeather API key: https://openweathermap.org/api
- Get an API key from OpenWeather.
- Open
docs/js/index.jsand replace the value ofAPI.keywith your key.
const API = {
baseUrl: 'https://api.openweathermap.org/data/2.5/weather',
key: 'YOUR_OPENWEATHER_API_KEY'
};No build step is required. You can open the site directly:
- Double-click
docs/index.html
docs/js/index.js calls the OpenWeather endpoint:
GET https://api.openweathermap.org/data/2.5/weather?q={CITY}&appid={API_KEY}&units=metric
The response is parsed and rendered into elements with IDs city, temp, and weather-text in index.html.
- This app only sends requests to OpenWeather and does not store personal data.
- Empty results: ensure your API key is valid and not rate-limited.
- Network errors: check internet connectivity and that the request URL matches the documented endpoint.
- Content not updating: verify the element IDs in
index.htmlmatch those used inindex.js.
See the project changelog at CHANGELOG.md.
Please read CODE_OF_CONDUCT.md and CONTRIBUTING.md before opening issues or pull requests.
Report vulnerabilities per SECURITY.md.
Licensed under the MIT License. See LICENSE.