A modern, responsive weather application built with Next.js, React, and TypeScript. The app provides real-time weather information with a beautiful, glassmorphic UI design.
-
🌍 Automatic Location Detection
- IP-based location detection (primary)
- GPS-based location (secondary)
- Browser-based location (fallback)
- Manual city search with autocomplete
-
🌤️ Weather Information
- Current weather conditions
- Temperature, humidity, and wind speed
- Sunrise and sunset times
- Weather forecasts
- Dynamic weather backgrounds
-
🎨 Modern UI
- Glassmorphic design
- Responsive layout
- Smooth animations
- Dark mode compatible
- Frontend Framework: Next.js with React
- Language: TypeScript
- Styling: Tailwind CSS
- State Management: React Context
- Icons: Lucide React
- Animations: Framer Motion
- Weather Data: OpenWeather API
- Location Services: Mozilla Location Service, HTML5 Geolocation
- Node.js (v14 or later)
- npm or yarn
- OpenWeather API key
-
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 and add your API keys:NEXT_PUBLIC_OPENWEATHER_API_KEY=your_openweather_api_key NEXT_PUBLIC_RAPIDAPI_KEY=your_rapidapi_key -
Run the development server:
npm run dev # or yarn dev -
Open http://localhost:3000 in your browser.
-
Automatic Location
- The app will automatically detect your location when you first open it
- Uses a three-tier approach for location detection
- Click the location button to retry if automatic detection fails
-
Manual Search
- Click the search icon to enter a city name
- Use the autocomplete suggestions to select a city
- Press Enter or click a suggestion to view weather
-
Weather Information
- View current weather conditions
- Check temperature, wind speed, and other metrics
- See sunrise and sunset times
- View weather forecasts
weather-app/
├── components/ # React components
├── contexts/ # React contexts
├── hooks/ # Custom React hooks
├── public/ # Static assets
├── styles/ # Global styles
└── types/ # TypeScript type definitions
- 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.
- OpenWeather for weather data
- Mozilla Location Service for location services
- Nominatim for reverse geocoding
- Rest Countries for country data
