From storefront-next
Configures hybrid storefronts running Storefront Next alongside SFRA/SiteGenesis for gradual migration. Covers proxy setup, session bridging, and traffic routing.
How this skill is triggered — by the user, by Claude, or both
Slash command
/storefront-next:sfnext-hybrid-storefrontsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill covers running Storefront Next alongside an existing SFRA or SiteGenesis storefront — enabling gradual migration without a full rewrite.
This skill covers running Storefront Next alongside an existing SFRA or SiteGenesis storefront — enabling gradual migration without a full rewrite.
A hybrid storefront splits traffic between Storefront Next (for new or migrated pages) and an existing SFRA/SiteGenesis storefront (for pages not yet migrated). Session bridging ensures users maintain authentication and cart state across both implementations.
Customer Request
↓
CDN / eCDN (Cloudflare) ← Production: routes based on URL patterns
↓
┌─────────────────────────────┐
│ Storefront Next │ SFRA/SiteGenesis │
│ (MRT) │ (B2C Instance) │
└────────┴────────────────────┘
↕ Session Bridge (shared cookies) ↕
Production: Cloudflare eCDN handles routing between Storefront Next and SFRA based on origin rules.
Local Development: A Vite dev server plugin (hybridProxyPlugin from @salesforce/storefront-next-dev) proxies non-matching requests to your SFCC sandbox, simulating the eCDN split at localhost:5173.
Hybrid mode is configured entirely through environment variables — there is no extension directory.
These PUBLIC__ variables are bundled into the app and required in all environments:
# Enable hybrid mode — activates the client-side legacy-routes middleware
PUBLIC__app__hybrid__enabled=true
# Routes that belong to SFRA — client-side <Link> clicks to these trigger full-page loads
# Supports exact paths and React Router parameterized routes
PUBLIC__app__hybrid__legacyRoutes='["/cart", "/checkout", "/product/:id"]'
These configure the Vite dev server proxy and have no effect in production:
# Enable the proxy
HYBRID_PROXY_ENABLED=true
# Your SFCC sandbox origin
SFCC_ORIGIN=https://zzrf-001.dx.commercecloud.salesforce.com
# Routing rules: Cloudflare eCDN expression format
# Paths matching → Storefront Next; paths not matching → proxied to SFCC
HYBRID_ROUTING_RULES='(http.request.uri.path matches "^/$" or http.request.uri.path matches "^/product.*" or http.request.uri.path matches "^/category.*" or http.request.uri.path matches "^/resource.*" or http.request.uri.path matches "^/action/.*")'
# Optional: locale for SFRA path transformation (falls back to PUBLIC__app__i18n__fallbackLng)
HYBRID_PROXY_LOCALE=en-GB
The legacy-routes.client.ts middleware intercepts client-side navigation to SFRA-owned routes:
<Link to="/checkout">/checkout matches any pattern in legacyRoutesThis prevents React Router from trying to render pages that belong to SFRA.
Both storefronts share the same session cookies (dwsid, cc-*) on a common domain:
The proxy handles cookies in three layers:
Domain=.salesforce.com → Domain=localhostdocument.cookie for SFRA's JSWhen navigating from SFRA to Storefront Next:
When navigating from Storefront Next to SFRA:
dwsid cookie maintains session continuitySome patterns must always route to Storefront Next:
| Pattern | Why |
|---|---|
^/resource.* | React Router resource routes (data endpoints) |
^/action/.* | React Router actions (form submissions) |
HYBRID_ROUTING_RULES (what Storefront Next owns) and PUBLIC__app__hybrid__legacyRoutes (what SFRA owns) are complementary. Any path not in routing rules that could be a <Link> target should be in legacyRoutes.
| Issue | Cause | Solution |
|---|---|---|
| Lost session crossing storefronts | Cookie domain mismatch | Ensure shared parent domain |
| Cart items disappear | Basket not synced | Verify session bridge cookies (dwsid, cc-*) |
| Redirect loops | Conflicting routing rules | Check eCDN rules and legacyRoutes consistency |
| 404 on SFRA pages (local dev) | Missing from routing rules | Add path to HYBRID_ROUTING_RULES |
| React Router 404 on legacy route | Missing from legacyRoutes | Add path to PUBLIC__app__hybrid__legacyRoutes |
storefront-next:sfnext-authentication - SLAS token management and session cookiesstorefront-next:sfnext-deployment - MRT deployment for hybrid setupstorefront-next:sfnext-configuration - Environment configuration for hybrid modenpx claudepluginhub salesforcecommercecloud/b2c-developer-tooling --plugin storefront-nextCreates and configures Storefront Next projects for Salesforce Commerce Cloud. Covers CLI creation, project structure, environment variables, and the sfnext development workflow.
Build headless Shopify storefronts with Hydrogen: Remix SSR patterns, Oxygen deployment, Storefront API queries, caching strategies, cart, customer accounts, SEO, analytics.
Builds Next.js storefronts for Saleor with GraphQL client setup (urql/Apollo), channel routing, Tailwind CSS, server components, checkout flow, and SEO.