A web application that helps farmers make crop and fertilizer decisions using simple inputs, even without soil reports.
KrishiSaarthi AI is a hackathon-ready farming recommendation system that provides:
- Crop Recommendations: Suggest top 2-3 crops based on farm conditions
- Fertilizer Planning: Detailed NPK recommendations with costs
- Multiple Input Methods: Soil report or simple questionnaire
- Location-based Guidance: Find nearby soil testing labs
- Government Schemes: Information on agricultural benefits and subsidies
- Frontend App (Vercel): https://krishi-sarthi-ai.vercel.app
- Backend API (Render): https://astrax-greentech.onrender.com
-
Soil Report Analysis - Upload soil test results (N, P, K, pH) for precise recommendations
-
Questionnaire Mode - Simple questions for farmers without soil reports
-
Smart Recommendations:
- Crop suitability scoring
- Fertilizer calculation and scheduling
- Cost optimization suggestions
- Yield potential estimates
-
Support Services:
- Soil testing lab finder with contact details
- Government schemes information
- Agricultural best practices guide
- Cost-saving tips
AstraX_Greentech/
├── frontend/ # React Frontend
│ ├── public/
│ │ └── index.html # HTML template
│ ├── src/
│ │ ├── pages/ # Page components
│ │ │ ├── Home.js
│ │ │ ├── SoilReportAdvisor.js
│ │ │ ├── QuestionnaireAdvisor.js
│ │ │ ├── SoilTestingLabs.js
│ │ │ └── GovernmentSchemes.js
│ │ ├── services/ # API services
│ │ │ └── api.js # Axios configuration
│ │ ├── styles/ # CSS files
│ │ ├── App.js
│ │ └── index.js
│ └── package.json
│
├── backend/ # Node.js Backend
│ ├── routes/ # API routes
│ │ ├── recommendations.js
│ │ ├── soilLabs.js
│ │ └── schemes.js
│ ├── services/ # Business logic
│ │ └── recommendationEngine.js
│ ├── data/ # Mock data
│ │ ├── soilLabs.js
│ │ └── schemes.js
│ ├── server.js # Express server
│ ├── package.json
│ └── .env.example
│
└── README.md
Frontend:
- React 18
- React Router DOM
- Axios (HTTP client)
- CSS3 (Responsive Design)
Backend:
- Node.js
- Express.js
- CORS
- dotenv
git clone https://github.com/ankitkumar764/AstraX_Greentech.git
cd AstraX_Greentech# Navigate to backend directory
cd backend
# Install dependencies
npm install
# Create .env file
copy .env.example .env
# Start the backend server
npm run dev
# Backend runs on http://localhost:5000# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Start the development server
npm start
# Frontend opens at http://localhost:3000- Click on "📊 Soil Report" from navigation
- Enter your soil test parameters (N, P, K, pH)
- Select your crop and budget
- Get detailed fertilizer recommendations
- Click on "❓ Questionnaire"
- Answer simple questions about your farm
- Receive top 3 crop recommendations with fertilizer plans
- Soil Testing Labs: Find nearby labs with contact details
- Government Schemes: Browse agricultural subsidies and benefits
- Testing Guide: Learn how to collect soil samples
POST /api/recommendations/get
POST /api/recommendations/soil-report
GET /api/soil-labs/:state
GET /api/soil-labs
GET /api/schemes/list
GET /api/schemes/category/:category
- Wheat (Rabi)
- Rice (Kharif)
- Maize (Kharif/Rabi)
- Cotton (Kharif)
- Sugarcane (Kharif/Rabi)
- Pulses (Rabi)
- Vegetables (Year-round)
- Crop Scoring: Algorithm evaluates soil type, season, pH, water needs, and budget
- Fertilizer Calculation: Determines NPK deficit and calculates optimal fertilizer mix
- Cost Optimization: Provides cost-saving suggestions and government scheme info
| Fertilizer | N% | P% | K% | Cost/50kg |
|---|---|---|---|---|
| Urea | 46 | 0 | 0 | ₹250 |
| DAP | 18 | 46 | 0 | ₹1100 |
| MOP | 0 | 0 | 60 | ₹600 |
| Neem | 3 | 1 | 1 | ₹400 |
Create .env in backend directory:
PORT=5000
NODE_ENV=development
FRONTEND_URL=http://localhost:3000
{
"success": true,
"crop": "wheat",
"soilAnalysis": {
"nitrogen": 200,
"phosphorus": 20,
"potassium": 150,
"pH": 6.8
},
"fertilizerPlan": {
"recommendations": [
{
"name": "DAP",
"bags": 2,
"timing": "At planting",
"cost": 2200
}
],
"totalCost": 3500
}
}heroku create your-app-name
git push heroku mainnpm run build
vercel --prodEdit backend/services/recommendationEngine.js and add to cropDatabase
Edit backend/data/soilLabs.js
Edit backend/data/schemes.js
Backend not running:
- Ensure Node.js is installed:
node --version - Run
npm installin backend folder - Check port 5000 is free
Frontend API errors:
- Verify backend is running
- Check REACT_APP_API_URL in frontend .env
- Open browser console for error messages
Port in use:
# Windows
netstat -ano | findstr :5000
taskkill /PID <PID> /F
# Linux/Mac
lsof -i :5000
kill -9 <PID>For issues or questions, check:
- Troubleshooting section above
- Browser console (F12)
- Backend terminal logs
- Database integration (MongoDB)
- User authentication
- Real crop price updates
- Weather-based recommendations
- Mobile app
- Multi-language support
- Plant disease detection
- Historical yield tracking
Made with 🌱 for Indian Farmers