Weather App is a modern, responsive web application that provides real-time weather information for locations worldwide. Built with Next.js and powered by the OpenWeatherMap API, this application offers a beautiful, intuitive interface with dynamic backgrounds that change based on current weather conditions.
Designed with user experience in mind, the app features temperature unit toggle, smart city suggestions focusing on SAARC region cities, and a persistent search history to enhance usability.
- Real-time Weather Data: Current conditions including temperature, humidity, wind speed, and pressure
- Dynamic Backgrounds: Beautiful backdrop images that change based on current weather
- Responsive Design: Optimized for both mobile and desktop devices
- Error Handling: Graceful error messages when cities aren't found
- Unit Toggle: Switch between Celsius (°C) and Fahrenheit (°F)
- Search Suggestions: Smart city dropdown with focus on SAARC region cities
- Search History: Locally stored history of previous searches
- Sunrise & Sunset Times: Daily solar event times for the selected location
- Frontend Framework: Next.js 15 with React 19
- Styling: TailwindCSS for responsive, utility-first styling
- State Management: React hooks for local state management
- Data Fetching: Client-side API integration with fetch
- Storage: LocalStorage for persistent search history
- Weather Data: OpenWeatherMap API integration
The application follows a component-based architecture with the following structure:
├── app/
│ ├── components/ # UI components
│ │ ├── ErrorDisplay.js # Error handling component
│ │ ├── SearchBar.js # Search input with suggestions
│ │ ├── UnitToggle.js # Temperature unit switcher
│ │ ├── WeatherBackground.js # Dynamic background handler
│ │ └── WeatherCard.js # Weather information display
│ ├── utils/ # Utility functions
│ │ ├── cityData.js # City suggestion data
│ │ ├── searchHistory.js # History management
│ │ └── weatherApi.js # API interaction
│ ├── layout.js # App layout wrapper
│ └── page.js # Main application page
├── public/ # Static assets
│ └── images/ # Weather background images
└── ... # Configuration files
- Node.js 18.x or later
- npm or yarn package manager
-
Clone the repository
git clone https://github.com/yourusername/weather-app.git cd weather-app -
Install dependencies
npm install # or yarn install -
Create a
.envfile in the root directory with your OpenWeatherMap API key:NEXT_PUBLIC_WEATHER_API_KEY=your_api_key_here NEXT_PUBLIC_WEATHER_API_URL=https://api.openweathermap.org/data/2.5/weather NEXT_PUBLIC_WEATHER_API_UNITS=metric NEXT_PUBLIC_WEATHER_API_LANG=en -
Start the development server
npm run dev # or yarn dev -
Open http://localhost:3000 in your browser
This app can be deployed to Vercel, Netlify, or any other static site hosting platform:
# Build for production
npm run build
# Start production server
npm startContributions are welcome! Feel free to open issues or submit pull requests to help improve this project.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Weather data provided by OpenWeatherMap API
- Background images from Unsplash
- Icons and design inspiration from various open-source projects
© 2025 Weather App | Developed by Aditya Singha
