How saniya454/textileb2b works
TextileHub is a B2B fabric procurement marketplace connecting garment buyers with verified mills. The primary workflow is browsing and comparing fabrics or suppliers, then using buyer-portal ordering; suppliers manage listings and inventory, while role-aware authentication and AI assistance support both sides. The backend exposes Express APIs over MongoDB, with a documented Vercel serverless entry point. The graph emphasizes documented routes and sampled imports; unsampled page-to-service and order-processing details are left unconnected where evidence is unavailable.
Main entry points: AppRoutes.jsx App routes · aiService.js Contextual AI · Supplier.js Supplier records · app.js Express API
Components 27
Marketplace client
- App routes
frontend/src/routes/AppRoutes.jsx - Role and session
frontend/src/context/AuthContext.jsx - Authentication client
frontend/src/services/authService.js - API client
frontend/src/services/api.js
Procurement and mills
- Public marketplace
frontend/src/pages/MarketplacePage.jsx - Supplier directory
frontend/src/pages/SuppliersPage.jsx - Buyer portal
frontend/src/pages/buyer/BuyerMarketplace.jsx - Supplier inventory
frontend/src/pages/supplier/SupplierInventory.jsx
API and domain services
- Express API
backend/app.js - Authentication routes
backend/routes/authRoutes.js - Product routes
backend/routes/productRoutes.js - AI routes
backend/routes/aiRoutes.js - Auth and profile
backend/controllers/authController.js - Product catalog
backend/controllers/productController.js - Supplier profiles
backend/controllers/supplierController.js - Order handling
backend/controllers/orderController.js - AI chat API
backend/controllers/aiController.js - Contextual AI
backend/services/aiService.js
Persistent data
- User records
backend/models/User.js - Supplier records
backend/models/Supplier.js - Product records
backend/models/Product.js - Order records
backend/models/Order.js - Chat history
backend/models/Chat.js
Other components
- Buyer
- Supplier
- MongoDB Atlas
- Hugging Face LLM
Connections 34
- Buyer → App routes: browses and signs in
frontend/src/routes/AppRoutes.jsx - Supplier → App routes: opens supplier portal
frontend/src/routes/AppRoutes.jsx - App routes → Public marketplace: routes public
frontend/src/routes/AppRoutes.jsx - App routes → Supplier directory: routes public
frontend/src/routes/AppRoutes.jsx - App routes → Buyer portal: protects buyer routes
frontend/src/routes/AppRoutes.jsx - App routes → Supplier inventory: protects supplier routes
frontend/src/routes/AppRoutes.jsx - Role and session → Authentication client: uses
frontend/src/context/AuthContext.jsx - Authentication client → API client: sends requests
frontend/src/services/authService.js - API client → Express API: calls API
README.md - Express API → Authentication routes: mounts
backend/app.js - Express API → Product routes: mounts
backend/app.js - Express API → AI routes: mounts
backend/app.js - Authentication routes → Auth and profile: dispatches
backend/routes/authRoutes.js - Product routes → Product catalog: dispatches
backend/routes/productRoutes.js - AI routes → AI chat API: dispatches
backend/routes/aiRoutes.js - Auth and profile → User records: reads and writes
backend/controllers/authController.js - Auth and profile → Supplier records: syncs profiles
backend/controllers/authController.js - Product catalog → Product records: queries listings
backend/controllers/productController.js - Product catalog → Supplier records: updates supplier count
backend/controllers/productController.js - Supplier profiles → Supplier records: manages profiles
backend/controllers/supplierController.js - Supplier profiles → User records: synchronizes users
backend/controllers/supplierController.js - Supplier profiles → Product records: updates listings
backend/controllers/supplierController.js - Order handling → Order records: handles orders
backend/controllers/orderController.js - AI chat API → Contextual AI: delegates inference
backend/controllers/aiController.js - AI chat API → Chat history: persists history
backend/controllers/aiController.js - Contextual AI → Product records: reads catalog
backend/services/aiService.js - Contextual AI → Supplier records: reads suppliers
backend/services/aiService.js - Contextual AI → Order records: reads purchases
backend/services/aiService.js - User records → MongoDB Atlas: persists
- Supplier records → MongoDB Atlas: persists
- Product records → MongoDB Atlas: persists
- Order records → MongoDB Atlas: persists
- Chat history → MongoDB Atlas: persists
- Contextual AI → Hugging Face LLM: requests inference