How banavathuravindranaik24-ops/ai-crop-recommendation works
This is a full-stack agronomic decision-support application. A grower enters soil nutrients, climate, and field area; the React recommendation page can sync city weather, then submits the features to the Express API, which predicts a crop, derives crop guidance and area estimates, and persists a recommendation for the history view. Other major workflows include browsing crop profiles and checking service health. The route files, weather service, database models, and some UI implementations were not excerpted; their roles and documented capabilities are represented, but uncertain internal links are omitted.
Main entry points: App.jsx Application shell · predictController.js Prediction pipeline · app.js Express API app · api.js Frontend API client
Components 28
Grower interface
- Application shell
frontend/src/App.jsx - Recommendation form
frontend/src/pages/RecommendPage.jsx - NPK meter
frontend/src/components/NpkMeter.jsx - Result card
frontend/src/components/ResultCard.jsx - Crop catalog
frontend/src/pages/CatalogPage.jsx - Crop detail modal
frontend/src/components/CropDetailModal.jsx - Recommendation history
frontend/src/pages/HistoryPage.jsx - Home and guidance
frontend/src/pages/HomePage.jsx - Navigation and status
frontend/src/components/Navbar.jsx - Frontend API client
frontend/src/services/api.js
API and routing
- Express API app
backend/src/app.js - HTTP server
backend/src/server.js - Prediction route
backend/src/routes/predictRoutes.js - Crop routes
backend/src/routes/cropRoutes.js - History routes
backend/src/routes/historyRoutes.js - Weather route
backend/src/routes/weatherRoutes.js
Recommendation domain
- Prediction pipeline
backend/src/controllers/predictController.js - Crop prediction engine
backend/src/services/mlModel.js - Area and input metrics
backend/src/services/cropMetrics.js - Weather proxy
backend/src/controllers/weatherController.js - City weather client
backend/src/services/weatherService.js
Catalog and history data
- Crop catalog service
backend/src/controllers/cropController.js - Crop records
backend/src/models/Crop.js - Prediction records
backend/src/models/Prediction.js - MongoDB connection
backend/src/config/db.js - History management
backend/src/controllers/historyController.js
Other components
- Grower
- OpenWeatherMap
Connections 37
- Grower → Application shell: uses
README.md - Application shell → Recommendation form: shows
frontend/src/App.jsx - Application shell → Crop catalog: shows
frontend/src/App.jsx - Application shell → Recommendation history: shows
frontend/src/App.jsx - Application shell → Home and guidance: shows
frontend/src/App.jsx - Application shell → Navigation and status: renders
frontend/src/App.jsx - Application shell → Frontend API client: checks health
frontend/src/App.jsx - Recommendation form → Frontend API client: requests weather and predictions
frontend/src/pages/RecommendPage.jsx - Recommendation form → NPK meter: renders
frontend/src/pages/RecommendPage.jsx - Recommendation form → Result card: renders result
frontend/src/pages/RecommendPage.jsx - Crop catalog → Frontend API client: loads crop data
frontend/src/pages/CatalogPage.jsx - Crop catalog → Crop detail modal: renders
frontend/src/pages/CatalogPage.jsx - Recommendation history → Frontend API client: manages history
frontend/src/pages/HistoryPage.jsx - Frontend API client → Express API app: calls API
frontend/src/services/api.js - Express API app → Prediction route: mounts
backend/src/app.js - Express API app → Crop routes: mounts
backend/src/app.js - Express API app → History routes: mounts
backend/src/app.js - Express API app → Weather route: mounts
backend/src/app.js - HTTP server → Express API app: serves
backend/src/server.js - HTTP server → MongoDB connection: connects
backend/src/server.js - HTTP server → Crop catalog service: seeds crops
backend/src/server.js - Prediction route → Prediction pipeline: dispatches
backend/src/controllers/predictController.js - Crop routes → Crop catalog service: dispatches
backend/src/routes/cropRoutes.js - History routes → History management: dispatches
backend/src/routes/historyRoutes.js - Weather route → Weather proxy: dispatches
backend/src/routes/weatherRoutes.js - Prediction pipeline → Crop prediction engine: predicts and checks NPK
backend/src/controllers/predictController.js - Prediction pipeline → Crop catalog service: gets crop guidance
backend/src/controllers/predictController.js - Prediction pipeline → Area and input metrics: calculates area metrics
backend/src/controllers/predictController.js - Prediction pipeline → MongoDB connection: checks DB status
backend/src/controllers/predictController.js - Prediction pipeline → Prediction records: creates record
backend/src/controllers/predictController.js - Weather proxy → City weather client: fetches city weather
backend/src/controllers/weatherController.js - City weather client → OpenWeatherMap: requests conditions
backend/src/services/weatherService.js - Crop catalog service → MongoDB connection: checks DB status
backend/src/controllers/cropController.js - Crop catalog service → Crop records: queries and seeds
backend/src/controllers/cropController.js - History management → MongoDB connection: checks DB status
backend/src/controllers/historyController.js - History management → Prediction records: reads and mutates records
backend/src/controllers/historyController.js - Navigation and status → Frontend API client: displays health