A modern, responsive weather web application that provides real-time weather data, forecasts, and atmospheric insights for any location worldwide.
Weather App is a fully client-side weather application built with vanilla HTML, CSS, and JavaScript. It fetches live weather data using the OpenWeatherMap API and presents it in a clean, intuitive interface. Users can search for any city in the world and get instant access to current conditions.
Whether you're planning a trip, checking morning conditions, or just curious about the weather on the other side of the world — this app has you covered.
-
🔍 City Search — Search any city or town globally by name
-
📍 Geolocation Support — Automatically detect and display weather for the user's current location
-
🌡️ Current Weather — Real-time temperature, "feels like," humidity, wind speed, and visibility
| Technology | Purpose |
|---|---|
| HTML5 | Semantic markup and structure |
| CSS3 | Styling, animations, responsive layout (Flexbox & Grid) |
| JavaScript (ES6+) | App logic, DOM manipulation, API calls |
| OpenWeatherMap API | Weather data source (current + forecast) |
| Fetch API | Async HTTP requests to weather endpoints |
| LocalStorage | Persisting user preferences and search history |
| Geolocation API | Browser-native location detection |
Follow these steps to run the project locally on your machine.
-
Clone the repository
git clone https://github.com/your-username/weather-app.git
-
Navigate into the project directory
cd weather-app -
Open the project
Simply open
index.htmlin your browser:open index.html # or on Windows: start index.htmlOr use Live Server in VS Code for hot-reloading during development.
-
Go to https://openweathermap.org/ and create a free account.
-
Navigate to My API Keys in your dashboard and copy your key.
// js/config.js const API_KEY = "YOUR_API_KEY_HERE"; const BASE_URL = "https://openweathermap.org/";
⚠️ Security Note: Never commit your API key to a public repository. Use environment variables or a.envfile and add it to.gitignorefor production applications.
The user either types a city name in the search bar or clicks "Use My Location" to trigger the browser's Geolocation API.
The app makes two parallel fetch calls to OpenWeatherMap:
-
Current Weather:
GET /weather?q={city}&appid={key} -
5-Day Forecast:
GET /forecast?q={city}&appid={key}
Raw API responses are parsed and transformed:
-
Temperatures converted from Kelvin to °C or °F
-
Unix timestamps converted to human-readable dates
-
Wind degrees converted to compass directions (N, NE, E, SE, etc.)
This app uses the OpenWeatherMap API.
GET https://api.openweathermap.org/data/2.5/weather?units=metric&q={city name}&appid={API key}
Contributions are welcome! Here's how to get involved:
-
Fork the repository
-
Create a new feature branch
git checkout -b feature/your-feature-name
-
Commit your changes
git commit -m "feat: add your feature description" -
Push to your branch
git push origin feature/your-feature-name
-
Open a Pull Request against the
mainbranch
Planned features for upcoming versions:
-
OpenWeatherMap — Free-tier weather API
-
Font Awesome — UI icons
-
Google Fonts — Typography
-
MDN Web Docs — API references and documentation
Your Name
-
🐙 GitHub: prince pundir
-
📧 Email: princepundir125@gmail.com
-
💼 LinkedIn: linkedin.com/in/
Made with ❤️ and ☕ by Prince Pundir
⭐ Star this repo if you found it useful!