A demo-friendly prototype of KrishiMitra with the original three-tier architecture:
- Frontend: React + Vite + Tailwind + React Router + Axios
- Backend: Spring Boot (Web, Security + JWT, Data JPA) with endpoints for auth, crop detection, advisory, weather, and market prices
- AI microservice: FastAPI stub with a focused
/predictendpoint returning seeded PlantVillage classes - Database: MySQL for the demo (H2 in-memory for local dev fallback)
- Register/Login
- Upload crop image (tomato/potato/corn)
- See disease result with confidence and treatment
- View rule-based advisory + weather snapshot
- Check seeded mandi prices and trend
cd backend
mvn spring-boot:runThis backend targets Java 17 and is configured for MySQL by default. Set SPRING_DATASOURCE_URL, SPRING_DATASOURCE_USERNAME, and SPRING_DATASOURCE_PASSWORD for your local database. AI service URL can be set via AI_SERVICE_URL (defaults to http://localhost:8000/predict).
If mvn is not available in PATH on Windows, run Maven with full path:
Set-Location backend
& "C:\Users\admin\.maven\maven-3.9.14\bin\mvn.cmd" spring-boot:runFor backend test and build commands, see backend/README.md.
cd ai-service
pip install -r requirements.txt
uvicorn main:app --reload --port 8000The AI service now builds a lightweight color-texture classifier from seeded leaf samples on first use and caches the trained weights at ai-service/disease_model.joblib, so inference runs fully offline.
cd frontend
npm install
npm run dev -- --hostSet VITE_API_BASE_URL to point to the backend (default http://localhost:8080).
cd backend
mvn testWindows PowerShell with explicit Maven path:
Set-Location backend
& "C:\Users\admin\.maven\maven-3.9.14\bin\mvn.cmd" testcd frontend
npm run test:runRun only the integration test:
cd frontend
npm run test:run -- src/App.integration.test.jsxdocker-compose up --buildServices:
- mysql on
3306 - ai-service on
8000 - backend on
8080(uses MySQL + AI service inside the network) - frontend on
80(proxies/api/*to backend)
POST /api/auth/register— create prototype user, returns JWTPOST /api/auth/login— authenticate and return JWTPOST /api/crop/detect— secured; sends image + crop to AI service and stores reportGET /api/advisory?cropType=&city=&season=— rule-based recommendationsGET /api/weather?city=— normalized weather snapshot using Open-Meteo (with fallback)GET /api/market?cropType=&city=— seeded mandi prices + mini trend- FastAPI
POST /predict— returns top disease class with confidence for target crop
- Crops limited to tomato, potato, and corn for the demo.
- Advisory and market data are lightweight seeded mappings to keep the prototype reliable.
- Multilingual support (English, Hindi, Marathi) for main UI labels.
- JWT is prototype-grade and should be replaced for production.