Skip to content

๐ŸŒพ AI-Powered Agricultural Intelligence Platform | Crop yield prediction, pest detection, soil analysis & market insights for Indian farmers | Next.js 15 + Google Gemini + TypeScript

License

Notifications You must be signed in to change notification settings

lakshay8toic/agrivision-ai

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒพ AgriVision AI

AI-Powered Agricultural Intelligence Platform

Next.js TypeScript Tailwind CSS Google Gemini License

Empowering farmers with AI-driven insights for sustainable and profitable agriculture

Features โ€ข Installation โ€ข Tech Stack โ€ข Contributing


๐Ÿ“– About

AgriVision AI is a comprehensive agricultural decision-support platform that leverages cutting-edge artificial intelligence to provide farmers with actionable insights. Built specifically for Indian farmers, the platform offers multilingual support and addresses real-world agricultural challenges through intelligent data analysis.

๐ŸŽฏ Problem Statement

Farmers face numerous challenges:

  • Unpredictable crop yields
  • Pest and disease identification
  • Soil health management
  • Market price volatility
  • Language barriers in accessing technology

๐Ÿ’ก Our Solution

AgriVision AI provides:

  • AI-powered crop yield predictions using multi-factor analysis
  • Intelligent pest & disease diagnosis from plant images
  • Soil analysis & recommendations for optimal crop selection
  • Real-time weather data integration
  • Market price tracking for informed selling decisions
  • Multilingual interface (English, Hindi, Odia, Telugu)
  • Interactive field management with map-based tools

โœจ Features

๐ŸŒฑ Core Features

Feature Description
๐ŸŽฏ Yield Prediction AI-powered predictions using field data, weather, and soil conditions
๐Ÿ› Pest & Disease Detection Image-based diagnosis with treatment recommendations
๐Ÿงช Soil Analysis NPK analysis with crop recommendations and fertility reports
๐Ÿ—บ๏ธ Field Management Interactive map-based field drawing and area calculation
๐ŸŒค๏ธ Weather Integration Real-time weather data with 7-day forecasts
๐Ÿ’ฐ Market Prices Live market price tracking for major crops
๐ŸŒ Multilingual Support for 4 Indian languages with text-to-speech
๐Ÿ“Š Analytics Dashboard Comprehensive insights and data visualization

๐ŸŽจ Design Features

  • Premium Glass Morphism - Modern, depth-rich UI
  • Advanced Gradients - Multi-color transitions and mesh backgrounds
  • Smooth Animations - 60fps GPU-accelerated effects
  • Dark Mode - Fully optimized dark theme
  • Responsive Design - Works on all devices
  • Accessibility - WCAG compliant with screen reader support

๐Ÿš€ Installation

Prerequisites

  • Node.js 20.x or later
  • npm or yarn
  • Google Gemini API Key (Free tier available)

Quick Start

  1. Clone the repository
git clone https://github.com/Dhuvie/agrivision-ai.git
cd agrivision-ai
  1. Install dependencies
npm install
# or
yarn install
  1. Set up environment variables

Create a .env.local file in the root directory:

# Google Gemini API Key (Required)
GEMINI_API_KEY=your_gemini_api_key_here

Get your API key:

  1. Run the development server
npm run dev
# or
yarn dev
  1. Open your browser

Navigate to http://localhost:9002

Build for Production

npm run build
npm start

๐Ÿ› ๏ธ Tech Stack

Frontend

AI & Backend

  • Google Gemini - Generative AI models
  • Custom ML Model - Crop prediction (Python/FastAPI)
  • FastAPI - Python backend for ML predictions

State Management

  • React Context API - Global state
  • Local Storage - Data persistence
  • React Hook Form - Form management
  • Zod - Schema validation

Development Tools

  • ESLint - Code linting
  • Prettier - Code formatting
  • TypeScript - Type checking

๐Ÿ“ Project Structure

agrivision-ai/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ app/                    # Next.js App Router
โ”‚   โ”‚   โ”œโ”€โ”€ (routes)/          # Application routes
โ”‚   โ”‚   โ”œโ”€โ”€ api/               # API routes
โ”‚   โ”‚   โ”œโ”€โ”€ globals.css        # Global styles
โ”‚   โ”‚   โ””โ”€โ”€ layout.tsx         # Root layout
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”œโ”€โ”€ agrivision/        # Feature components
โ”‚   โ”‚   โ””โ”€โ”€ ui/                # Reusable UI components
โ”‚   โ”œโ”€โ”€ contexts/              # React contexts
โ”‚   โ”‚   โ”œโ”€โ”€ FieldsContext.tsx  # Field management
โ”‚   โ”‚   โ””โ”€โ”€ LanguageContext.tsx # Internationalization
โ”‚   โ”œโ”€โ”€ lib/
โ”‚   โ”‚   โ”œโ”€โ”€ translations.ts    # i18n translations
โ”‚   โ”‚   โ””โ”€โ”€ utils.ts           # Utility functions
โ”‚   โ””โ”€โ”€ ai/
โ”‚       โ”œโ”€โ”€ flows/             # AI workflows
โ”‚       โ””โ”€โ”€ prompts/           # AI prompts
โ”œโ”€โ”€ public/                    # Static assets
โ”œโ”€โ”€ .env.local                 # Environment variables
โ”œโ”€โ”€ package.json               # Dependencies
โ”œโ”€โ”€ tailwind.config.ts         # Tailwind configuration
โ””โ”€โ”€ tsconfig.json             # TypeScript configuration

๐ŸŒ Multilingual Support

AgriVision AI supports 4 languages:

Language Code Status
๐Ÿ‡ฌ๐Ÿ‡ง English en โœ… Complete
๐Ÿ‡ฎ๐Ÿ‡ณ Hindi (เคนเคฟเค‚เคฆเฅ€) hi โœ… Complete
๐Ÿ‡ฎ๐Ÿ‡ณ Odia (เฌ“เฌกเฌผเฌฟเฌ†) or โœ… Complete
๐Ÿ‡ฎ๐Ÿ‡ณ Telugu (เฐคเฑ†เฐฒเฑเฐ—เฑ) te โœ… Complete

Adding New Languages

  1. Add translations to src/lib/translations.ts
  2. Update the Translation type
  3. Add language option in Settings

๐ŸŽจ Design System

Color Palette

/* Primary (Green) */
--primary: 142 70% 45%;

/* Secondary (Blue) */
--secondary: 221 83% 53%;

/* Accent (Amber) */
--accent: 43 74% 66%;

Components

All components follow:

  • Accessibility standards (WCAG 2.1)
  • Responsive design (mobile-first)
  • Dark mode support
  • Animation best practices

๐Ÿค Contributing

We welcome contributions! Here's how you can help:

Ways to Contribute

  • ๐Ÿ› Report bugs - Open an issue
  • ๐Ÿ’ก Suggest features - Share your ideas
  • ๐Ÿ“ Improve documentation - Fix typos, add examples
  • ๐ŸŒ Add translations - Support more languages
  • ๐Ÿ’ป Submit code - Fix bugs, add features

Development Workflow

  1. Fork the repository
  2. Create a feature branch
    git checkout -b feature/amazing-feature
  3. Make your changes
  4. Commit with clear messages
    git commit -m "Add: Amazing new feature"
  5. Push to your fork
    git push origin feature/amazing-feature
  6. Open a Pull Request

Code Style

  • Follow existing code patterns
  • Use TypeScript for type safety
  • Write meaningful commit messages
  • Add comments for complex logic
  • Test your changes thoroughly

๐Ÿ“ API Documentation

AI Flows

Yield Prediction

import { predictYieldFromPrompt } from '@/ai/flows/predict-yield-flow';

const result = await predictYieldFromPrompt({
  fieldDescription: "5 acre wheat field",
  weatherData: { temp: 25, humidity: 70 },
  soilData: { N: 50, P: 40, K: 30 }
});

Pest Detection

import { diagnosePestDisease } from '@/ai/flows/diagnose-pest-disease-flow';

const diagnosis = await diagnosePestDisease({
  imageUrl: "data:image/jpeg;base64,...",
  cropType: "wheat"
});

Custom ML Model

The Python FastAPI backend provides:

# Endpoint: POST /predict
{
  "N": 50,
  "P": 40,
  "K": 30,
  "temperature": 25,
  "humidity": 70,
  "ph": 6.5,
  "rainfall": 100
}

๐Ÿ”’ Security

  • API Keys - Never commit .env.local to version control
  • Input Validation - All user inputs are validated with Zod
  • XSS Protection - React's built-in protection
  • CORS - Configured for production domains

๐Ÿ“Š Performance

Lighthouse Scores

Metric Score
Performance 95+
Accessibility 100
Best Practices 100
SEO 100

Optimizations

  • โšก Next.js App Router - Automatic code splitting
  • ๐Ÿ–ผ๏ธ Image Optimization - Next/Image component
  • ๐ŸŽจ CSS-in-JS - Tailwind CSS (JIT)
  • ๐Ÿ“ฆ Bundle Size - Tree shaking enabled
  • ๐Ÿš€ Edge Functions - Deployed on Vercel Edge

๐Ÿงช Testing

# Run type checking
npm run typecheck

# Run linting
npm run lint

# Build test
npm run build

๐Ÿ“œ License

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


๐Ÿ‘ฅ Team

Built with โค๏ธ for Indian Farmers

AgriVision AI Team

GitHub


๐Ÿ™ Acknowledgments

  • Google Gemini - For powerful AI capabilities
  • Next.js Team - For the amazing framework
  • Radix UI - For accessible components
  • Indian Farmers - For inspiring this project

โญ Star us on GitHub!

If you find AgriVision AI helpful, please consider giving us a star โญ

Made with ๐ŸŒพ for a better agricultural future

About

๐ŸŒพ AI-Powered Agricultural Intelligence Platform | Crop yield prediction, pest detection, soil analysis & market insights for Indian farmers | Next.js 15 + Google Gemini + TypeScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 95.0%
  • Python 2.9%
  • CSS 1.7%
  • Other 0.4%