MCPcopy Index your code
hub / github.com/SalesforceCommerceCloud/storefront-next-template

github.com/SalesforceCommerceCloud/storefront-next-template @v2026.6.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2026.6.1 ↗ · + Follow
3,977 symbols 15,457 edges 1,853 files 689 documented · 17%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Storefront Next Template

A production-ready React storefront template for Salesforce B2C Commerce, built with React Router 7 and React 19.

Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js 24+Download
  • pnpm — Install via npm install -g pnpm or see pnpm.io

Quick Start

# 1. Clone or use this template
git clone https://github.com/SalesforceCommerceCloud/storefront-next-template my-storefront
cd my-storefront

# 2. Set up environment
cp .env.default .env
# Edit .env with your B2C Commerce credentials

# 3. Install and run
pnpm install
pnpm dev

Visit http://localhost:5173 to see your storefront.

Getting Your Starting Point

Option A: Use This Template (Recommended)

Click "Use this template" button → "Create a new repository" at the top of this page.

  • ✅ Fresh repo with latest stable code
  • ✅ Clean Git history
  • ✅ Ready to customize

Option B: Clone a Specific Version

Use a tagged release for version pinning:

# View available versions
git tag -l

# Clone specific version
git clone --branch v1.0.0 --depth 1 \
  https://github.com/SalesforceCommerceCloud/storefront-next-template my-storefront

Check Releases for all versions.

Template version & SDK compatibility

This template is dated by a release stamp (e.g. "June 2026"), recorded in package.json under storefrontNext (templateRelease, templateVersion, minSdkVersion). The Storefront Next SDK (@salesforce/storefront-next-dev / -runtime) versions separately, with SemVer. See the compatibility matrix for which SDK version each template release needs.

Configuration

All settings are defined in config.server.ts and can be configured via environment variables—no code changes required.

Setup

cp .env.default .env
# Edit .env with your B2C Commerce credentials

Required Variables

PUBLIC__app__commerce__api__clientId=your-client-id
PUBLIC__app__commerce__api__organizationId=your-org-id
PUBLIC__app__commerce__api__shortCode=your-short-code

How It Works

Use the PUBLIC__ prefix with double underscores (__) to set any config path:

# Environment variable         →  Config path
PUBLIC__app__site__locale=en-GB   →  config.app.site.locale
PUBLIC__app__site__currency=EUR   →  config.app.site.currency

Values are automatically parsed (numbers, booleans, JSON arrays/objects).

See Configuration Guide for complete documentation.

Deployment

Deploy your storefront to Salesforce B2C Commerce's Managed Runtime:

pnpm build
pnpm push

See the Deployment Guide for all options and configuration.

B2C CLI

The Salesforce B2C CLI is included as a dev dependency for managing Commerce Cloud resources — environments, code deployments, cartridges, and more.

pnpm b2c --help       # See all available commands

Available Scripts

# Development
pnpm dev              # Start dev server
pnpm build            # Build for production
pnpm start            # Run production build

# Commerce Cloud
pnpm b2c              # B2C CLI (environments, deployments, cartridges)

# Testing & Quality
pnpm test             # Run tests
pnpm lint             # Lint code
pnpm typecheck        # Check TypeScript

# Storybook
pnpm storybook        # Component explorer

Project Structure

src/
├── components/       # React components
├── routes/           # Page routes (file-based routing)
├── hooks/            # Custom React hooks
├── lib/              # Utilities and helpers
└── providers/        # React context providers

Features

  • SSR — Server-side rendering with React 19
  • 🛤️ React Router 7 — File-based routing
  • 🛒 Commerce Cloud — Full SCAPI integration
  • 🎨 Tailwind CSS 4 — Utility-first styling
  • 🧪 Vitest — Fast unit testing
  • 📚 Storybook — Component development
  • 🌍 i18n — Multi-language support
  • 🔍 TypeScript — Full type safety

Documentation

Contributing

This is a mirror repository synced from the storefront-next monorepo.

To contribute: 1. Visit the monorepo 2. Submit issues or PRs there 3. Changes sync automatically to this repo

See CONTRIBUTING.md for details.

Support

License

See LICENSE for details.

Extension points exported contracts — how you extend this code

Requirement (Interface)
* Internal interface for defining password requirements
src/components/password-requirements/index.tsx
ProductContextValue (Interface)
* Simple context for sharing product data across components.
src/providers/product-context.tsx
CommerceSdkError (Interface)
* Type for Commerce SDK error objects that may have status or response properties
src/lib/utils.ts
Metrics (Interface)
* Timing markers and contextual data collected during page resolution. * * All timing fields are `performance.now()` t
src/middlewares/page-designer-page-resolution.server.ts
CheckoutPickupProps (Interface)
* Props for the CheckoutPickup component. * * @interface CheckoutPickupProps * @property {ShopperBasketsV2.schemas['B
src/extensions/bopis/components/checkout/checkout-pickup.tsx
UseCartQuantityUpdateProps (Interface)
* The constraint `{ success?: boolean }` is intentionally weak: this hook submits to two * different action routes (`re
src/hooks/use-cart-quantity-update.ts
AddToWishlistOptions (Interface)
* Add to Wishlist Flow * Reusable flow for adding a product to wishlist via PDP * * This flow encapsulates the comple
e2e/src/flows/add-to-wishlist.flow.ts
Window (Interface)
(no doc)
types/window.d.ts

Core symbols most depended-on inside this repo

get
called by 830
e2e/src/utils/credential-store.ts
action
called by 329
src/lib/checkout/actions/submit-payment.server.ts
cn
called by 274
src/lib/utils.ts
entries
called by 246
src/lib/scapi-middleware.ts
error
called by 237
src/lib/logger.ts
cleanup
called by 181
scripts/test-storybook.js
recordSiteverifyOutcome
called by 174
src/lib/turnstile/health.server.ts
validatePageLoaded
called by 136
e2e/src/pages/cart.page.ts

Shape

Function 2,763
Method 521
Interface 502
Class 188
Enum 3

Languages

TypeScript100%

Modules by API surface

e2e/src/pages/checkout.page.ts155 symbols
e2e/src/pages/account-addresses.page.ts40 symbols
e2e/src/pages/account-details.page.ts39 symbols
src/lib/decorators/page-type.test.ts34 symbols
src/lib/images/dynamic-image.ts29 symbols
src/middlewares/page-designer-page-resolution.server.ts28 symbols
src/lib/decorators/component.test.ts25 symbols
src/lib/api/customer.server.ts25 symbols
e2e/src/utils/scapi-helper.ts25 symbols
e2e/src/pages/cart.page.ts24 symbols
e2e/src/pages/product-detail.page.ts22 symbols
src/routes/_app.account._index.tsx21 symbols

For agents

$ claude mcp add storefront-next-template \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact