How monireach2480/e-commerce works
This is a MERN online store. Shoppers browse products, manage a persistent cart, apply coupons, and complete Stripe checkout; admins manage products and inspect sales analytics. React pages and Zustand stores call the Express API, whose controllers coordinate models and external services. The graph preserves documented admin, media, coupon, and analytics capabilities; route/controller internals and some frontend pages were not sampled, so those links are limited to evidence from the tree and README.
Main entry points: server.js Express server · payment.controller.js Checkout and orders · db.js MongoDB · product.controller.js Product management
Components 29
Storefront
- React app
frontend/src/App.jsx - Store pages
frontend/src/pages - User store
frontend/src/stores/useUserStore.js - Cart store
frontend/src/stores/useCartStore.js - Product store
frontend/src/stores/useProductStore.js - API client
frontend/src/lib/axios.js
API layer
- Express server
backend/server.js - Auth routes
backend/routes/auth.route.js - Product routes
backend/routes/product.route.js - Cart routes
backend/routes/cart.route.js - Coupon routes
backend/routes/coupon.route.js - Payment routes
backend/routes/payment.route.js - Analytics routes
backend/routes/analytics.route.js
Commerce domain
- Authentication
backend/controllers/auth.controller.js - Product management
backend/controllers/product.controller.js - Cart operations
backend/controllers/cart.controller.js - Coupon handling
backend/controllers/coupon.controller.js - Checkout and orders
backend/controllers/payment.controller.js - Sales analytics
backend/controllers/analytics.controller.js - User model
backend/models/user.model.js - Product model
backend/models/product.model.js - Coupon model
backend/models/coupon.model.js - Order model
backend/models/order.model.js
State and services
- MongoDB
backend/lib/db.js - Redis
backend/lib/redis.js - Stripe
backend/lib/stripe.js - Cloudinary
backend/lib/cloudinary.js
Other components
- Shopper
- Store admin
Connections 40
- Shopper → React app: uses
- Store admin → React app: uses
- React app → User store: checks session
- React app → Cart store: loads cart
- Store pages → Product store: requests products
- Store pages → Cart store: manages cart
- Store pages → User store: authenticates
- User store → API client: sends requests
- Cart store → API client: sends requests
- Product store → API client: sends requests
- API client → Express server: HTTP API
- Express server → Auth routes: mounts
- Express server → Product routes: mounts
- Express server → Cart routes: mounts
- Express server → Coupon routes: mounts
- Express server → Payment routes: mounts
- Express server → Analytics routes: mounts
- Auth routes → Authentication: dispatches
- Product routes → Product management: dispatches
- Cart routes → Cart operations: dispatches
- Coupon routes → Coupon handling: dispatches
- Payment routes → Checkout and orders: dispatches
- Analytics routes → Sales analytics: dispatches
- Authentication → User model: reads and writes
- Authentication → Redis: stores refresh tokens
- Cart operations → User model: updates cart
- Cart operations → Product model: loads cart products
- Product management → Product model: reads and writes
- Product management → Redis: caches featured items
- Product management → Cloudinary: uploads media
- Coupon handling → Coupon model: reads and updates
- Checkout and orders → Coupon model: reads and updates
- Checkout and orders → Order model: creates orders
- Checkout and orders → Stripe: creates sessions
- Checkout and orders → Stripe: retrieves sessions
- Sales analytics → MongoDB: queries sales data
- User model → MongoDB: persists users
- Product model → MongoDB: persists products
- Coupon model → MongoDB: persists coupons
- Order model → MongoDB: persists orders