A modern, responsive weather application built with React that provides real-time weather information, forecasts, and location-based data. Features a sleek dark theme UI with intuitive search functionality and customizable units.
This project is based on a challenge from Frontend Mentor. Special thanks to Frontend Mentor for providing the design files, images, icons, and Figma resources that made this implementation possible.
- Real-time Weather Data: Get current weather conditions for any location
- Location Search: Search for cities and locations
- Geolocation Support: Automatically detect and use your current location
- Relocate to Current Location: Button to quickly return to your current location's weather after searching elsewhere
- Weather Forecasts: View hourly and daily weather forecasts
- Unit Conversion: Toggle between metric and imperial units for temperature, wind speed, and precipitation
- Responsive Design: Optimized for both desktop and mobile devices
- Dark Theme: Modern dark UI with custom fonts and animations
- Frontend: React 19, React DOM
- Styling: Tailwind CSS 4
- State Management: Redux Toolkit, React Redux
- Form Handling: React Hook Form
- Icons: React Icons
- Build Tool: Vite
- APIs: Weather API, Geocoding API, Reverse Geocoding API
| Desktop Preview | Mobile Preview |
|---|---|
![]() |
![]() |
| Search Bar and Hint | Unit Menu | Days Menu |
|---|---|---|
![]() |
![]() |
![]() |
-
Clone the repository:
git clone https://github.com/abhi-zero/weather-app.git cd weather-app -
Install dependencies:
npm install
-
Create environment variables file (
.env) in the root directory:VITE_WEATHER_API_BASE_URL=your_weather_api_base_url VITE_GEOCODE_API_BASE_URL=your_geocode_api_base_url VITE_REVERSE_GEOCODE_API_KEY=your_reverse_geocode_api_key VITE_REVERSE_GEOCODE_API_BASE_URL=your_reverse_geocode_api_base_url
-
Start the development server:
npm run dev
-
Open your browser and navigate to
http://localhost:5173(or the port shown in the terminal).
The application requires the following environment variables to be set in a .env file:
VITE_WEATHER_API_BASE_URL: Base URL for the weather APIVITE_GEOCODE_API_BASE_URL: Base URL for the geocoding APIVITE_REVERSE_GEOCODE_API_KEY: API key for reverse geocodingVITE_REVERSE_GEOCODE_API_BASE_URL: Base URL for reverse geocoding API
- Search for a Location: Type in the search bar to find weather for any city
- Use Current Location: Allow location access for automatic weather detection
- Relocate to Current Location: Click the location arrow button to return to your current location's weather after searching elsewhere
- View Forecasts: Scroll through hourly and daily weather predictions
- Change Units: Use the unit toggle buttons to switch between metric and imperial systems
npm run dev: Start the development servernpm run build: Build the project for productionnpm run lint: Run ESLint for code lintingnpm run preview: Preview the production build locally
src/
├── api/ # API service functions
├── app/ # Redux store configuration
├── assets/ # Static assets (fonts, images)
├── components/ # Reusable React components
│ ├── CurrentWeather/ # Current weather display
│ ├── DailyForecast/ # Daily forecast component
│ ├── Header/ # Navigation and header
│ ├── HourlyWeather/ # Hourly forecast
│ ├── Search/ # Location search component
│ └── WeatherDetail/ # Weather details
├── content/ # Static content
├── features/ # Redux slices
├── hooks/ # Custom React hooks
└── index.css # Global styles and Tailwind config
- Fork the repository
- Create a 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




