A modern web application for AI-powered crop disease detection, soil prediction, and fertilizer recommendations.
- Backend: Flask with ML models (Python)
- Frontend: Next.js 15 (App Router) + TypeScript + Tailwind CSS + shadcn/ui
- Python 3.8+
- Node.js 18+
- Flask backend dependencies
- ML model files in
/modeldirectory
cd ArogyaKrishi
python app.pyThe Flask server will start on http://localhost:5000
cd frontend
npm install
npm run devThe Next.js app will start on http://localhost:3000
Open http://localhost:3000 in your browser. The app will automatically redirect to /dashboard.
- Upload plant leaf images
- AI-powered disease identification
- Confidence scores and fertilizer recommendations
- Image preview with results
- Upload soil images
- Automatic soil type classification
- Crop recommendations based on soil type
- Analysis details and next steps
- Input crop name and nutrient levels (N, P, K)
- Get personalized fertilizer advice
- Nutrient status indicators
- Detailed recommendations and analysis
POST /api/disease-detection- Disease detection with image uploadPOST /api/soil-prediction- Soil type prediction with image uploadPOST /api/fertilizer-recommendation- Fertilizer recommendations
POST /predict- Disease detection (returns HTML)POST /soil-predict- Soil prediction (returns HTML)POST /fertilizer-predict- Fertilizer recommendations (returns HTML)
frontend/src/
app/ # Next.js App Router pages
dashboard/ # Dashboard layout and feature pages
components/
layout/ # Sidebar, Navbar, AppShell
ui/ # shadcn/ui components
common/ # Reusable components
providers/ # React providers
features/ # Feature-based modules
disease-detection/
soil-prediction/
fertilizer-recommendation/
lib/ # Utilities
store/ # Zustand state management
types/ # TypeScript definitions
- Flask app in
ArogyaKrishi/app.py - ML models loaded lazily on first use
- CORS enabled for frontend integration
- Session-based authentication (login/signup)
- Next.js 15 with App Router
- TypeScript for type safety
- Tailwind CSS + shadcn/ui for styling
- React Query for API state management
- Zustand for client state
- React Hook Form + Zod for form validation
Create .env.local in the frontend directory:
NEXT_PUBLIC_BACKEND_URL=http://localhost:5000- Use WSGI server (Gunicorn, uWSGI)
- Configure proper CORS for production domain
- Set up SSL/HTTPS
- Configure proper file upload limits
- Build:
npm run build - Start:
npm start - Deploy to Vercel, Netlify, or any Node.js hosting
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the ISC License.