How rufnul/shopnexus works
ShopNexus is an e-commerce storefront with a Next.js frontend and an Express/MongoDB backend. The principal documented journey is browsing products and categories; account registration and login, contact messages, and email subscriptions are distinct supporting workflows. Backend route mounting and controller/model calls are visible in the excerpts and source index. The frontend-to-API wiring and several frontend page implementations were not shown, so their connections are left out.
Main entry points: server.js API server · authController.js Auth handling · productRoutes.js Product API · contactRoutes.js Contact routes
Components 24
Storefront
- Home storefront
frontend/src/app/page.js - Category browsing
frontend/src/app/shop - Product detail
frontend/src/app/product/[id]/page.js - Contact form
frontend/src/app/contact/page.js - Account pages
frontend/src/app/login/page.js - Subscription UI
frontend/src/components/Footer/Page.js
API workflows
- API server
backend/server.js - Product API
backend/routes/productRoutes.js - Product controller
backend/controllers/productController.js - Contact routes
backend/routes/contactRoutes.js - Contact handling
backend/controllers/contactController.js - Subscribe routes
backend/routes/subscribeRoutes.js - Subscribe handling
backend/controllers/subscribeController.js
Identity
- Auth routes
backend/routes/authRoutes.js - Auth handling
backend/controllers/authController.js - Token protection
backend/middleware/authMiddleware.js - JWT generation
backend/utils/generateToken.js
Persistence
- MongoDB
- DB connection
backend/config/db.js - Product model
backend/models/Product.js - Contact model
backend/models/Contact.js - Subscription model
backend/models/Subscribe.js - User model
backend/models/User.js
Other components
- Shopper
Connections 17
- Shopper → Home storefront: browses
- Shopper → Category browsing: browses categories
- API server → Product API: mounts route
backend/server.js - API server → Auth routes: mounts route
backend/server.js - API server → Contact routes: mounts route
backend/server.js - API server → Subscribe routes: mounts route
backend/server.js - Product API → Product model: queries and saves
backend/routes/productRoutes.js - Contact routes → Contact handling: routes requests
backend/routes/contactRoutes.js - Contact handling → Contact model: creates and queries
backend/controllers/contactController.js - Subscribe routes → Subscribe handling: routes requests
backend/routes/subscribeRoutes.js - Subscribe handling → Subscription model: creates and queries
backend/controllers/subscribeController.js - Auth routes → Auth handling: routes requests
backend/routes/authRoutes.js - Auth handling → User model: finds and creates
backend/controllers/authController.js - Auth handling → JWT generation: generates token
backend/controllers/authController.js - Token protection → User model: loads user
backend/middleware/authMiddleware.js - API server → DB connection: connects database
backend/server.js - DB connection → MongoDB: opens connection
backend/config/db.js