A beautiful, minimalistic weather application that provides real-time weather information for any city worldwide. Built with React, TypeScript, and Tailwind CSS.
- City Search: Enter any city name to get current weather information
- Dynamic Backgrounds: Background changes based on weather conditions (sunny, cloudy, rainy, snowy)
- Temperature Unit Toggle: Switch between Celsius and Fahrenheit
- Detailed Weather Info: Temperature, humidity, wind speed, pressure, visibility, and more
- Responsive Design: Works perfectly on desktop, tablet, and mobile devices
- Modern UI: Clean, minimalistic interface with beautiful gradients and animations
- Error Handling: Graceful error messages for invalid cities or API issues
- Demo Mode: Works with demo data when no API key is provided
- React 18 - Modern React with hooks
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first CSS framework
- Vite - Fast development build tool
- shadcn/ui - Beautiful UI components
- Lucide React - Modern icon library
- OpenWeatherMap API - Weather data provider
- Node.js 16+ and npm installed
- OpenWeatherMap API key (optional for demo mode)
-
Clone the repository
git cloneYOUR_GIT_URL>gt; cd YOUR_PROJECT_NAME>gt; -
Install dependencies
npm install
-
Start development server
npm run dev
-
Open your browser Navigate to
http://localhost:8080to see the app
To use live weather data instead of demo data:
-
Get an API key
- Sign up at OpenWeatherMap
- Get your free API key from the dashboard
-
Update the API key
- Open
src/services/weatherService.ts - Replace
'demo_key'with your actual API key:
const API_KEY = 'your_actual_api_key_here';
- Open
The app features a comprehensive design system with:
- Weather-themed gradients for different conditions
- Semantic color tokens for consistent theming
- Responsive typography and spacing
- Smooth animations and transitions
- Glass-morphism effects for modern aesthetics
- Sunny: Warm yellows and oranges
- Cloudy: Cool grays and blues
- Rainy: Deep blues and grays
- Snowy: Light blues and whites
- Clear: Bright blues and whites
src/
βββ components/ # Reusable UI components
β βββ ui/ # shadcn/ui components
β βββ SearchBar.tsx # City search input
β βββ WeatherCard.tsx # Main weather display
β βββ TemperatureToggle.tsx # Unit toggle button
βββ services/ # Business logic
β βββ weatherService.ts # Weather API integration
βββ pages/ # Route components
β βββ Index.tsx # Main weather app page
β βββ NotFound.tsx # 404 page
βββ hooks/ # Custom React hooks
βββ lib/ # Utility functions
βββ index.css # Global styles & design system
tem
esign system
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint
The app integrates with the OpenWeatherMap API to fetch real-time weather data:
- Current Weather: Get current conditions for any city
- Error Handling: Proper error messages for API failures
- Rate Limiting: Respects API rate limits
- Demo Mode: Fallback demo data when API is unavailable
GET /weather- Current weather data by city name
The app automatically changes its background gradient based on the current weather condition:
- Clear skies β Sunny gradient (yellows/oranges)
- Cloudy β Cloudy gradient (grays/blues)
- Rain/Drizzle β Rainy gradient (deep blues)
- Snow β Snowy gradient (light blues/whites)
- Thunderstorm β Stormy gradient (dark blues/grays)
- Current temperature with "feels like" temperature
- Weather description and icon
- Humidity percentage
- Wind speed (km/h)
- Atmospheric pressure (hPa)
- Visibility distance (km)
- Mobile-first approach
- Adapts to all screen sizes
- Touch-friendly interface
- Optimized loading states
- Open your Lovable Project
- Click "Share" β "Publish"
- Your app will be deployed automatically
- Build the project:
npm run build - Deploy the
distfolder to your hosting platform - Configure your hosting to serve
index.htmlfor all routes
- Vercel: Automatic deployments from Git
- Netlify: Drag & drop deploymentment
- GitHub Pages: Free static hosting
- Firebase Hosting: Google's hosting platform
Currently, the app uses a hardcoded API key for simplicity. For production use:
- Create a
.envfile (not included in this template) - Add your API key:
VITE_WEATHER_API_KEY=your_key_here - Update the service to use:
import.meta.env.VITE_WEATHER_API_KEY
To add support for new weather conditions:
- Update
getBackgroundClass()inIndex.tsx - Add new gradient classes in
tailwind.config.ts - Define gradient colors in
index.css
- Modify design tokens in
src/index.css - Update Tailwind config in
tailwind.config.ts - Customize components in their respective files
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes
- Commit:
git commit -m 'Add some feature' - Push:
git push origin feature-name - Submit a pull request
This project is open source and available under the MIT License.
- 5-day forecast display
- Geolocation support for current location
- Weather alerts and notifications
- Multiple cities management
- Historical weather data
- Weather maps integration
- Dark/light mode toggle
- Offline support with cached data
Weather data not loading
- Check your internet connection
- Verify your API key is correct
- Check browser console for errors
App not starting
- Ensure Node.js 16+ is installed
- Delete
node_modulesand runnpm install - Check for port conflicts (default: 8080)
Styling issues
- Clear browser cache
- Check for CSS conflicts
- Verify Tailwind CSS is properly configured
Built with β€οΈ using modern web technologies. Enjoy using WeatherNow!