How tabhang13-ux/kisan-direct-ai works
KisanDirect AI is an agri-marketplace connecting farmers and FPOs with bulk buyers, with logistics, analytics, and AI-assisted forecasting and routing. The principal flow runs from role-based dashboards through REST APIs to supplier matching, order creation, route optimization, and shipment tracking. The README documents additional capabilities such as price recommendations, FPO aggregation, impact analytics, and the SIH demo scenario. Some feature controllers and dashboards were not sampled, so their internal links are omitted where evidence is unavailable.
Main entry points: index.js Express REST server · prisma.js Prisma data access · api.js REST API client · App.jsx React app and routing
Components 23
Web application
- React app and routing
frontend/src/App.jsx - Role dashboards
frontend/src/pages - Marketplace and impact
frontend/src/pages - Authentication state
frontend/src/context/AuthContext.jsx - REST API client
frontend/src/services/api.js - SIH demo walkthrough
frontend/src/components/SihDemoModal.jsx - Fleet tracking and maps
frontend/src/components/RouteMap.jsx
Marketplace backend
- Express REST server
backend/src/index.js - Authentication and roles
backend/src/controllers/authController.js - Farmer listings
backend/src/controllers/farmerController.js - Buyer requirements
backend/src/controllers/buyerController.js - Supplier matching
backend/src/services/matchingService.js - Order and dispatch
backend/src/controllers/orderController.js - FPO aggregation
backend/src/controllers/fpoController.js - Government analytics
backend/src/controllers/analyticsController.js - Produce marketplace
backend/src/controllers/marketplaceController.js - Notifications
backend/src/controllers/notificationController.js
AI and logistics
- ML service client
backend/src/services/mlClient.js - Forecast and price models
ml-service/app/main.py - Route optimization
ml-service/app/route_optimizer.py
Persistence
- Prisma data access
backend/src/utils/prisma.js - Marketplace database
prisma/schema.prisma
Other components
- Marketplace users
Connections 30
- Marketplace users → React app and routing: uses
frontend/src/App.jsx - React app and routing → Role dashboards: routes to
frontend/src/App.jsx - React app and routing → Marketplace and impact: routes to
frontend/src/App.jsx - React app and routing → SIH demo walkthrough: opens
frontend/src/App.jsx - Role dashboards → REST API client: requests data
frontend/src/pages/BuyerDashboard.jsx - Marketplace and impact → REST API client: requests data
frontend/src/pages/MarketplacePage.jsx - Authentication state → REST API client: authenticates via
frontend/src/context/AuthContext.jsx - SIH demo walkthrough → REST API client: runs scenario
frontend/src/components/SihDemoModal.jsx - REST API client → Express REST server: calls REST API
README.md - Express REST server → Authentication and roles: mounts auth routes
backend/src/index.js - Express REST server → Farmer listings: mounts farmer routes
backend/src/index.js - Express REST server → Buyer requirements: mounts buyer routes
backend/src/index.js - Express REST server → Order and dispatch: mounts order routes
backend/src/index.js - Express REST server → Produce marketplace: mounts marketplace routes
backend/src/index.js - Express REST server → Government analytics: mounts analytics routes
backend/src/index.js - Express REST server → Notifications: mounts notification routes
backend/src/index.js - Buyer requirements → Supplier matching: finds suppliers
backend/src/controllers/buyerController.js - Order and dispatch → ML service client: optimizes route
backend/src/controllers/orderController.js - Order and dispatch → Notifications: creates notification
backend/src/controllers/orderController.js - Farmer listings → ML service client: requests predictions
backend/src/controllers/farmerController.js - ML service client → Forecast and price models: requests forecasts
README.md - ML service client → Route optimization: requests optimization
- SIH demo walkthrough → Fleet tracking and maps: renders route map
frontend/src/components/SihDemoModal.jsx - Authentication and roles → Prisma data access: reads users
backend/src/controllers/authController.js - Farmer listings → Prisma data access: reads and writes
backend/src/controllers/farmerController.js - Buyer requirements → Supplier matching: creates match request
backend/src/controllers/buyerController.js - Supplier matching → Prisma data access: queries listings
backend/src/services/matchingService.js - Order and dispatch → Prisma data access: stores orders
backend/src/controllers/orderController.js - FPO aggregation → Prisma data access: stores aggregation
backend/src/controllers/fpoController.js - Prisma data access → Marketplace database: accesses
README.md