How thimethz03/govi-sahaya works
Govi Sahaya is a Sri Lankan smart-agriculture and farmer-community platform, with a Flutter mobile client and an Express/MongoDB backend. Farmers use the API for authentication and services including AI crop diagnosis, weather, farm planning, safety help, learning, news, forums, notifications, and a marketplace. The backend routes requests to controllers, which use domain models and services; the sampled marketplace and farm-planning controllers show the persistence layer. Mobile application source and several feature implementations were not sampled, so those documented capabilities are represented at subsystem level, without inferred internal call chains.
Main entry points: shopController.js Marketplace · app.js Express API · mlController.js Crop diagnosis · firebase.js Firebase services
Components 31
API runtime
- Express API
govi_sahaya_backend/src/app.js - API routes
govi_sahaya_backend/src/routes/index.js - Server startup
govi_sahaya_backend/server.js - Firebase services
govi_sahaya_backend/src/config/firebase.js
Identity and users
- Authentication routes
govi_sahaya_backend/src/routes/authRoutes.js - Authentication
govi_sahaya_backend/src/controllers/authController.js - Auth services
govi_sahaya_backend/src/services/authService.js - User records
govi_sahaya_backend/src/models/User.js - Request identity
govi_sahaya_backend/src/middleware/authMiddleware.js
Farm advisory
- ML routes
govi_sahaya_backend/src/routes/mlRoutes.js - Crop diagnosis
govi_sahaya_backend/src/controllers/mlController.js - ML service
govi_sahaya_backend/src/services/mlService.js - Disease records
govi_sahaya_backend/src/models/Disease.js - Weather forecasts
govi_sahaya_backend/src/controllers/weatherController.js - Profit planning
govi_sahaya_backend/src/controllers/profitPlannerController.js - Farm fields
govi_sahaya_backend/src/models/Field.js - Farm expenses
govi_sahaya_backend/src/models/Expense.js - Safety assistance
govi_sahaya_backend/src/controllers/safetyAssistController.js - Nearby hospitals
Community and content
- Knowledge hub
govi_sahaya_backend/src/controllers/knowledgeHubController.js - Farmer forum
govi_sahaya_backend/src/controllers/forumController.js - Agricultural news
govi_sahaya_backend/src/controllers/newsController.js - Notifications
govi_sahaya_backend/src/services/notificationService.js
Marketplace
- Shop routes
govi_sahaya_backend/src/routes/shopRoutes.js - Marketplace
govi_sahaya_backend/src/controllers/shopController.js - Shop inventory
govi_sahaya_backend/src/models/ShopItem.js - Shopping carts
govi_sahaya_backend/src/models/Cart.js - Orders
govi_sahaya_backend/src/models/Order.js
Other components
- Farmer
- MongoDB
- Google Places
Connections 21
- Farmer → Express API: requests services
README.md - Server startup → Express API: starts
govi_sahaya_backend/server.js - Server startup → Firebase services: initializes
govi_sahaya_backend/server.js - Express API → Firebase services: initializes
govi_sahaya_backend/src/app.js - Express API → API routes: mounts routes
govi_sahaya_backend/src/app.js - Authentication routes → Authentication: dispatches
- Authentication → Auth services: uses
- Auth services → User records: queries
govi_sahaya_backend/src/services/authService.js - Request identity → User records: loads user
govi_sahaya_backend/src/middleware/authMiddleware.js - ML routes → Request identity: protects requests
govi_sahaya_backend/src/routes/mlRoutes.js - ML routes → Crop diagnosis: dispatches
govi_sahaya_backend/src/routes/mlRoutes.js - Crop diagnosis → ML service: calls
govi_sahaya_backend/src/controllers/mlController.js - Crop diagnosis → Disease records: queries
govi_sahaya_backend/src/controllers/mlController.js - Profit planning → Farm fields: reads and writes
govi_sahaya_backend/src/controllers/profitPlannerController.js - Profit planning → Farm expenses: reads and writes
govi_sahaya_backend/src/controllers/profitPlannerController.js - Safety assistance → Nearby hospitals: searches nearby
govi_sahaya_backend/src/controllers/safetyAssistController.js - Shop routes → Marketplace: dispatches
govi_sahaya_backend/src/routes/shopRoutes.js - Marketplace → Shop inventory: reads and writes
govi_sahaya_backend/src/controllers/shopController.js - Marketplace → Shopping carts: reads and writes
govi_sahaya_backend/src/controllers/shopController.js - Marketplace → Orders: reads and writes
govi_sahaya_backend/src/controllers/shopController.js - Marketplace → Firebase services: uploads images
govi_sahaya_backend/src/controllers/shopController.js