WeatherWise AI is a modern, full-featured weather application that delivers real-time weather updates, multi-city comparisons, and hourly climate trends. Built with React, React Router, and Vite, this application demonstrates expertise in modern web development, API integration, state management, and responsive design across all devices.
- Overview
- Features
- Pages
- Technical Stack
- Architecture & Design
- Getting Started
- Environment Variables
- Deployment
- Recent Fixes & Improvements
- Future Enhancements
- Contributing
- License
- Live Demo
WeatherWise AI provides accurate and real-time weather information for any city worldwide with a seamless multi-page experience. Users can search for locations, view detailed weather metrics, compare multiple cities simultaneously, and review hourly climate trends. The application features intelligent city suggestions, robust error handling, and a fully responsive design that works flawlessly on desktop, tablet, and mobile devices.
- ✨ Multi-Page Architecture - Seamless navigation between three dedicated pages using React Router
- 🔍 Smart City Suggestions - Real-time autocomplete dropdown as you type city names
- 📊 Current Weather Display - Temperature, humidity, wind speed, local time, and air quality metrics
- 🌍 Global City Comparison - Compare weather, comfort metrics, and air quality for up to 10 cities side-by-side
- 📈 Climate Trends - View hourly forecast data (temperature, wind, pressure, UV index, visibility)
- 🎨 Modern, Responsive UI - Beautiful gradient-based design that adapts perfectly to all screen sizes
- ⚡ Fast & Optimized - Built with Vite for lightning-fast development and production builds
- 🔒 Secure API Integration - Direct API calls with proper error handling
- 💾 Recent Searches - Automatically tracks your last searched cities
- 📱 Tablet Optimized - Special handling for tablet devices (768px breakpoint) with responsive tables
- Live weather conditions for any city
- Search with auto-complete suggestions
- Display: Temperature, Humidity, Wind Speed, Feels Like, Local Time, Air Quality
- Recent searched cities tracker
- Compare weather for multiple cities (up to 10)
- Side-by-side comparison table
- Metrics: Temperature, Condition, Humidity, Feels Like, Gas Levels, Status
- Swap and reset functionality
- Auto-suggestion dropdown for each city input
- Hourly forecast for selected city
- Displays next 5 hours of data
- Metrics: Temperature, Precipitation, Wind Speed, Pressure, UV Index, Visibility
- Auto-suggestion dropdown for city search
- Color-coded tables for easy reading
- Frontend: React 18.3.1 + React Router 7.1.3 + Vite 6.0.5
- Styling: Custom CSS with gradient backgrounds and responsive design
- APIs: WeatherAPI for all weather data and city search
- Deployment: Vercel with automatic deployments
- Dev Tools: ESLint, Vite configuration
WeatherWise AI follows modern web development best practices:
src/
├── pages/ # HomePage, GlobalComparisonPage, ClimateChangePage
├── components/ # Reusable components (SearchBar, ClimateChange, etc.)
├── lib/ # API utility functions (weatherApi.js)
├── styles/ # Component-specific CSS files
└── App.jsx # Main routing component
- User searches for a city
- Client fetches data from WeatherAPI
- Results are cached in component state
- UI updates with real-time data
- Error states handled gracefully
- Component-based architecture for reusability
- Separation of concerns - API logic separated from UI
- State management using React hooks (useState, useEffect)
- Responsive design with mobile-first approach
- Consistent styling across all pages
- Node.js (v14 or above)
- npm or yarn
-
Clone the repository:
git clone https://github.com/prashantsaini1525/WeatherWise-AI.git cd weatherwise-ai -
Install dependencies:
npm install
-
Set Up Environment Variables:
Create a
.envfile in the root directory:VITE_API_KEY=your_weatherapi_key
-
Run the App Locally:
npm run dev
Visit
http://localhost:5173(or the port Vite provides) in your browser. -
Build for Production:
npm run build npm run preview
Your WeatherAPI key is required for fetching weather data and city searches.
- Get your key: Sign up at WeatherAPI.com
- Local development: Add to
.envfile - Production (Vercel): Set in Vercel Dashboard under Project Settings → Environment Variables
WeatherWise AI is optimized for Vercel deployment:
- Push code to GitHub
- Connect repository to Vercel:
- Sign in to Vercel
- Click "New Project" and import your GitHub repository
- Configure Environment Variables:
- In Vercel Dashboard: Project Settings → Environment Variables
- Add
VITE_API_KEYwith your WeatherAPI key
- Deploy:
- Vercel auto-detects Vite configuration
- Automatic deployments on every push to main branch
- vercel.json - Rewrites all routes to index.html for proper SPA routing
- .env - Local environment variables (add to .gitignore)
✅ Fixed 404 Errors on Deployed App
- Added
vercel.jsonwith route rewriting - Now
/global-comparisonand/climate-changeroutes work properly on Vercel
✅ Replaced OpenCage API with WeatherAPI
- Removed 401 Unauthorized errors
- Single API key solution (WeatherAPI only)
- Simplified codebase
✅ Fixed Climate Lens Data Fetching
- Multiple searches now work correctly
- Direct API call in handleSearch instead of relying on useEffect
- Data loads consistently every time
✅ Enhanced Climate Lens UI
- Added city auto-suggestion dropdown
- Consistent design with other pages
- Loading and error states
- Improved table responsiveness
✅ Fixed Tablet Responsiveness (768px)
- Both Climate Lens and Global Comparison now display perfectly on tablets
- Proper table scrolling when needed
- Optimized padding and font sizes
- 🌙 Dark mode toggle
- 📍 Geolocation-based weather
- 🔔 Weather alerts and notifications
- 📊 Extended forecasts (7-14 days)
- 🌐 Multi-language support
- 👤 User accounts for saved locations
- 📈 Weather history and trends analysis
- 🎯 Advanced filtering and analytics
Contributions are welcome! Please follow these steps:
- Fork the Repository
- Create a Feature Branch:
git checkout -b feature/your-feature-name - Commit Your Changes: Write clear, descriptive commit messages
- Push Your Branch:
git push origin feature/your-feature-name - Open a Pull Request: Provide detailed description of changes
WeatherWise AI is open source and distributed under the MIT License.
Experience WeatherWise AI in action:
For issues, questions, or suggestions, please open an GitHub Issue.
Built with ❤️ using React, Vite, and WeatherAPI