AgriAlert is a full-stack, real-time weather monitoring and alerting platform designed specifically for West Bengal farmers. Get hyper-local weather data, crop-specific advisories, and automated alerts to protect your harvest.
- Live weather data from Open-Meteo API (free, no API key required)
- Hyper-local forecasts for 8+ West Bengal districts
- Updates every 30 seconds
- Home

- Add multiple farms with specific locations and crop types
- Track Rice, Jute, Potato, Tea, Wheat, Mustard, and Mango
- Get personalized crop-specific advisories
-
- Create custom alert rules (e.g., "Alert if Humidity > 85%")
- Automatic notifications for critical weather conditions
- Severity levels: Low, Medium, High, Critical
-
- Beautiful, responsive UI built with React + TailwindCSS
- Real-time charts and weather visualizations
- Mobile-friendly design
-
- React (v19) with TypeScript
- TailwindCSS v4 for styling
- Wouter for routing
- TanStack Query for data fetching
- Recharts for data visualization
- Shadcn/UI component library
- Node.js + Express
- PostgreSQL (via Neon serverless)
- Drizzle ORM for database operations
- Zod for validation
- Open-Meteo - Free weather API (no key required)
- Replit - Development environment
- Vercel - Frontend hosting
- Render - Backend hosting
- Node.js 20+
- PostgreSQL database
- npm or yarn
-
Clone the repository:
git clone https://github.com/YOUR_USERNAME/agrialert.git cd agrialert -
Install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env
Edit
.envand add yourDATABASE_URL:DATABASE_URL=postgres://user:pass@host:5432/dbname PORT=5000 NODE_ENV=development
-
Push database schema:
npm run db:push
-
Start the development server:
npm run dev
-
Open your browser: Navigate to
http://localhost:5000
See README_DEPLOY.md for detailed deployment instructions to Vercel and Render.
-
Frontend (Vercel):
vercel --prod
-
Backend (Render):
- Connect GitHub repo
- Add
DATABASE_URLenvironment variable - Deploy
-
Database (Render PostgreSQL):
- Create new PostgreSQL database
- Copy external URL to backend env vars
agrialert/
├── client/ # React frontend
│ ├── src/
│ │ ├── components/ # UI components
│ │ ├── pages/ # Page components
│ │ ├── lib/ # Utilities & API client
│ │ └── hooks/ # React hooks
│ └── index.html
├── server/ # Express backend
│ ├── db.ts # Database connection
│ ├── storage.ts # Data access layer
│ ├── routes.ts # API routes
│ ├── weather-service.ts # Weather API integration
│ └── index.ts # Server entry point
├── shared/ # Shared TypeScript types
│ └── schema.ts # Drizzle schema definitions
├── scripts/ # Utility scripts
│ └── create-zip.sh # Create downloadable ZIP
├── README.md # This file
├── README_DEPLOY.md # Deployment guide
├── .env.example # Environment template
├── vercel.json # Vercel configuration
├── package.json
└── tsconfig.json
AgriAlert currently supports these districts:
- ✅ Bardhaman
- ✅ Hooghly
- ✅ Nadia
- ✅ Murshidabad
- ✅ Malda
- ✅ Darjeeling
- ✅ Jalpaiguri
- ✅ Medinipur
Crops Supported: Rice (Paddy), Jute, Potato, Tea, Wheat, Mustard, Mango
GET /api/farms- Get all farmsPOST /api/farms- Create a new farmDELETE /api/farms/:id- Delete a farmGET /api/farms/:id/advisory- Get weather + crop advisory
GET /api/weather/:location- Get real-time weather
GET /api/alert-rules- Get all alert rulesPOST /api/alert-rules- Create a new rulePATCH /api/alert-rules/:id- Update a ruleDELETE /api/alert-rules/:id- Delete a rule
GET /api/alert-logs- Get alert historyPOST /api/alert-logs- Create an alert logPATCH /api/alert-logs/:id/read- Mark alert as read
Run the development server and test the following:
-
Add a Farm:
- Navigate to "My Farms"
- Click "Add Farm"
- Fill in details and save
-
Check Weather:
- View the Dashboard
- Verify real-time temperature updates
-
Create Alert Rule:
- Go to "Alert Rules"
- Create a rule (e.g., "Temp > 35°C")
- Toggle it on/off
| Variable | Description | Required |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | ✅ Yes |
PORT |
Server port (default: 5000) | No |
NODE_ENV |
Environment (development/production) | No |
TWILIO_ACCOUNT_SID |
For SMS alerts (future) | No |
TWILIO_AUTH_TOKEN |
For SMS alerts (future) | No |
SENDGRID_API_KEY |
For email alerts (future) | No |
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License. See LICENSE for details.
- Open-Meteo for providing free weather data API
- Replit for the amazing development environment
- West Bengal farmers for the inspiration
Have questions or suggestions? Open an issue on GitHub!
Built with ❤️ for West Bengal Farmers 🌾 "# AgriAlert"