How bhavya-192007/smartpages-e-commerce-online-bookstore works
SmartPages is a React/Express/MySQL bookstore. Customers discover books, manage a persistent cart, check out, and review orders; administrators manage catalog, inventory, categories, analytics, and fulfillment. The graph separates browser experience, API boundary, server business logic, and persistence. Sampled code confirms several client and server calls; README capabilities fill in unsampled domain stages, so those links are documented rather than inferred from naming alone.
Main entry points: api.js API Client · db.js MySQL Pool · controllers Request Controllers · CartContext.jsx Cart State
Components 30
Customer and Admin UI
- App and Routes
client/src/App.jsx - Sign-in and Profile
client/src/pages/Auth - Auth Session
client/src/context/AuthContext.jsx - Catalog and Details
client/src/pages/Catalog/Catalog.jsx - Book Details
client/src/pages/BookDetails/BookDetails.jsx - Book Card
client/src/components/books/BookCard.jsx - Cart State
client/src/context/CartContext.jsx - Cart
client/src/pages/Cart/Cart.jsx - Checkout
client/src/pages/Checkout/Checkout.jsx - Order Views
client/src/pages/Orders - Admin Dashboard
client/src/pages/Admin/AdminDashboard.jsx
Browser API Access
- API Client
client/src/services/api.js - Book Service
client/src/services/bookService.js - Cart Service
client/src/services/cartService.js - Order Service
client/src/services/orderService.js - Admin Service
client/src/services/adminService.js
Express API and Domain
- Express App
server/src/app.js - API Routes
server/src/routes - Request Controllers
server/src/controllers - Authentication
server/src/services/authService.js - Catalog and Categories
server/src/services/catalogService.js - Cart Operations
server/src/services/cartService.js - Order Transactions
server/src/services/orderService.js - Mock Payment
server/src/services/payment/mockPaymentGateway.js - Admin Operations
server/src/services/adminService.js - JWT and Role Guards
server/src/middleware/auth.js - Request Validation
server/src/middleware/validate.js
Relational Persistence
- MySQL Pool
server/src/config/db.js
Other components
- Customer
- Administrator
Connections 37
- Customer → App and Routes: uses
README.md - Administrator → App and Routes: uses
README.md - App and Routes → Auth Session: provides session
client/src/App.jsx - App and Routes → Cart State: provides cart
client/src/App.jsx - Sign-in and Profile → Auth Session: uses
client/src/pages/Auth/Register.jsx - Catalog and Details → Book Service: fetches catalog
client/src/pages/Catalog/Catalog.jsx - Catalog and Details → Book Card: renders
client/src/pages/Catalog/Catalog.jsx - Book Details → Book Service: fetches book
client/src/pages/BookDetails/BookDetails.jsx - Book Details → Cart State: adds to cart
client/src/pages/BookDetails/BookDetails.jsx - Cart → Cart State: uses cart
client/src/pages/Cart/Cart.jsx - Checkout → Cart State: reads cart
client/src/pages/Checkout/Checkout.jsx - Checkout → Order Service: places order
client/src/pages/Checkout/Checkout.jsx - Order Views → Order Service: loads orders
client/src/pages/Orders/OrderConfirmation.jsx - Admin Dashboard → Admin Service: requests admin data
client/src/pages/Admin/AdminDashboard.jsx - Admin Dashboard → Book Service: requests books
client/src/pages/Admin/AdminDashboard.jsx - Auth Session → API Client: sends auth requests
client/src/context/AuthContext.jsx - Cart State → Cart Service: manages cart
client/src/context/CartContext.jsx - Book Service → API Client: calls
client/src/services/bookService.js - Cart Service → API Client: calls
client/src/services/cartService.js - Order Service → API Client: calls
client/src/services/orderService.js - Admin Service → API Client: calls
client/src/services/adminService.js - API Client → Express App: sends REST requests
README.md - Express App → API Routes: mounts routes
server/src/app.js - API Routes → Request Controllers: dispatches
server/src/routes/adminRoutes.js - API Routes → JWT and Role Guards: guards requests
server/src/routes/adminRoutes.js - API Routes → Request Validation: validates requests
server/src/routes/authRoutes.js - Request Controllers → Authentication: delegates auth
server/src/controllers/authController.js - Request Controllers → Cart Operations: delegates cart
server/src/controllers/cartController.js - Request Controllers → Order Transactions: delegates orders
server/src/controllers/orderController.js - Request Controllers → Admin Operations: delegates admin
server/src/controllers/adminController.js - Authentication → MySQL Pool: queries users
server/src/services/authService.js - JWT and Role Guards → MySQL Pool: checks users
server/src/middleware/auth.js - Cart Operations → MySQL Pool: reads and writes
server/src/services/cartService.js - Order Transactions → MySQL Pool: transacts orders
README.md - Admin Operations → MySQL Pool: queries and updates
server/src/services/adminService.js - Order Transactions → Mock Payment: processes payment
server/src/services/orderService.js - Catalog and Categories → MySQL Pool: queries catalog