How phuctran22/agrixanh works
AgriXanh is a clean-produce marketplace with customer, seller, and admin portals, backed by a FastAPI API and MongoDB with a mock-data fallback. The main workflow is browsing products, managing a cart, placing and paying for orders, and then managing fulfillment and inventory; AI Vision assessment and loyalty are additional product capabilities. The map preserves these documented and indexed subsystems. Some router implementations and frontend pages were not excerpted, so their internal calls are omitted rather than inferred.
Main entry points: api.js API client · main.py FastAPI application · App.jsx Portal router · database.py Database access
Components 25
Web application
- Portal router
frontend/src/App.jsx - Product catalog
frontend/src/pages/Products.jsx - Cart and account
frontend/src/pages/Cart.jsx - Seller portal
frontend/src/pages/seller/SellerAIEvaluate.jsx - Admin portal
frontend/src/pages/admin/AdminProducts.jsx - Local auth and cart
frontend/src/store/authStore.js - API client
frontend/src/services/api.js
Marketplace services
- Authentication
backend/app/api/auth.py - Product catalog API
backend/app/api/products.py - Orders
backend/app/api/orders.py - Payments
backend/app/api/payments.py - Loyalty program
backend/app/api/loyalty.py - AI Vision
backend/app/api/ai_vision.py
Platform internals
- FastAPI application
backend/main.py - Database access
backend/app/core/database.py - Mock seed data
backend/app/utils/mock_data.py - Domain schemas
backend/app/models/schemas.py - JWT and password security
backend/app/core/security.py - Loyalty models
backend/app/models/loyalty.py
Seller and admin operations
- Inventory
backend/app/api/inventory.py - Statistics
backend/app/api/statistics.py
Other components
- Customer
- Seller
- Admin
- MongoDB
Connections 45
- Customer → Portal router: uses portal
frontend/src/App.jsx - Seller → Portal router: uses portal
frontend/src/App.jsx - Admin → Portal router: uses portal
frontend/src/App.jsx - Portal router → Product catalog: routes to
frontend/src/App.jsx - Portal router → Cart and account: routes to
frontend/src/App.jsx - Portal router → Seller portal: routes to
frontend/src/App.jsx - Portal router → Admin portal: routes to
frontend/src/App.jsx - Product catalog → API client: requests data
frontend/src/services/api.js - Cart and account → API client: requests data
frontend/src/services/api.js - Cart and account → Local auth and cart: reads and updates
frontend/src/store/authStore.js - Seller portal → API client: requests data
frontend/src/services/api.js - Admin portal → API client: requests data
frontend/src/services/api.js - Portal router → Local auth and cart: checks user
frontend/src/App.jsx - API client → Authentication: calls auth routes
frontend/src/services/api.js - API client → Product catalog API: calls product routes
frontend/src/services/api.js - API client → Orders: calls order routes
frontend/src/services/api.js - API client → Payments: calls payment routes
frontend/src/services/api.js - API client → Inventory: calls inventory routes
frontend/src/services/api.js - API client → Loyalty program: calls loyalty routes
frontend/src/services/api.js - FastAPI application → Authentication: registers router
backend/main.py - FastAPI application → Product catalog API: registers router
backend/main.py - FastAPI application → Orders: registers router
backend/main.py - FastAPI application → Payments: registers router
backend/main.py - FastAPI application → AI Vision: registers router
backend/main.py - FastAPI application → Inventory: registers router
backend/main.py - FastAPI application → Statistics: registers router
backend/main.py - FastAPI application → Loyalty program: registers router
backend/main.py - FastAPI application → Database access: connects lifecycle
backend/main.py - Database access → MongoDB: connects and seeds
backend/app/core/database.py - Database access → Mock seed data: loads seed records
backend/app/core/database.py - Authentication → Database access: reads database
backend/app/api/auth.py - Authentication → JWT and password security: hashes and validates tokens
backend/app/api/auth.py - Authentication → Domain schemas: uses request models
backend/app/api/auth.py - Product catalog API → Database access: reads database
backend/app/api/products.py - Product catalog API → Domain schemas: uses product models
backend/app/api/products.py - Orders → Database access: reads and writes
backend/app/api/orders.py - Orders → Domain schemas: uses order models
backend/app/api/orders.py - Orders → Loyalty program: uses loyalty operations
backend/app/api/orders.py - Orders → Product catalog API: uses product operations
backend/app/api/orders.py - Orders → Loyalty models: uses loyalty models
backend/app/api/orders.py - Loyalty program → Database access: reads and writes
backend/app/api/loyalty.py - Loyalty program → JWT and password security: decodes tokens
backend/app/api/loyalty.py - Loyalty program → Loyalty models: uses loyalty models
backend/app/api/loyalty.py - Inventory → Database access: reads database
backend/app/api/inventory.py - AI Vision → Domain schemas: uses analysis models
backend/app/api/ai_vision.py