A modern, feature-rich weather application built with React, Vite, and Tailwind CSS. Get real-time weather forecasts for any city worldwide with a beautiful, responsive interface.
- Worldwide City Search - Search for any city globally using Nominatim (OpenStreetMap)
- Real-time Weather Data - Current conditions and 5-day forecasts via Open-Meteo API
- Favorites System - Save your favorite cities for quick access
- Smart Search - Debounced city search with autocomplete suggestions
- Dark/Light Mode - Toggle between themes with persistent preferences
- Temperature Units - Switch between Celsius, Fahrenheit, and Kelvin
- Responsive Design - Works seamlessly on desktop, tablet, and mobile
- Modern UI - Beautiful gradient headers and smooth animations
- Fast Performance - Built with Vite for lightning-fast development and builds
- State Management - Redux Toolkit for temperature unit, React Context for theme/favorites
- React Router - Multi-page navigation with URL-based routing
- Local Storage - Persistent user preferences and favorites
- Frontend Framework: React 19
- Build Tool: Vite 7
- Styling: Tailwind CSS 4
- State Management: Redux Toolkit, React Context API
- Routing: React Router DOM 7
- HTTP Client: Axios
- Package Manager: pnpm
- Linting: ESLint 9
- APIs:
- Open-Meteo - Free weather API (no key required)
- Nominatim - Free geocoding API (no key required)
- Node.js 22 or higher
- pnpm 9 or higher
-
Clone the repository
git clone <repository-url> cd weather-app
-
Install dependencies
pnpm install
-
Start development server
pnpm dev
-
Open in browser Navigate to
http://localhost:5173
- View popular cities with current weather
- Search for any city worldwide
- Click on a city card to view detailed weather
- View comprehensive weather information
- See current conditions and 5-day forecast
- Add/remove cities from favorites using the star icon
- Navigate back using the header
- Access all your saved favorite cities
- Quick overview of weather for all favorites
- Click any favorite to view detailed weather
- Toggle between light and dark themes
- Switch temperature units (Celsius, Fahrenheit, Kelvin)
- All preferences are saved automatically
weather-app/
├── src/
│ ├── components/ # Reusable React components
│ │ ├── AppHeader/ # Application header with navigation
│ │ ├── CityCard/ # City weather card component
│ │ ├── SearchBar/ # City search with autocomplete
│ │ └── WeatherDetails/ # Detailed weather display
│ ├── contexts/ # React Context providers
│ │ ├── SettingsContext.jsx # Theme and favorites management
│ │ └── useSettings.js # Settings hook
│ ├── pages/ # Page components
│ │ ├── HomePage.jsx # Main page with popular cities
│ │ ├── WeatherDetailsPage.jsx # Weather details view
│ │ ├── SettingsPage.jsx # Settings and preferences
│ │ └── FavoritesPage.jsx # Favorites list
│ ├── services/ # API services
│ │ ├── citySearch.js # City search API integration
│ │ └── weatherService.js # Weather API integration
│ ├── store/ # Redux store
│ │ ├── store.js # Redux store configuration
│ │ ├── temperatureUnitSlice.js # Temperature unit reducer
│ │ └── hooks.js # Typed Redux hooks
│ ├── utils/ # Utility functions
│ │ ├── cityName.js # City name formatting
│ │ ├── temperature.js # Temperature conversion
│ │ └── weatherIconMapper.js # Weather icon mapping
│ ├── App.jsx # Main app component with routes
│ └── main.jsx # Application entry point
├── .github/
│ └── workflows/ # GitHub Actions workflows
│ ├── ci.yml # CI pipeline for pull requests
│ ├── main.yml # CI/CD pipeline for main branch
│ ├── reusable_ci.yml # Reusable CI workflow
│ ├── release.yml # Release automation
│ ├── deploy.yml # Deployment workflow
│ └── perfomance.yml # Performance testing
├── public/ # Static assets
└── package.json # Dependencies and scripts
# Start development server
pnpm dev
# Build for production
pnpm build
# Preview production build
pnpm preview
# Run linter
pnpm lint
# Run tests (placeholder)
pnpm testdocker build -t weather-app .docker run -p 80:80 weather-appThe app will be available at http://localhost
The project uses a multi-container setup with separate builder and web server containers:
docker compose up -dThis will:
- Build the React application in a Node.js container
- Serve the built app using Nginx
- Start a PostgreSQL database container (for testing)
The app will be available at http://localhost:8089
Services:
builder- Node.js container that builds the applicationweb- Nginx container serving the built applicationdb- PostgreSQL 16 database container (port 5432)
Stop containers:
docker compose downView logs:
docker compose logs -fThe project includes automated CI/CD pipelines:
-
CI Workflow (
ci.yml): Runs on pull requests to main- Linting
- Testing
- Security audit (pnpm audit, SAST scan)
-
Main Workflow (
main.yml): Runs on push to main branch- Linting
- Testing
- Production build
- Docker image build and push to GitHub Container Registry
-
Release Workflow (
release.yml): Runs on version tag push (v*)- Builds application
- Generates changelog from git commits
- Creates GitHub release with custom changelog
- Builds and pushes Docker image with version tags
-
Deploy Workflow (
deploy.yml): Runs on version tag push (v*)- Deploys application via SSH
- Pulls latest Docker images
- Restarts containers using docker compose
-
Performance Workflow (
perfomance.yml): Runs weekly and on main branch pushes- Lighthouse CI performance testing
- Generates performance reports
- Uploads artifacts for analysis
- Free: No API key required
- Coverage: Worldwide
- Rate Limits: Generous free tier
- Data: Current conditions, hourly and daily forecasts
- Free: No API key required
- Coverage: Worldwide
- Rate Limits: Please use responsibly (1 request per second recommended)
- Data: City coordinates and location information
- Cities are saved with coordinates for accurate weather retrieval
- Favorites persist across browser sessions using localStorage
- Supports cities at coordinates (0, 0) and negative coordinates
- Managed with Redux Toolkit for global state
- Supports Celsius (°C), Fahrenheit (°F), and Kelvin (K)
- Preferences saved to localStorage
- Light and dark modes
- Theme preference persists across sessions
- Smooth transitions between themes
- 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
This project is open source and available under the MIT License.
- Open-Meteo for free weather data
- Nominatim for free geocoding services
- Tailwind CSS for styling
- React and Vite teams
Made with ❤️ using React and modern web technologies