Empowering farmers with AI-driven insights for sustainable and profitable agriculture
Features โข Installation โข Tech Stack โข Contributing
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.
Farmers face numerous challenges:
- Unpredictable crop yields
- Pest and disease identification
- Soil health management
- Market price volatility
- Language barriers in accessing technology
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
| 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 |
- 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
- Node.js 20.x or later
- npm or yarn
- Google Gemini API Key (Free tier available)
- Clone the repository
git clone https://github.com/Dhuvie/agrivision-ai.git
cd agrivision-ai- Install dependencies
npm install
# or
yarn install- 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_hereGet your API key:
- Visit Google AI Studio
- Click "Create API key"
- Copy and paste into
.env.local
- Run the development server
npm run dev
# or
yarn dev- Open your browser
Navigate to http://localhost:9002
npm run build
npm start- Next.js 15.3 - React framework with App Router
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first styling
- Radix UI - Accessible component primitives
- Lucide React - Beautiful icons
- Recharts - Data visualization
- Leaflet - Interactive maps
- Google Gemini - Generative AI models
- Custom ML Model - Crop prediction (Python/FastAPI)
- FastAPI - Python backend for ML predictions
- React Context API - Global state
- Local Storage - Data persistence
- React Hook Form - Form management
- Zod - Schema validation
- ESLint - Code linting
- Prettier - Code formatting
- TypeScript - Type checking
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
AgriVision AI supports 4 languages:
| Language | Code | Status |
|---|---|---|
| ๐ฌ๐ง English | en |
โ Complete |
| ๐ฎ๐ณ Hindi (เคนเคฟเคเคฆเฅ) | hi |
โ Complete |
| ๐ฎ๐ณ Odia (เฌเฌกเฌผเฌฟเฌ) | or |
โ Complete |
| ๐ฎ๐ณ Telugu (เฐคเฑเฐฒเฑเฐเฑ) | te |
โ Complete |
- Add translations to
src/lib/translations.ts - Update the
Translationtype - Add language option in Settings
/* Primary (Green) */
--primary: 142 70% 45%;
/* Secondary (Blue) */
--secondary: 221 83% 53%;
/* Accent (Amber) */
--accent: 43 74% 66%;All components follow:
- Accessibility standards (WCAG 2.1)
- Responsive design (mobile-first)
- Dark mode support
- Animation best practices
We welcome contributions! Here's how you can help:
- ๐ 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
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Make your changes
- Commit with clear messages
git commit -m "Add: Amazing new feature" - Push to your fork
git push origin feature/amazing-feature
- Open a Pull Request
- Follow existing code patterns
- Use TypeScript for type safety
- Write meaningful commit messages
- Add comments for complex logic
- Test your changes thoroughly
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 }
});import { diagnosePestDisease } from '@/ai/flows/diagnose-pest-disease-flow';
const diagnosis = await diagnosePestDisease({
imageUrl: "data:image/jpeg;base64,...",
cropType: "wheat"
});The Python FastAPI backend provides:
# Endpoint: POST /predict
{
"N": 50,
"P": 40,
"K": 30,
"temperature": 25,
"humidity": 70,
"ph": 6.5,
"rainfall": 100
}- API Keys - Never commit
.env.localto version control - Input Validation - All user inputs are validated with Zod
- XSS Protection - React's built-in protection
- CORS - Configured for production domains
| Metric | Score |
|---|---|
| Performance | 95+ |
| Accessibility | 100 |
| Best Practices | 100 |
| SEO | 100 |
- โก 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
# Run type checking
npm run typecheck
# Run linting
npm run lint
# Build test
npm run buildThis project is licensed under the MIT License - see the LICENSE file for details.
- Google Gemini - For powerful AI capabilities
- Next.js Team - For the amazing framework
- Radix UI - For accessible components
- Indian Farmers - For inspiring this project
If you find AgriVision AI helpful, please consider giving us a star โญ
Made with ๐พ for a better agricultural future