How syedthedev/mern-green-cart-app works
Green Cart is a MERN grocery-commerce application for shoppers and sellers. Shoppers browse products, manage a cart, save an address, and place COD or Stripe orders; sellers authenticate, manage products and stock, and review orders. The frontend context coordinates session, catalog, and cart state, while Express routes dispatch requests to controllers and MongoDB models. Stripe payment handling and Cloudinary image hosting are documented or visible integrations. Some feature links are dashed because their implementation was not sampled.
Main entry points: App.jsx App routing · Routes API routes · orderController.js Order and payment · productController.js Product operations
Components 25
Shopper experience
- App routing
Client/src/App.jsx - App context
Client/src/Context/AppContext.jsx - Login UI
Client/src/Components/Login.jsx - Catalog browsing
Client/src/Pages/AllProducts.jsx - Product details
Client/src/Pages/ProductDetails.jsx - Cart and checkout
Client/src/Pages/Cart.jsx - Address entry
Client/src/Pages/AddAddress.jsx - Order history
Client/src/Pages/MyOrders.jsx
Seller experience
- Seller login
Client/src/Components/Seller/SellerLogin.jsx - Product management
Client/src/Pages/Seller/AddProduct.jsx - Stock management
Client/src/Pages/Seller/ProductList.jsx - Order review
Client/src/Pages/Seller/Orders.jsx
Commerce API
- Express application
Server/Server.js - API routes
Server/Routes - Access control
Server/Middleware/userAuth.js - User accounts
Server/Controllers/userController.js - Product operations
Server/Controllers/productController.js - Order and payment
Server/Controllers/orderController.js - Address operations
Server/Controllers/addressController.js - Cart operations
Server/Controllers/cartController.js
Persistence and services
- MongoDB models
Server/Schema - Cloudinary images
Server/Helper/Cloudinary.js
Other components
- Shopper
- Seller
- Stripe checkout
Connections 38
- Shopper → App routing: uses
Client/src/App.jsx - App routing → App context: reads state
Client/src/App.jsx - App routing → Login UI: renders
Client/src/App.jsx - App routing → Catalog browsing: routes to
Client/src/App.jsx - App routing → Product details: routes to
Client/src/App.jsx - App routing → Cart and checkout: routes to
Client/src/App.jsx - App routing → Address entry: routes to
Client/src/App.jsx - App routing → Order history: routes to
Client/src/App.jsx - Product details → App context: reads products
Client/src/Pages/ProductDetails.jsx - Cart and checkout → App context: reads cart state
Client/src/Pages/Cart.jsx - Address entry → App context: uses context
Client/src/Pages/AddAddress.jsx - Seller → App routing: opens seller area
Client/src/App.jsx - App routing → Seller login: routes to
Client/src/App.jsx - App routing → Product management: routes to
Client/src/App.jsx - App routing → Stock management: routes to
Client/src/App.jsx - App routing → Order review: routes to
Client/src/App.jsx - App context → Express application: calls API
- Express application → API routes: mounts routes
Server/Server.js - API routes → User accounts: dispatches
Server/Routes/userRoute.js - API routes → Product operations: dispatches
Server/Routes/productRoute.js - API routes → Order and payment: dispatches
Server/Routes/orderRoute.js - API routes → Address operations: dispatches
Server/Routes/addressRouter.js - API routes → Cart operations: dispatches
Server/Routes/cartRoute.js - API routes → Access control: protects requests
Server/Routes/orderRoute.js - User accounts → MongoDB models: reads users
Server/Controllers/userController.js - Product operations → MongoDB models: reads products
Server/Controllers/productController.js - Order and payment → MongoDB models: reads and writes
Server/Controllers/orderController.js - Address operations → MongoDB models: uses addresses
Server/Controllers/addressController.js - Cart operations → MongoDB models: updates cart
Server/Controllers/cartController.js - Product operations → Cloudinary images: uploads images
Server/Controllers/productController.js - Express application → Cloudinary images: initializes
Server/Server.js - Order and payment → Stripe checkout: creates sessions
Server/Controllers/orderController.js - Stripe checkout → Order and payment: sends webhooks
- Product management → Product operations: manages products
- Stock management → Product operations: updates stock
- Order review → Order and payment: reviews orders
- Cart and checkout → Order and payment: places orders
- Order history → Order and payment: loads history