Greencart
MERN Grocery Store with Stripe Payments
A full stack grocery store where buyers browse products, check out with Stripe or cash on delivery, and sellers manage the product catalog, with webhook-verified payment status.
Project overview
Greencart is a two-role marketplace, buyers browse products, manage a cart, and check out through either Stripe or cash on delivery, while sellers add products and upload images through Cloudinary. Payment status isn't just set optimistically on the client, a Stripe webhook independently confirms checkout completion and updates the order, so a dropped connection after payment doesn't leave an order stuck in the wrong state.
Cart to checkout, with two payment paths
Buyers add and remove items from their cart, then check out with either cash on delivery or a secure Stripe checkout session. Both paths lead to a real order record, and past orders are viewable from the buyer's own order history.

Webhook-verified payment status
Rather than trusting the frontend's redirect back from Stripe alone, a webhook listens for checkout.session.completed and updates the order's payment status from the server side, so payment confirmation doesn't depend on the buyer's browser staying open.

Seller side product management
Sellers add new products and upload product images directly to Cloudinary, keeping the storefront's catalog independent from any single admin having to manage every listing.

Key features
JWT authentication with password reset
Standard email and password login, plus a password reset flow.
Cart and checkout
Add and remove products from a cart, then check out with cash on delivery or Stripe.
Star ratings and reviews
Buyers can leave a star rating and a written message on products.
Order history
Past orders are viewable from the buyer's own account.
Seller product uploads
Sellers add products with images uploaded through Cloudinary.
Stripe webhook verification
checkout.session.completed is handled server side to confirm payment independent of the client redirect.
2
User roles
2
Payment methods
1
Webhook events handled
Architecture & diagrams
Buyers and sellers share one Express API, split into auth, product, order, review, and payment modules, with MongoDB Atlas, Cloudinary, and Stripe handling data, images, and payments respectively.
Best practices
Authentication & security
- Password hashing before storage
- JWT authentication for protected routes
- Secure Stripe webhook signature verification
- CORS configuration and environment variable protection
- Security headers applied across the API
Payments
- Stripe Checkout in test mode for the primary online payment path
- Cash on delivery as a fallback payment method
- Order payment status updated server side through a verified webhook, not client redirect alone
Seller tools
- Sellers add products directly without needing admin approval
- Product images uploaded to Cloudinary rather than stored on the server