How soumardev/e-commerce-react works
Kamera Shop is a learning-project storefront for browsing sample camera products, managing a browser-persisted cart, and registering or logging in; purchases and newsletter signup are not implemented. The main flow is shopper → routed React pages → PHP product API → MySQL catalogue, with product detail actions updating the cart. Separate account and optional product-aware chat branches are included. Edges reflect sampled calls or README-documented relationships; unsampled endpoint details are not inferred.
Main entry points: main.jsx Page Router · products.js Product API Client · CartPage.jsx Cart Page · db.php Database Access
Components 26
Storefront
- Page Router
src/main.jsx - Home Page
src/pages/HomePage.jsx - Category Page
src/pages/CategoryPage.jsx - Product Page
src/pages/ProductPage.jsx - Not Found
src/pages/NotFound.jsx - Shop Header
src/components/Header.jsx - Category Labels
src/data/categories.js - Newsletter UI
src/components/home/Newsletter.jsx
Product Catalogue
- Product API Client
src/api/products.js - PHP Catalogue API
api/products.php - Product Endpoint
api/product.php - Category Endpoint
api/category.php - Database Access
api/db.php - Product Database
Cart
- Cart State
src/context/CartContext.jsx - Cart Page
src/pages/CartPage.jsx - Cart Item
src/components/cart/CartItem.jsx - Cart Summary
src/components/cart/CartSummary.jsx
Accounts
- Auth Provider
src/context/AuthProvider.jsx - Auth API Client
src/api/auth.js - PHP Auth Endpoints
api/login.php
Product Chat
- Chat Widget
src/components/chat/ChatWidget.jsx - Chat API Client
src/api/chat.js - Chat Endpoint
api/chat.php
Other components
- Shopper
- Anthropic Claude
Connections 38
- Shopper → Page Router: visits pages
src/main.jsx - Page Router → Home Page: routes to
src/main.jsx - Page Router → Category Page: routes to
src/main.jsx - Page Router → Product Page: routes to
src/main.jsx - Page Router → Cart Page: routes to
src/main.jsx - Page Router → Not Found: routes to
src/main.jsx - Home Page → Category Labels: labels categories
src/pages/HomePage.jsx - Category Page → Category Labels: labels categories
src/pages/CategoryPage.jsx - Home Page → Product API Client: loads products
- Category Page → Product API Client: loads category
src/pages/CategoryPage.jsx - Product Page → Product API Client: loads product
src/pages/ProductPage.jsx - Product API Client → Product Endpoint: fetches product
src/api/products.js - Product API Client → Category Endpoint: fetches category
src/api/products.js - Product API Client → PHP Catalogue API: fetches all
src/api/products.js - Product Endpoint → Database Access: queries data
- Category Endpoint → Database Access: queries data
- PHP Catalogue API → Database Access: queries data
- Database Access → Product Database: reads catalogue
- Product Page → Cart State: adds item
src/pages/ProductPage.jsx - Cart State → Cart Page: provides cart
src/pages/CartPage.jsx - Cart Page → Cart Item: renders items
src/pages/CartPage.jsx - Cart Page → Cart Summary: renders summary
src/pages/CartPage.jsx - Cart Page → Product API Client: loads product data
src/pages/CartPage.jsx - Shopper → Shop Header: uses navigation
- Shop Header → Cart State: reads cart
src/components/Header.jsx - Shop Header → Auth Provider: uses auth
- Page Router → Auth Provider: wraps routes
src/main.jsx - Auth Provider → Auth API Client: calls auth API
src/context/AuthProvider.jsx - Auth API Client → PHP Auth Endpoints: sends requests
- Shopper → Chat Widget: asks questions
- Chat Widget → Chat API Client: sends conversation
src/components/chat/ChatWidget.jsx - Chat API Client → Chat Endpoint: posts messages
- Chat Endpoint → Database Access: loads product context
api/chat.php - Chat Endpoint → Anthropic Claude: requests answer
api/chat.php - Chat Endpoint → Shopper: returns answer
- Category Page → Not Found: shows for invalid
src/pages/CategoryPage.jsx - Product Page → Not Found: shows for missing
src/pages/ProductPage.jsx - Page Router → Newsletter UI: pages render