Skip to content

tanvirTheDev/EcommerceHut

Repository files navigation

Sibling Basket · EcommerceHut

A production-style storefront built with Next.js 15 (App Router), React 19, TypeScript, Sanity as the headless CMS, Clerk for authentication, and bKash + cash on delivery for checkout—with an admin flow to verify manual payments.

Live demo: ecommerce-hut-rouge.vercel.app


Design & UX

  • Storefront: Clean, responsive layout—sticky header with search, basket badge, and sign-in; hero carousel with category CTAs; product grid with category filter and stock hints.
  • Product pages: Sanity-driven imagery and rich text descriptions; add/remove quantity in the basket from the grid.
  • Basket & checkout: Signed-in users can place orders; bKash flow collects transaction details for manual verification; orders surface in My Orders after checkout.
  • Content: Products, categories, and orders live in Sanity; optional draft mode and live preview for editors.

Screenshots

Area Preview
Home Home page
Basket Basket
Orders Orders
Sanity Studio Sanity Studio

Workflow (high level)

  1. Browse — Home, shop, categories, search, and product detail pages load data from Sanity.
  2. Basket — Client state is stored with Zustand (persist) so the cart survives refresh; safe on the server where localStorage is unavailable or misconfigured.
  3. AuthClerk protects routes that need a user (e.g. checkout, orders); middleware aligns with Clerk’s matchers.
  4. Checkout — Server actions create an order document in Sanity. COD completes in one step; bKash redirects to instructions and collects trx / sender info via API routes.
  5. Verification — Admins review submissions (e.g. /admin/payments + API) and update order payment status in Sanity.
  6. Content — Editors use Sanity Studio at /studio for products, categories, and schema-defined content.

Tech stack

Layer Choice
Framework Next.js 15, App Router, Turbopack (npm run dev)
UI Tailwind CSS v4, Radix UI, lucide-react, Framer Motion
CMS Sanity (next-sanity, embedded Studio)
Auth Clerk (@clerk/nextjs)
Client state Zustand + persist (basket)
Payments bKash (manual verify) + cash on delivery

Project structure (abbreviated)

EcommerceHut/
├── actions/                 # Server actions (e.g. create order / bKash flow)
├── public/
│   └── screenshort/         # README / marketing screenshots
├── src/
│   ├── app/
│   │   ├── (store)/         # Store routes: /, /shop, /basket, /orders, …
│   │   ├── api/             # REST handlers (orders, payment verify, admin)
│   │   └── studio/          # Sanity Studio
│   ├── components/          # Header, Hero, ProductGrid, UI primitives
│   ├── sanity/              # Client, queries, schemas, live fetch
│   ├── store/               # Zustand basket store
│   └── instrumentation.ts   # Dev-safe fix for broken Node `localStorage` (optional tooling)
├── sanity.config.ts
└── package.json

Main routes

Route Purpose
/ Home + featured products
/shop, /categories, /categories/[slug] Browse by category
/product/[slug] Product detail
/search Search
/basket Cart & checkout
/bkash-payment, /success Post-checkout flows
/orders Authenticated order history
/admin/payments Payment review (admin)
/studio Sanity Studio

API routes under src/app/api/ support order fetch, payment verification, and admin payment updates.


Environment variables

Create .env.local (see also SETUP_INSTRUCTIONS.md for bKash/Sanity details). Typical keys:

  • Sanity: NEXT_PUBLIC_SANITY_PROJECT_ID, NEXT_PUBLIC_SANITY_DATASET, SANITY_API_TOKEN (editor/write), SANITY_API_READ_TOKEN (live/preview where used), NEXT_PUBLIC_SANITY_API_VERSION
  • App URL: NEXT_PUBLIC_BASE_URL, VERCEL_URL (deployment)
  • Clerk: NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY, CLERK_SECRET_KEY
  • bKash (display): NEXT_PUBLIC_BKASH_NUMBER, NEXT_PUBLIC_BKASH_MERCHANT_NAME

Never commit secrets; keep .env.local gitignored.


Scripts

npm install
npm run dev      # Next dev (Turbopack)
npm run build    # Production build
npm run start    # Production server
npm run lint
npm run typegen  # Sanity schema extract + typegen (when you change schemas)

Deployment

Configured for Vercel: connect the repo, set environment variables, and deploy. The live site above reflects the current production build.


Author

Tanvir AhamedLinkedIn


License

Private project unless otherwise specified.

About

Modern eCommerce Website built with Next.js, TypeScript, Sanity CMS, and Stripe

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors