How phucthinh2704/agri-ecommerce works
FarmFresh is a full-stack produce-commerce application with a customer storefront and an admin panel. The main customer journey is browsing products, managing a cart, checking out, and reviewing orders; account access gates cart and order actions. Admins manage catalog, categories, users, and orders, with dashboard reporting. The backend exposes these domains through Express routes and MongoDB models. The README documents PayPal, Google OAuth, and Cloudinary capabilities; sampled source is incomplete, so some integration and route-to-client links are not asserted.
Main entry points: App.jsx Route application · order.controller.js Order service · index.js API route dispatch · chatbot.controller.js AI assistant service
Components 32
Customer storefront
- Route application
client/src/App.jsx - Account access
client/src/pages/Login.jsx - Product discovery
client/src/pages/AllProducts.jsx - Category browsing
client/src/pages/Category.jsx - Product details
client/src/pages/ProductDetail.jsx - Shopping cart
client/src/pages/Cart.jsx - Checkout
client/src/pages/Checkout.jsx - Order history
client/src/pages/MyOrders.jsx - Shopping assistant
client/src/components/Chatbot.jsx
Admin operations
- Admin dashboard
client/src/pages/admin/Dashboard.jsx - Product management
client/src/pages/admin/ManageProducts.jsx - Product editor
client/src/pages/admin/UpdateProduct.jsx - Category management
client/src/pages/admin/ManageCategories.jsx - Order management
client/src/pages/admin/ManageOrders.jsx - User management
client/src/pages/admin/ManageUsers.jsx
Backend services
- API route dispatch
server/routes/index.js - Identity service
server/controllers/user.controller.js - Catalog service
server/controllers/product.controller.js - Cart service
server/controllers/cart.controller.js - Order service
server/controllers/order.controller.js - Category service
server/controllers/category.controller.js - AI assistant service
server/controllers/chatbot.controller.js - Image upload
server/controllers/upload.controller.js
MongoDB data
- User records
server/models/User.js - Product records
server/models/Product.js - Cart records
server/models/Cart.js - Order records
server/models/Order.js - Category records
server/models/Category.js
Other components
- Customer
- Google OAuth
- PayPal Sandbox
- Cloudinary
Connections 43
- Customer → Route application: browses
- Route application → Account access: routes to
client/src/App.jsx - Route application → Product discovery: routes to
client/src/App.jsx - Route application → Category browsing: routes to
client/src/App.jsx - Route application → Product details: routes to
client/src/App.jsx - Route application → Shopping cart: protects route
client/src/App.jsx - Route application → Checkout: protects route
client/src/App.jsx - Route application → Order history: protects route
client/src/App.jsx - Route application → Admin dashboard: routes to
client/src/App.jsx - Route application → Product management: routes to
client/src/App.jsx - Route application → Category management: routes to
client/src/App.jsx - Route application → Order management: routes to
client/src/App.jsx - Route application → User management: routes to
client/src/App.jsx - Product discovery → Catalog service: requests catalog
- Category browsing → Category service: requests categories
- Shopping cart → Cart service: updates cart
- Checkout → Order service: places order
client/src/pages/Checkout.jsx - Order history → Order service: loads history
client/src/pages/MyOrders.jsx - Account access → Identity service: authenticates
- Account access → Google OAuth: supports sign-in
- Checkout → PayPal Sandbox: offers payment
- Product editor → Image upload: uploads images
- Image upload → Cloudinary: stores images
- API route dispatch → Identity service: mounts user routes
- API route dispatch → Catalog service: mounts product routes
- API route dispatch → Category service: mounts category routes
- API route dispatch → Order service: mounts order routes
- API route dispatch → Cart service: mounts cart routes
- API route dispatch → AI assistant service: mounts chat routes
server/routes/index.js - Identity service → User records: reads and writes
server/controllers/user.controller.js - Catalog service → Product records: queries products
server/controllers/product.controller.js - Cart service → Cart records: reads and writes
server/controllers/cart.controller.js - Cart service → Product records: loads products
server/controllers/cart.controller.js - Order service → Order records: creates and queries
server/controllers/order.controller.js - Order service → Cart records: reads cart
server/controllers/order.controller.js - Order service → Product records: adjusts stock
server/controllers/order.controller.js - Order service → User records: searches users
server/controllers/order.controller.js - AI assistant service → Product records: searches products
server/controllers/chatbot.controller.js - AI assistant service → Order records: checks orders
server/controllers/chatbot.controller.js - AI assistant service → Category records: queries categories
server/controllers/chatbot.controller.js - AI assistant service → Cart records: reads cart
server/controllers/chatbot.controller.js - Category service → Category records: manages categories
- Shopping assistant → AI assistant service: sends messages