How hadhee17/e-commerce works
This is a full-stack e-commerce application. Shoppers browse products, inspect product details and reviews, authenticate, manage a cart, and proceed through checkout, payment, and orders; sellers manage their listings. The React client routes pages and coordinates shared authentication and cart state, while service modules call the Express API. The API routes requests to controllers, which use MongoDB models for users, products, carts, reviews, and orders. The tree and excerpts support these main stages, but several page, route, and controller internals are unsampled; their finer interactions are therefore not asserted.
Main entry points: App.jsx Page router · app.js API router · api.js HTTP client · productService.js Product requests
Components 34
Storefront client
- Page router
client/src/App.jsx - Store navigation
client/src/components/Header.jsx - Product card
client/src/components/ProductCard.jsx - Product browsing
client/src/pages/Home.jsx - Product details
client/src/pages/ProductDetail.jsx - Review section
client/src/components/ReviewSection.jsx - Sign-in and signup
client/src/pages/Login.jsx - Authentication state
client/src/context/AuthContext.jsx - Cart state
client/src/context/CartContext.jsx - Cart page
client/src/pages/Cart.jsx - Direct checkout
client/src/pages/BuyNow.jsx - Payment page
client/src/pages/Payment.jsx - Order history
client/src/pages/Orders.jsx - User profile
client/src/pages/Profile.jsx - Seller listings
client/src/pages/MyProducts.jsx - HTTP client
client/src/services/api.js - Auth requests
client/src/services/authService.js - Product requests
client/src/services/productService.js - Cart requests
client/src/services/cartService.js - Order requests
client/src/services/orderServices.js - Payment requests
client/src/services/paymentService.js - Review requests
client/src/services/reviewService.js - User requests
client/src/services/userService.js
API and access
- API router
server/app.js - User routes
server/routes/user.js - Authentication logic
server/controller/authController.js - Token middleware
server/middleware/jwt.js
Catalog and feedback
- Product routes
server/routes/product.js - Product operations
server/controller/productController.js - Review routes
server/routes/review.js - Review operations
server/controller/reviewController.js
Cart and transactions
- Cart routes
server/routes/cart.js
Other components
- Shopper
- Seller
Connections 35
- Shopper → Page router: uses storefront
- Seller → Page router: uses storefront
- Page router → Product browsing: routes to
client/src/App.jsx - Page router → Product details: routes to
client/src/App.jsx - Page router → Sign-in and signup: routes to
client/src/App.jsx - Page router → Cart page: routes to
client/src/App.jsx - Page router → Direct checkout: routes to
client/src/App.jsx - Page router → Payment page: routes to
client/src/App.jsx - Page router → Order history: routes to
client/src/App.jsx - Page router → User profile: routes to
client/src/App.jsx - Page router → Seller listings: routes to
client/src/App.jsx - Page router → Authentication state: provides state
client/src/App.jsx - Page router → Cart state: provides state
client/src/App.jsx - Product details → Review section: renders
- Review section → Review requests: requests reviews
client/src/services/reviewService.js - Authentication state → Auth requests: calls
client/src/context/AuthContext.jsx - Cart state → Cart requests: calls
client/src/context/CartContext.jsx - Product browsing → Product requests: fetches products
- Product details → Product requests: fetches product
- Seller listings → Product requests: manages listings
client/src/pages/MyProducts.jsx - Direct checkout → Order requests: submits order
client/src/pages/BuyNow.jsx - Direct checkout → Payment requests: requests payment
client/src/pages/BuyNow.jsx - HTTP client → API router: sends requests
- Auth requests → HTTP client: uses
client/src/services/authService.js - Product requests → HTTP client: uses
client/src/services/productService.js - Cart requests → HTTP client: uses
client/src/services/cartService.js - Review requests → HTTP client: uses
client/src/services/reviewService.js - API router → User routes: mounts
server/app.js - API router → Product routes: mounts
server/app.js - API router → Review routes: mounts
server/app.js - API router → Cart routes: mounts
server/app.js - User routes → Authentication logic: dispatches
server/routes/user.js - Review routes → Review operations: dispatches
server/routes/review.js - Product routes → Product operations: dispatches
server/routes/product.js - Authentication logic → Token middleware: creates tokens
server/controller/authController.js