Skip to content

mdsaad31/FarmAssist

Repository files navigation

🌾 FarmAssist - The AI Farmer Assistant

FarmAssist Banner Next.js TypeScript Gemini AI License

FarmAssist is a next-generation AI-powered digital assistant designed specifically for farmers. It provides real-time guidance, intelligent recommendations, government scheme discovery, weather forecasting, crop advisory, financial planning, and decision-making support through a beautifully designed, emotional, and immersive UI/UX.


✨ Key Features

πŸ€– AI Chat Assistant (Gemini 2.0 Pro)

  • Conversational AI: Natural language interactions powered by Google's Gemini 2.0 Pro
  • Image Analysis: Upload crop/plant images for instant disease detection using Gemini Vision
  • Multi-Language Support: Supports Hindi, Kannada, Telugu, Bengali, Tamil, and more
  • Voice Input: Talk to the assistant naturally
  • Context-Aware: Remembers conversation history for better responses

☁️ Weather Intelligence

  • Real-Time Weather: Current conditions with beautiful animations
  • 7-Day Forecast: Detailed daily predictions
  • Agricultural Insights:
    • Irrigation recommendations
    • Pest risk assessment
    • Soil moisture estimation
    • Farming activity suggestions
  • Animated UI: Rain, clouds, sun animations matching real-time weather

πŸ’° Loan Calculator

  • EMI Calculator: Calculate agricultural loan installments
  • Smart Recommendations: Bank suggestions with best rates
  • Purpose-Based: Tractor, irrigation, seeds, land purchase options
  • Visual Growth Animation: Crop-themed growth visualization

πŸ† Government Schemes Finder

  • Smart Discovery: Auto-recommend schemes based on eligibility
  • Certificate-Style Cards: Beautiful design resembling government documents
  • Detailed Information: Eligibility, benefits, required documents
  • Direct Apply Links: Quick access to application portals
  • Scheme Categories: Income support, insurance, credit, market access

πŸ“ˆ Market Prices

  • Live Mandi Rates: Real-time crop prices from across India
  • Price Trends: Visual indicators for up/down/stable trends
  • Market Insights: AI-powered recommendations on when to sell
  • Multiple Crops: Wheat, rice, cotton, vegetables, and more

🌱 Smart Crop Planner

  • AI Recommendations: Crop suggestions based on season, soil, water availability
  • Suitability Scores: Data-driven compatibility ratings
  • Investment Analysis: Cost estimates and profit potential
  • Seasonal Calendar: Kharif, Rabi, and Zaid crop schedules
  • Detailed Plans: Duration, water needs, expected yields

πŸš€ Quick Start

Prerequisites

Installation

  1. Clone the repository
git clone https://github.com/yourusername/farmassist.git
cd farmassist
  1. Install dependencies
npm install
# or
yarn install
  1. Configure environment variables

Copy .env.example to .env.local:

cp .env.example .env.local

Edit .env.local and add your API keys:

NEXT_PUBLIC_GEMINI_API_KEY=your_gemini_api_key_here
NEXT_PUBLIC_WEATHER_API_KEY=your_weatherapi_key_here
  1. Run the development server
npm run dev
# or
yarn dev
  1. Open your browser

Navigate to http://localhost:3000


🎨 Tech Stack

Frontend

  • Next.js 14 - React framework with App Router
  • TypeScript - Type-safe development
  • Tailwind CSS - Utility-first styling
  • Framer Motion - Smooth animations
  • Zustand - State management

AI & APIs

  • Google Gemini 2.0 Pro - Conversational AI
  • Gemini Vision - Image analysis for disease detection
  • WeatherAPI - Real-time weather data

UI/UX Design

  • Custom Color Palette: Earth, leaf, sky, soil tones
  • Nature-Themed Animations: Seed sprouting, rain, clouds, sun
  • Responsive Design: Mobile-first approach
  • Micro-Interactions: Haptic-like feedback

πŸ“ Project Structure

FarmAssist/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ dashboard/
β”‚   β”‚   └── page.tsx          # Main dashboard with tab navigation
β”‚   β”œβ”€β”€ globals.css            # Global styles and animations
β”‚   β”œβ”€β”€ layout.tsx             # Root layout
β”‚   └── page.tsx               # Landing page with animation
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ ChatInterface.tsx      # AI chat component
β”‚   β”œβ”€β”€ WeatherWidget.tsx      # Weather display with animations
β”‚   β”œβ”€β”€ LoanCalculator.tsx     # EMI calculator
β”‚   β”œβ”€β”€ SchemesFinder.tsx      # Government schemes
β”‚   β”œβ”€β”€ MarketPrices.tsx       # Crop price tracker
β”‚   └── CropPlanner.tsx        # AI crop recommendations
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ gemini.ts              # Gemini API integration
β”‚   β”œβ”€β”€ weather.ts             # Weather API + agricultural analysis
β”‚   β”œβ”€β”€ store.ts               # Zustand state management
β”‚   └── utils.ts               # Utility functions
β”œβ”€β”€ .env.local                 # Environment variables (not committed)
β”œβ”€β”€ tailwind.config.js         # Tailwind configuration
β”œβ”€β”€ next.config.js             # Next.js configuration
└── package.json               # Dependencies

πŸ”‘ Getting API Keys

Gemini API Key

  1. Visit Google AI Studio
  2. Sign in with your Google account
  3. Click "Create API Key"
  4. Copy the key and add to .env.local

Weather API Key

  1. Visit WeatherAPI.com
  2. Sign up for a free account
  3. Navigate to your dashboard
  4. Copy your API key
  5. Add to .env.local

Free Tier Limits:

  • WeatherAPI: 1 million calls/month
  • Gemini: 60 requests/minute (free tier)

🎯 Core Features Deep Dive

1. AI Chat Assistant

Technologies:

  • Gemini 2.0 Flash Exp for text
  • Gemini Vision for image analysis
  • Context-aware conversation history

Capabilities:

// Ask farming questions
"What crops should I plant this season?"

// Disease detection (with image)
Upload plant image β†’ AI diagnoses disease β†’ Treatment plan

// Financial advice
"How can I get a loan for a tractor?"

// Multi-language
Automatic translation to Hindi, Kannada, etc.

System Prompts:

  • General farming assistance
  • Disease detection specialist
  • Crop planning consultant
  • Financial advisory

2. Weather Widget

Agricultural Weather Analysis:

interface AgriWeatherInsights {
  irrigation: {
    recommended: boolean;
    reason: string;
    wateringAmount: string;
  };
  pestRisk: {
    level: 'low' | 'medium' | 'high';
    reason: string;
    pests: string[];
  };
  farmingConditions: {
    suitable: boolean;
    activities: string[];
    warnings: string[];
  };
  soilMoisture: {
    estimated: 'dry' | 'moderate' | 'wet';
    recommendation: string;
  };
}

Animations:

  • Rain drops falling (when raining)
  • Cloud drift animation
  • Sun rotation
  • Dynamic background colors

3. Loan Calculator

Features:

  • EMI calculation using standard formula
  • Loan purpose selection (tractor, seeds, irrigation, etc.)
  • Bank recommendations with rates
  • Visual "crop growth" animation representing financial growth
  • Interest breakdown and total payable amount

Formula:

EMI = [P Γ— r Γ— (1 + r)^n] / [(1 + r)^n - 1]

Where:
P = Principal loan amount
r = Monthly interest rate (annual rate / 12 / 100)
n = Loan tenure in months

4. Government Schemes

Included Schemes:

  • PM-KISAN (Income Support)
  • Pradhan Mantri Fasal Bima Yojana (Crop Insurance)
  • Kisan Credit Card (Credit)
  • Soil Health Card Scheme
  • e-NAM (Market Access)

Features:

  • Filter by category and state
  • Eligibility checker
  • Document requirements
  • Direct application links

5. Market Prices

Features:

  • Live mandi rates for major crops
  • Price trend indicators (↑ ↓ β†’)
  • Percentage change calculations
  • Market insights and selling recommendations
  • Regional price differences

6. Crop Planner

Recommendation Engine:

  • Season compatibility (Kharif, Rabi, Zaid)
  • Water requirement matching
  • Investment capacity analysis
  • Suitability scoring (0-100%)
  • Expected yield and profit potential

Crop Database:

{
  name: 'Rice (Paddy)',
  suitability: 92,
  season: 'Kharif (June-Oct)',
  waterNeed: 'High',
  investment: 'β‚Ή30,000-40,000/acre',
  expectedYield: '40-50 quintals/acre',
  profitPotential: 'High'
}

🎨 Design System

Color Palette

/* Earth Tones */
earth-500: #a67c5d
earth-600: #8d6747

/* Leaf Green */
leaf-400: #6bbf64
leaf-500: #4da446
leaf-600: #3a8534

/* Sky Blue */
sky-400: #38bdf8
sky-500: #0ea5e9
sky-600: #0284c7

/* Soil Brown */
soil-500: #a98868
soil-600: #8f7157

Animations

/* Seed Sprouting (AI Loader) */
@keyframes sprout {
  0% { transform: translateY(20px) scale(0); }
  60% { transform: translateY(-5px) scale(1.05); }
  100% { transform: translateY(0) scale(1); }
}

/* Rain Effect */
@keyframes rain-fall {
  0% { transform: translateY(-100vh); opacity: 0.8; }
  100% { transform: translateY(100vh); opacity: 0; }
}

/* Leaf Sway */
@keyframes leaf-sway {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

🌐 Deployment

Vercel (Recommended)

  1. Push your code to GitHub
  2. Import project in Vercel
  3. Add environment variables in Vercel dashboard
  4. Deploy!

Environment Variables for Production

NEXT_PUBLIC_GEMINI_API_KEY=your_production_key
NEXT_PUBLIC_WEATHER_API_KEY=your_production_key

Build Command

npm run build

🀝 Contributing

Contributions are welcome! Please follow these steps:

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

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

  • Google Gemini AI - For powerful conversational AI
  • WeatherAPI.com - For reliable weather data
  • Indian Government - For agricultural schemes data
  • Farmers - The real heroes who inspired this project

πŸ“ž Support

For support, email [email protected] or open an issue in the repository.


🚧 Roadmap

  • Voice input and audio responses
  • Offline mode with local storage
  • Push notifications for weather alerts
  • Integration with more regional mandis
  • PDF report generation for crop plans
  • Community forum for farmers
  • IoT sensor integration
  • Mobile app (React Native)

πŸ“Š Project Status

Build Status Version PRs Welcome


Made with ❀️ for Farmers by FarmAssist Team

🌾 Empowering Agriculture with AI 🌾

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published