GitHunt
KA

KareemHossny/The-Kreg-Market

Full-stack grocery e-commerce application with JWT authentication, cart management, Stripe checkout, admin product control, and cloud-hosted image storage.

The Kreg Market โ€“ FullStack Grocery E-commerce

React
Express
MongoDB
Vercel
Stripe
Production

The Kreg Market is a production-ready full-stack grocery e-commerce app with customer shopping flows and backend admin controls.
It supports product browsing, JWT authentication, cart management, order placement (COD and Stripe), and order tracking.


๐Ÿš€ Live Demo

Fully functional: Users can shop groceries, manage carts, checkout online or COD, while admin manages products and orders.


๐Ÿง  Architecture

User
  โ†“
Frontend (React CRA + Tailwind + ShopContext + Axios)
  โ†“
Backend (Node.js + Express + MongoDB)
  โ†“
Stripe Payment API
  • Frontend: React 19 (CRA), Tailwind, react-router-dom, Axios, React Toastify, Swiper, React Icons
  • Backend: Node.js, Express 5, MongoDB (Mongoose), JWT Auth, bcrypt, Multer, Cloudinary
  • Deployment: Vercel (Frontend + Backend), Stripe (Checkout), Cloudinary (images)

โœจ Features (Fully Working)

๐Ÿ›’ Storefront

  • Product listing and detail pages
  • Category browsing, client-side search with debounce

๐Ÿ› Cart

  • Add/update/remove items, clear cart
  • Cart totals synced from backend
  • LocalStorage persistence

๐Ÿ’ณ Checkout & Orders

  • Place orders with Cash on Delivery or Stripe
  • View user order history

๐Ÿ‘จโ€๐Ÿ’ป Admin Dashboard

  • Add/update/remove products with image uploads
  • Update stock availability
  • View and manage all orders, update order status

๐Ÿ” Authentication & Security

  • JWT Bearer tokens, Authorization headers
  • Passwords hashed with bcrypt
  • Protected routes: user/cart/orders & admin endpoints
  • CORS allowlist via FRONTEND_URL
  • Image upload validations + Cloudinary storage

๐Ÿ“ก API Documentation

User

Endpoint Description
POST /user/register Register a new user
POST /user/login Login user
POST /user/admin Admin login

Product

Endpoint Description
GET /product/all Get all products
GET /product/:id Get single product
POST /product/add Add product (admin)
DELETE /product/remove/:id Remove product (admin)
PUT /product/stock/:id Update stock status (admin)

Cart (auth required)

Endpoint Description
POST /cart/add Add product to cart
PUT /cart/update Update cart item quantity
POST /cart/get Get user cart with totals
DELETE /cart/remove/:id Remove item
DELETE /cart/clear Clear cart

Order

Endpoint Description
POST /order/placeOrder Place COD order
POST /order/stripe Create Stripe checkout session
GET /order/userOrders Get user orders
GET /order/adminOrders Get all orders (admin)
PUT /order/status Update order status (admin)

โš™๏ธ Installation & Setup

1๏ธโƒฃ Clone Repository

git clone https://github.com/KareemHossny/The-Kreg-Market

2๏ธโƒฃ Backend Setup

cd back
npm install

.env

JWT_SECRET=
ADMIN_EMAIL=
ADMIN_PASSWORD=
MONGO_URI=
CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=
STRIPE_SECRET_KEY=
PORT=7777
NODE_ENV=development
FRONTEND_URL=http://localhost:3000
npm start

3๏ธโƒฃ Frontend Setup

cd ../front
npm install
npm start

4๏ธโƒฃ Production Build

cd front
npm run build
cd ../back
npm start

๐Ÿ“ˆ Performance Optimizations

  • Debounced search filtering
  • Cart persistence in localStorage
  • Cloudinary image compression/transformations
  • Product list sorting at query level

๐Ÿงช Future Improvements

  • Env-based API URLs for frontend
  • Automated tests (unit/integration/e2e)
  • Pagination, filtering, and sorting for large catalogs
  • Refresh-token/session strategy
  • Stripe webhook-based payment confirmation

๐Ÿ‘จโ€๐Ÿ’ป Author

Kareem Hossny โ€“ Full Stack MERN Developer
Open to freelance & junior full-stack opportunities