A modern weather app that helps you decide if you need an umbrella today! Features instant weather analysis, customizable daily notifications, and push notifications that work even when the browser is closed.
- π Instant Umbrella Check: Click the button to instantly analyze current weather conditions
- β° Customizable Notifications: Set your preferred daily notification time
- π± Push Notifications: Get daily weather updates even when the browser is closed
- π§ Smart Weather Analysis: Automatically detects rain, snow, drizzle, storms, and other precipitation
- π Location-Based: Uses your current location or defaults to Lagos
- π¨ Modern UI: Clean, responsive design with beautiful animations
- π Secure: Uses VAPID keys for secure push notifications
- Node.js 18+
- OpenWeatherMap API key (free)
- VAPID keys for push notifications
OpenWeatherMap API Key:
- Go to OpenWeatherMap
- Sign up for a free account
- Get your API key (1000 free calls/day)
Generate VAPID Keys:
npx web-push generate-vapid-keys --json- Clone and install:
git clone <your-repo>
cd weatherCo
npm install- Create environment files:
.env.local (for client):
VITE_WEATHER_API_KEY=your_openweathermap_api_key
VITE_VAPID_PUBLIC_KEY=your_vapid_public_key
VITE_PUSH_SERVER_URL=http://localhost:4000
- Start the push server:
npm run server- Start the development server:
npm run dev- Copy the
push-server/folder to a new repository - Deploy to Railway or Render
- Add environment variables:
VAPID_PUBLIC_KEY=your_vapid_public_key VAPID_PRIVATE_KEY=your_vapid_private_key OPENWEATHERMAP_KEY=your_openweathermap_api_key
- Connect your main app to Vercel
- Add environment variables:
VITE_WEATHER_API_KEY=your_openweathermap_api_key VITE_VAPID_PUBLIC_KEY=your_vapid_public_key VITE_PUSH_SERVER_URL=https://your-push-server.railway.app
- Click the "π Check if I need an umbrella" button
- Get instant analysis with visual feedback
- See if you need an umbrella, should bundle up for snow, or if it's clear weather
- Set your preferred notification time using the time picker
- Receive daily weather updates at your chosen time
- Notifications work even when the browser is closed
The app intelligently analyzes weather conditions:
- π Rain: rain, drizzle, shower, storm, thunder
- βοΈ Snow: snow, sleet, blizzard
- βοΈ Clear: all other conditions
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β React App β β Service Worker β β Push Server β
β β β β β β
β β’ Weather UI βββββΊβ β’ Push Handler βββββΊβ β’ Subscriptions β
β β’ Manual Check β β β’ Click Handler β β β’ Scheduling β
β β’ Time Picker β β β’ Background β β β’ Weather API β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
weatherCo/
βββ src/
β βββ App.jsx # Main app component
β βββ main.jsx # App entry point
β βββ push.js # Push notification utilities
β βββ index.css # Styles
βββ public/
β βββ sw.js # Service worker
β βββ favicon.svg # Umbrella favicon
βββ push-server/ # Standalone push server
β βββ server.js # Express server
β βββ package.json # Server dependencies
β βββ README.md # Server setup guide
βββ server/ # Local development server
βββ DEPLOYMENT_GUIDE.md # Complete deployment guide
POST /subscribe- Register push subscriptionPOST /unsubscribe- Remove push subscriptionPOST /update-time- Update notification time preferenceGET /health- Server health check
- Uses OpenWeatherMap API for current weather data
- Automatic location detection via browser geolocation
- Fallback to Lagos, Nigeria if location denied
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run server # Start local push server
npm run lint # Run ESLintClient (.env.local):
VITE_WEATHER_API_KEY- OpenWeatherMap API keyVITE_VAPID_PUBLIC_KEY- VAPID public keyVITE_PUSH_SERVER_URL- Push server URL
Server (.env):
VAPID_PUBLIC_KEY- VAPID public keyVAPID_PRIVATE_KEY- VAPID private keyOPENWEATHERMAP_KEY- OpenWeatherMap API keyPORT- Server port (default: 4000)
- "Missing API key": Add
VITE_WEATHER_API_KEYto Vercel environment variables - "Push notifications not configured": Deploy push server and add
VITE_PUSH_SERVER_URL - "Already checking weather": Wait for current check to complete
- CORS errors: Ensure push server URL is correct and CORS is enabled
- Push Server: Visit
/healthendpoint - Weather API: Check browser console for API errors
- Service Worker: Check browser dev tools > Application > Service Workers
- Chrome 42+
- Firefox 44+
- Safari 16+
- Edge 17+
Requires:
- Service Worker support
- Push API support
- Notification API support
- VAPID keys for secure push authentication
- HTTPS required for production
- Environment variable protection
- CORS properly configured
MIT License - feel free to use this project for your own weather apps!
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
Made with β€οΈ for people who forget their umbrellas! π