Skip to content

AgriAlert is a precision farming weather alert and dashboard platform designed to help farmers make informed decisions. It provides real-time local weather updates, crop-specific recommendations, and customizable alert rules based on weather conditions to optimize farm management.

License

Notifications You must be signed in to change notification settings

Sreoshh/AgriAlert

Repository files navigation

🌾 AgriAlert - Farming Weather Alert System

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.

AgriAlert Banner


✨ Features

🌦️ Real-Time Weather Monitoring

  • 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 Screenshot 2025-12-03 211931

🚜 Farm Management

  • Add multiple farms with specific locations and crop types
  • Track Rice, Jute, Potato, Tea, Wheat, Mustard, and Mango
  • Get personalized crop-specific advisories
  • Screenshot 2025-12-03 211953

🔔 Smart Alert System

  • Create custom alert rules (e.g., "Alert if Humidity > 85%")
  • Automatic notifications for critical weather conditions
  • Severity levels: Low, Medium, High, Critical
  • Screenshot 2025-12-03 212003

📊 Interactive Dashboard

  • Beautiful, responsive UI built with React + TailwindCSS
  • Real-time charts and weather visualizations
  • Mobile-friendly design
  • Screenshot 2025-12-03 213637

🛠️ Tech Stack

Frontend

  • React (v19) with TypeScript
  • TailwindCSS v4 for styling
  • Wouter for routing
  • TanStack Query for data fetching
  • Recharts for data visualization
  • Shadcn/UI component library

Backend

  • Node.js + Express
  • PostgreSQL (via Neon serverless)
  • Drizzle ORM for database operations
  • Zod for validation

APIs & Services

  • Open-Meteo - Free weather API (no key required)
  • Replit - Development environment
  • Vercel - Frontend hosting
  • Render - Backend hosting

📦 Installation

Prerequisites

  • Node.js 20+
  • PostgreSQL database
  • npm or yarn

Quick Start

  1. Clone the repository:

    git clone https://github.com/YOUR_USERNAME/agrialert.git
    cd agrialert
  2. Install dependencies:

    npm install
  3. Set up environment variables:

    cp .env.example .env

    Edit .env and add your DATABASE_URL:

    DATABASE_URL=postgres://user:pass@host:5432/dbname
    PORT=5000
    NODE_ENV=development
  4. Push database schema:

    npm run db:push
  5. Start the development server:

    npm run dev
  6. Open your browser: Navigate to http://localhost:5000


🚀 Deployment

See README_DEPLOY.md for detailed deployment instructions to Vercel and Render.

Quick Deploy Summary:

  1. Frontend (Vercel):

    vercel --prod
  2. Backend (Render):

    • Connect GitHub repo
    • Add DATABASE_URL environment variable
    • Deploy
  3. Database (Render PostgreSQL):

    • Create new PostgreSQL database
    • Copy external URL to backend env vars

📂 Project Structure

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

🌍 West Bengal Coverage

AgriAlert currently supports these districts:

  • ✅ Bardhaman
  • ✅ Hooghly
  • ✅ Nadia
  • ✅ Murshidabad
  • ✅ Malda
  • ✅ Darjeeling
  • ✅ Jalpaiguri
  • ✅ Medinipur

Crops Supported: Rice (Paddy), Jute, Potato, Tea, Wheat, Mustard, Mango


🔌 API Endpoints

Farms

  • GET /api/farms - Get all farms
  • POST /api/farms - Create a new farm
  • DELETE /api/farms/:id - Delete a farm
  • GET /api/farms/:id/advisory - Get weather + crop advisory

Weather

  • GET /api/weather/:location - Get real-time weather

Alert Rules

  • GET /api/alert-rules - Get all alert rules
  • POST /api/alert-rules - Create a new rule
  • PATCH /api/alert-rules/:id - Update a rule
  • DELETE /api/alert-rules/:id - Delete a rule

Alert Logs

  • GET /api/alert-logs - Get alert history
  • POST /api/alert-logs - Create an alert log
  • PATCH /api/alert-logs/:id/read - Mark alert as read

🧪 Testing

Run the development server and test the following:

  1. Add a Farm:

    • Navigate to "My Farms"
    • Click "Add Farm"
    • Fill in details and save
  2. Check Weather:

    • View the Dashboard
    • Verify real-time temperature updates
  3. Create Alert Rule:

    • Go to "Alert Rules"
    • Create a rule (e.g., "Temp > 35°C")
    • Toggle it on/off

📝 Environment Variables

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

🤝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License. See LICENSE for details.


🙏 Acknowledgments

  • Open-Meteo for providing free weather data API
  • Replit for the amazing development environment
  • West Bengal farmers for the inspiration

📧 Contact

Have questions or suggestions? Open an issue on GitHub!


Built with ❤️ for West Bengal Farmers 🌾 "# AgriAlert"

About

AgriAlert is a precision farming weather alert and dashboard platform designed to help farmers make informed decisions. It provides real-time local weather updates, crop-specific recommendations, and customizable alert rules based on weather conditions to optimize farm management.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages