WeatherEye goes beyond a simple forecast — it's an AI-powered weather platform with real-time conditions, personalized agricultural guidance, global environmental alerts, and live AQI maps, all in one place.
🌐 Live Demo: weather-eye-mocha.vercel.app
✨ Features • 🚀 Quick Start • 🏗️ Project Structure • ⚙️ Tech Stack • 🤖 AI Integration • 🔧 Configuration
- Current conditions (temperature, humidity, wind speed & direction, UV index, visibility)
- 7-day forecast with daily high/low and precipitation probability
- Hour-by-hour breakdown for granular planning
- Location search for any city worldwide
- Daily Brief — AI-generated plain-language summary of the day's weather and air quality
- Agricultural Guidance — Crop recommendations and planting/harvesting warnings based on local conditions
- Powered by Firebase Genkit with the Google Gemini model
- Global Red Alerts — Real-time AI-curated list of severe weather events worldwide
- Air Quality Map — Interactive, real-time world map visualizing AQI levels using Leaflet + React-Leaflet
- Severe weather safety tips tailored to current conditions
- Global emergency contact numbers organized by country/region
- All data, AI advice, and maps are tailored to the city you select
- Persistent location state across pages
| Dashboard | Air Quality Map | Alerts |
|---|---|---|
| Current weather + forecast | Live AQI world map | Severe weather events |
🔗 See it live: weather-eye-mocha.vercel.app
- Node.js 18+ and npm
- A Weather API key (e.g. Open-Meteo — free, no key needed, or your preferred provider)
- A Google AI / Gemini API key for Genkit AI features
- A Firebase project (for Genkit + App Hosting)
git clone https://github.com/MilindLate/WeatherEye.git
cd WeatherEyenpm installCopy the example env file and fill in your keys:
cp .env.example .envEdit .env:
# Google AI / Gemini (required for AI features)
GOOGLE_GENAI_API_KEY=your_google_genai_api_key
# Weather API (configure for your chosen provider)
NEXT_PUBLIC_WEATHER_API_KEY=your_weather_api_key
NEXT_PUBLIC_WEATHER_API_BASE_URL=https://api.open-meteo.com/v1
# Firebase (required for App Hosting deployment)
NEXT_PUBLIC_FIREBASE_API_KEY=your_firebase_api_key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
⚠️ Never commit your.envfile — it is already in.gitignore
npm run devOpen http://localhost:3000 in your browser.
To inspect and test AI flows locally:
npm run genkit:devOpen the Genkit Dev UI at http://localhost:4000.
WeatherEye/
├── 📂 src/
│ ├── 📂 app/ ← Next.js App Router pages
│ │ ├── 📂 dashboard/ ← Main weather dashboard
│ │ ├── 📂 location/ ← City selection page
│ │ ├── 📂 agriculture/ ← AI crop & farming guidance
│ │ ├── 📂 alerts/ ← Global red alerts
│ │ ├── 📂 map/ ← Interactive AQI map
│ │ ├── 📂 emergency/ ← Emergency contacts & tips
│ │ └── actions.ts ← Server Actions (API + AI bridge)
│ │
│ ├── 📂 components/ ← Reusable React components
│ │ ├── weather-app.tsx ← Main dashboard orchestrator
│ │ ├── current-weather.tsx ← Current conditions card
│ │ ├── daily-forecast.tsx ← 7-day forecast component
│ │ ├── hourly-forecast.tsx ← Hour-by-hour chart
│ │ ├── map.tsx ← Leaflet interactive map
│ │ └── 📂 ui/ ← shadcn/ui component library
│ │
│ ├── 📂 ai/
│ │ ├── 📂 flows/ ← Genkit AI flow definitions
│ │ │ ├── daily-brief.ts ← Weather summary AI flow
│ │ │ ├── agriculture.ts ← Crop guidance AI flow
│ │ │ ├── global-alerts.ts ← Severe weather AI flow
│ │ │ └── emergency.ts ← Safety tips AI flow
│ │ └── dev.ts ← Genkit dev server entry
│ │
│ └── 📂 lib/
│ ├── weather-data.ts ← API response transformation
│ └── utils.ts ← Shared utilities
│
├── 📂 docs/ ← Documentation assets
├── 📂 .idx/ ← Firebase IDX config
├── .env ← Environment variables (git-ignored)
├── apphosting.yaml ← Firebase App Hosting config
├── components.json ← shadcn/ui component config
├── next.config.ts ← Next.js configuration
├── tailwind.config.ts ← Tailwind CSS configuration
├── tsconfig.json ← TypeScript configuration
└── package.json
| Layer | Technology | Purpose |
|---|---|---|
| Framework | Next.js 15 (App Router) | Full-stack React framework with Server Actions |
| Language | TypeScript 5 | Type-safe development |
| Styling | Tailwind CSS + shadcn/ui | Utility-first CSS + accessible component library |
| AI / LLM | Firebase Genkit + Google Gemini | AI flows for weather insights, agriculture, alerts |
| Maps | Leaflet + React-Leaflet | Interactive AQI world map |
| Charts | Recharts | Hourly forecast visualization |
| Forms | React Hook Form + Zod | Validated location input |
| Date/Time | date-fns + date-fns-tz | Timezone-aware weather data formatting |
| Deployment | Firebase App Hosting + Vercel | Production hosting |
{
"next": "15.3.3",
"genkit": "^1.20.0",
"@genkit-ai/google-genai": "^1.20.0",
"@genkit-ai/next": "^1.20.0",
"firebase": "^11.9.1",
"leaflet": "^1.9.4",
"react-leaflet": "^4.2.1",
"recharts": "^2.15.1",
"zod": "^3.24.2",
"tailwindcss": "^3.4.1"
}WeatherEye uses Firebase Genkit with the Google Gemini model to power four AI flows:
Takes current weather + AQI data and generates a concise, human-readable summary.
Input: { location, temperature, conditions, aqi, humidity, ... }
Output: "Today in Mumbai expect warm and humid conditions with moderate air quality.
Light rain is possible in the evening — carry an umbrella."
Analyzes weather conditions and returns crop-specific recommendations.
Input: { location, rainfall, temperature, humidity, soil conditions }
Output: { recommendations: [...], warnings: [...], bestCrops: [...] }
Generates a curated list of current severe weather events globally.
Output: [{ region, event_type, severity, description, safety_tips }]
Returns immediate safety guidance based on the active weather threat.
Input: { threat_type, location }
Output: { immediate_steps: [...], contacts: [...], resources: [...] }
Browser (React)
│
▼
Next.js Server Action (/src/app/actions.ts)
│
▼
Genkit Flow (/src/ai/flows/*.ts)
│
▼
Google Gemini API (via @genkit-ai/google-genai)
│
▼
Structured JSON response → rendered in UI
All AI calls run server-side via Next.js Server Actions — your API keys are never exposed to the browser.
npm run dev # Start development server (Turbopack)
npm run build # Production build
npm run start # Start production server
npm run lint # ESLint
npm run typecheck # TypeScript type checking (no emit)
npm run genkit:dev # Start Genkit AI dev server + UI
npm run genkit:watch # Genkit dev server with file watching| Variable | Required | Description |
|---|---|---|
GOOGLE_GENAI_API_KEY |
✅ Yes | Google AI / Gemini API key for all AI flows |
NEXT_PUBLIC_WEATHER_API_KEY |
✅ Yes | Weather data provider API key |
NEXT_PUBLIC_WEATHER_API_BASE_URL |
✅ Yes | Base URL of weather data API |
NEXT_PUBLIC_FIREBASE_API_KEY |
For deploy | Firebase project API key |
NEXT_PUBLIC_FIREBASE_PROJECT_ID |
For deploy | Firebase project ID |
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN |
For deploy | Firebase auth domain |
// WeatherEye uses Next.js App Router — ensure these are configured:
// - Server Actions: enabled by default in Next.js 14+
// - Image domains: add your weather icon CDN if needed
// - Turbopack: enabled via `next dev --turbopack`# Install Vercel CLI
npm i -g vercel
# Deploy
vercel
# Set environment variables in Vercel dashboard:
# Project → Settings → Environment VariablesThe repo includes apphosting.yaml for Firebase App Hosting:
# Install Firebase CLI
npm install -g firebase-tools
# Login & init
firebase login
firebase init apphosting
# Deploy
firebase apphosting:backends:deploy| Route | Page | Description |
|---|---|---|
/ |
Redirect | Redirects to /location |
/location |
City Selection | Search and select your city |
/dashboard |
Weather Dashboard | Current weather, forecast, AI daily brief |
/agriculture |
Farming Insights | AI crop recommendations & warnings |
/alerts |
Global Alerts | Severe weather events worldwide |
/map |
AQI Map | Interactive real-time air quality world map |
/emergency |
Emergency | Safety tips & global emergency contacts |
Contributions are welcome! Here's how to get started:
# 1. Fork the repository on GitHub
# 2. Clone your fork
git clone https://github.com/YOUR_USERNAME/WeatherEye.git
cd WeatherEye
# 3. Create a feature branch
git checkout -b feature/your-feature-name
# 4. Install dependencies and run
npm install
npm run dev
# 5. Make your changes, then check types and lint
npm run typecheck
npm run lint
# 6. Commit and push
git add .
git commit -m "feat: describe your change"
git push origin feature/your-feature-name
# 7. Open a Pull Request on GitHub- TypeScript strict mode enabled — all types must be explicit
- Use shadcn/ui components for UI elements where possible
- AI flows go in
/src/ai/flows/— each flow in its own file - Server-side data fetching and AI calls must use Server Actions in
actions.ts
❌ AI features not working / Genkit errors
- Check that
GOOGLE_GENAI_API_KEYis set correctly in.env - Ensure the API key has access to the Gemini model in Google AI Studio
- Run
npm run genkit:devand open http://localhost:4000 to debug flows directly - Check the browser Network tab or server logs for error messages from Server Actions
❌ Weather data not loading
- Verify
NEXT_PUBLIC_WEATHER_API_KEYandNEXT_PUBLIC_WEATHER_API_BASE_URLin.env - Check the weather API provider's status page and your quota/limits
- Open browser DevTools → Network → look for failed API calls with error details
❌ Map not rendering (blank / broken)
- Leaflet requires a CSS import — ensure
leaflet/dist/leaflet.cssis imported in the map component orlayout.tsx - Map components must be dynamically imported with
{ ssr: false }in Next.js:
const Map = dynamic(() => import('@/components/map'), { ssr: false });❌ Build errors — TypeScript / type issues
# Check all type errors
npm run typecheck
# Common fix: regenerate lock file
rm -rf node_modules package-lock.json
npm install❌ Environment variables not picked up
- Restart the dev server after any
.envchange — Next.js only reads env at startup - Variables exposed to the browser must be prefixed with
NEXT_PUBLIC_ - Server-only variables (like
GOOGLE_GENAI_API_KEY) must NOT haveNEXT_PUBLIC_prefix
- Open-Meteo — Free, open-source weather API
- Firebase Genkit — AI orchestration framework
- Google Gemini — LLM powering AI insights
- shadcn/ui — Beautiful, accessible component library
- Leaflet — Open-source interactive maps
- Vercel — Seamless Next.js deployment
Built with ❤️ by MilindLate
WeatherEye | Next.js 15 | Genkit AI | TypeScript
⭐ If you find this project useful, please give it a star!