How abisek-ux/agrinew works
AgriLink is a farm-to-table marketplace with farmer, customer, and delivery portals. Users select a portal, authenticate, and then use role-specific workflows for listing and discovering produce, bargaining, ordering, and delivery. The React client calls an Express API; controllers coordinate domain logic and persist through MongoDB models or in-memory fallbacks. The source index documents additional AI, review, notification, and bargaining capabilities. Some client components and server routes were not excerpted, so those links rely on index references; other uncertain connections are omitted.
Main entry points: server.js Express API · App.jsx Portal router · api.js API client · orderController.js Order management
Components 24
Client experience
- Portal router
client/src/App.jsx - Role selection
client/src/components/PortalSelection.jsx - Customer portal
client/src/components/CustomerPortal.jsx - Farmer portal
client/src/components/FarmerPortal.jsx - Delivery portal
client/src/components/DeliveryPortal.jsx - Live tracking map
client/src/components/LiveTrackingMap.jsx
Identity and access
- Sign-in and registration
client/src/components/LandscapeAuth.jsx - Auth state
client/src/context/AuthContext.jsx - Auth routes
server/routes/authRoutes.js - Auth controller
server/controllers/authController.js - Token guard
server/middleware/authMiddleware.js
Marketplace operations
- Product catalog
server/controllers/productController.js - Order management
server/controllers/orderController.js - Price bargaining
server/controllers/bargainController.js - Product reviews
server/controllers/reviewController.js
API and persistence
- API client
client/src/services/api.js - Express API
server/server.js - Product records
server/models/Product.js - Order records
server/models/Order.js - MongoDB connection
server/config/db.js
Assistance and communication
- Phone OTP service
server/services/phoneOtpService.js - AgriLink AI
server/controllers/aiController.js - Notifications
server/controllers/notificationController.js
Other components
- Portal user
Connections 36
- Portal user → Role selection: selects role
- Role selection → Portal router: sets role
client/src/App.jsx - Portal router → Sign-in and registration: opens sign-in
client/src/App.jsx - Portal router → Customer portal: renders customer
client/src/App.jsx - Portal router → Farmer portal: renders farmer
client/src/App.jsx - Portal router → Delivery portal: renders delivery
client/src/App.jsx - Portal router → Auth state: provides auth
client/src/App.jsx - Sign-in and registration → Auth state: uses auth
client/src/components/LandscapeAuth.jsx - Auth state → API client: calls auth
client/src/context/AuthContext.jsx - Customer portal → API client: requests data
client/src/components/CustomerPortal.jsx - Farmer portal → API client: requests data
client/src/components/FarmerPortal.jsx - Delivery portal → API client: requests data
client/src/components/DeliveryPortal.jsx - Delivery portal → Live tracking map: uses map
client/src/components/DeliveryPortal.jsx - Customer portal → Live tracking map: uses map
client/src/components/CustomerPortal.jsx - API client → Auth routes: sends auth requests
client/src/services/api.js - API client → Express API: sends API requests
- Express API → Auth routes: mounts routes
server/server.js - Express API → Product catalog: mounts product routes
server/server.js - Express API → Order management: mounts order routes
server/server.js - Express API → Price bargaining: mounts bargain routes
server/server.js - Express API → Product reviews: mounts review routes
server/server.js - Express API → AgriLink AI: mounts AI routes
server/server.js - Auth routes → Auth controller: dispatches handlers
server/routes/authRoutes.js - Auth routes → Token guard: uses guard
server/routes/authRoutes.js - Auth controller → Phone OTP service: uses phone OTP
server/controllers/authController.js - Auth controller → MongoDB connection: checks connection
server/controllers/authController.js - Product catalog → Product records: reads and writes
server/controllers/productController.js - Product catalog → MongoDB connection: checks connection
server/controllers/productController.js - Order management → Order records: reads and writes
server/controllers/orderController.js - Order management → Product records: updates stock
server/controllers/orderController.js - Order management → Phone OTP service: uses phone OTP
server/controllers/orderController.js - Order management → MongoDB connection: checks connection
server/controllers/orderController.js - Product reviews → Order records: checks order
server/controllers/reviewController.js - Product reviews → Product records: updates ratings
server/controllers/reviewController.js - Product reviews → MongoDB connection: checks connection
server/controllers/reviewController.js - Price bargaining → Notifications: uses notifications
server/controllers/bargainController.js