How rahul-irs/farm_direct works
FarmDirect AI is a role-based agricultural marketplace and supply-chain operations platform. The main buyer journey is marketplace browsing and cart checkout, followed by server-side stock validation, multi-supplier order allocation, development payment records, farmer fulfillment, logistics delivery and tracking, and buyer notifications. The graph also preserves authentication, partner/FPO operations, AI forecasts, reviews, and administration. Relationships are based on the README, shown excerpts, and SOURCE INDEX references; unsampled route implementations are represented at their exact listed paths without inferring their internal call chains.
Main entry points: api.js HTTP API client · App.jsx Role-based routing · orders.py Cart and orders · order.py Order allocations
Components 27
Frontend experience
- Role-based routing
frontend/src/App.jsx - Buyer marketplace
frontend/src/pages/consumer/MarketplacePage.jsx - Cart and orders UI
frontend/src/pages/consumer/CartPage.jsx - Farmer operations UI
frontend/src/pages/farmer/FarmerProductsPage.jsx - Partner operations UI
frontend/src/pages/partners/PartnerDashboardPage.jsx - Logistics UI
frontend/src/pages/logistics/LogisticsDashboardPage.jsx - HTTP API client
frontend/src/services/api.js
Commerce workflow
- Authentication
backend/app/routes/auth.py - Product catalogue
backend/app/routes/products.py - Cart and orders
backend/app/routes/orders.py - Payment records
backend/app/routes/payments.py - Purchase reviews
backend/app/routes/reviews.py
Supply chain operations
- FPO and bulk buying
backend/app/routes/partners.py - Delivery and tracking
backend/app/routes/logistics.py - Notifications
backend/app/routes/notifications.py - AI forecasts
backend/app/routes/ai.py
Platform services
- User accounts
backend/app/models/user.py - Product inventory
backend/app/models/product.py - Order allocations
backend/app/models/order.py - Delivery records
backend/app/models/logistics.py - Partner records
backend/app/models/partners.py - Review records
backend/app/models/review.py - PostgreSQL database
- Flask API setup
backend/app/__init__.py
Other components
- Buyers
- Farmers
- Logistics partners
Connections 48
- Buyers → Role-based routing: use application
README.md - Farmers → Role-based routing: use application
README.md - Logistics partners → Role-based routing: use application
README.md - Role-based routing → Buyer marketplace: routes to
frontend/src/App.jsx - Role-based routing → Farmer operations UI: routes to
frontend/src/App.jsx - Role-based routing → Partner operations UI: routes to
frontend/src/App.jsx - Role-based routing → Logistics UI: routes to
frontend/src/App.jsx - Buyer marketplace → HTTP API client: requests data
- Cart and orders UI → HTTP API client: checks out
- Farmer operations UI → HTTP API client: requests data
frontend/src/pages/farmer/FarmerProductsPage.jsx - Partner operations UI → HTTP API client: requests data
frontend/src/pages/partners/PartnerDashboardPage.jsx - Logistics UI → HTTP API client: requests data
frontend/src/pages/logistics/LogisticsDashboardPage.jsx - HTTP API client → Authentication: calls API
frontend/src/services/api.js - HTTP API client → Product catalogue: calls API
frontend/src/services/api.js - HTTP API client → Cart and orders: calls API
frontend/src/services/api.js - HTTP API client → Payment records: calls API
frontend/src/services/api.js - HTTP API client → Delivery and tracking: calls API
frontend/src/services/api.js - HTTP API client → Notifications: calls API
frontend/src/services/api.js - HTTP API client → AI forecasts: calls API
frontend/src/services/api.js - HTTP API client → FPO and bulk buying: calls API
frontend/src/services/api.js - Flask API setup → Authentication: registers routes
backend/app/__init__.py - Flask API setup → Cart and orders: registers routes
backend/app/__init__.py - Flask API setup → Product catalogue: registers routes
backend/app/__init__.py - Flask API setup → FPO and bulk buying: registers routes
backend/app/__init__.py - Flask API setup → Delivery and tracking: registers routes
backend/app/__init__.py - Cart and orders → Order allocations: reads and writes
backend/app/routes/orders.py - Cart and orders → Product inventory: validates stock
backend/app/routes/orders.py - Cart and orders → Delivery records: coordinates delivery
backend/app/routes/orders.py - Cart and orders → Partner records: uses partner data
backend/app/routes/orders.py - Delivery and tracking → Delivery records: updates delivery
backend/app/routes/logistics.py - Delivery and tracking → Order allocations: updates order
backend/app/routes/logistics.py - Delivery and tracking → Notifications: creates notifications
- Purchase reviews → Review records: creates reviews
backend/app/routes/reviews.py - Purchase reviews → Order allocations: checks purchase
backend/app/routes/reviews.py - Authentication → User accounts: manages accounts
backend/app/routes/auth.py - FPO and bulk buying → Partner records: manages partners
backend/app/routes/partners.py - FPO and bulk buying → Product inventory: uses inventory
backend/app/routes/partners.py - FPO and bulk buying → Order allocations: uses orders
backend/app/routes/partners.py - Product catalogue → Product inventory: manages catalogue
- Payment records → Order allocations: records payment
- Notifications → PostgreSQL database: persists records
- AI forecasts → PostgreSQL database: reads history
- User accounts → PostgreSQL database: persists accounts
README.md - Product inventory → PostgreSQL database: persists inventory
README.md - Order allocations → PostgreSQL database: persists orders
README.md - Delivery records → PostgreSQL database: persists tracking
README.md - Partner records → PostgreSQL database: persists memberships
README.md - Review records → PostgreSQL database: persists reviews