/storefront-next:sfnext-project-setupfrom storefront-next
Creates and bootstraps a Storefront Next project, explaining layout, npm scripts, and first-run workflow. Covers CLI flags, Business Manager vs CLI setup, and common issues like pnpm install failures.
Ships in storefront-next. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A Storefront Next project is a server-rendered React 19 / React Router 7 / Vite / Tailwind v4 app that runs on Managed Runtime (MRT). All SCAPI calls run server-side. You own the project code after it is created.
Read the project's own AGENTS.md first. It ships in every project (CLAUDE.md is a copy) and is the authority for data-loading, Suspense, state, image, and navigation rules. This skill never overrides it. Detailed guides live in the project's docs/README-*.md.
package.json engines; MRT also runs Node 24)| Path | Use when |
|---|---|
| Business Manager Storefront Setup (GitHub or local-code workflow) | You want an instance-connected storefront. It creates the SLAS client, the MRT project/environments, initial config, and a first deployment. Reuse those resources; do not create replacement SLAS clients or MRT projects as routine setup. Use the downloaded env.txt as .env. Guides: GitHub workflow, local-code workflow |
sfnext create-storefront | You want a fresh local project from a starter theme, with your own extension selection and credentials |
| Clone / "Use this template" of a published starter repo | You prefer plain git; the project README lists the starter repositories |
Never invent tenant/site IDs and never echo secrets from env.txt.
# Interactive: pick a starter theme, name, extensions, and credentials
pnpm dlx @salesforce/storefront-next-dev create-storefront
# or, with the b2c CLI (auto-installs the sfnext plugin on first use)
b2c sfnext create-storefront
# Non-interactive
sfnext create-storefront -n my-storefront --vertical cosmetic -o ./projects
sfnext create-storefront -n my-storefront --defaults
| Flag | Meaning |
|---|---|
-n, --name | Project name |
-V, --vertical | Starter theme: fashion (default with --defaults), cosmetic, foundations, footwear, furniture, luxury |
-t, --template | Template repo URL or local path (overrides --vertical) |
-b, --template-branch | Branch or tag to clone |
-d, --defaults | Accept all defaults, no prompts (CI) |
-o, --output-dir | Where to create the project |
What it does: shallow-clones the chosen starter, removes .git, asks which extensions to keep (and trims the rest; manage them later with sfnext extensions ..., see storefront-next:sfnext-extensions), prompts for the values in config-meta.json (SLAS client ID, organization ID, short code), and writes .env from .env.default.
Then:
cd my-storefront
pnpm install
pnpm dev # http://localhost:5173
.env.default ships with a public demo backend so cp .env.default .env && pnpm dev boots. Only .env is read; .env.default is never loaded. Replace the three required values with your own before pointing at real data:
PUBLIC__app__commerce__api__clientId=...
PUBLIC__app__commerce__api__organizationId=...
PUBLIC__app__commerce__api__shortCode=...
Restart the dev server after editing .env. Dev fails fast if the short code is missing. Everything else has defaults in config.server.ts; see storefront-next:sfnext-configuration. If the project should target your own site, also set PUBLIC__app__defaultSiteId and PUBLIC__app__commerce__sites (JSON array) as described there.
Before shipping, run through the pre-launch gate in storefront-next:sfnext-deployment (demo analytics IDs, staging image host, demo credentials).
my-storefront/
├── AGENTS.md / CLAUDE.md # Rules for coding agents -- read first
├── config.server.ts # All app config defaults (metadata / runtime / app)
├── config-meta.json # Values create-storefront prompts for
├── .env.default, .env # Required credentials; only .env is loaded
├── package.json # Scripts + storefrontNext version stamp
├── react-router.config.ts, vite.config.ts, vite-plugins/
├── src/
│ ├── routes/ # Flat file routes (_app.*, _checkout.*, _empty.*, action.*, resource.*)
│ ├── components/ (ui/ = primitives), hooks/, providers/, lib/, middlewares/
│ ├── extensions/ # Optional feature modules + config.json registry
│ ├── theme/ # index.css entry, tokens/, overrides/
│ ├── locales/ # <lang-REGION>/translations.json
│ ├── scapi/ # Generated + custom SCAPI clients
│ ├── targets/ # UI target (extension point) system
│ └── types/config.ts # AppConfig type
├── cartridges/app_storefrontnext_base # Page Designer metadata cartridge
├── docs/ # README-*.md guides, COMPATIBILITY.md, migrations/
├── instructions/ # Extension install/uninstall guides (.mdc)
├── e2e/ # Playwright suite (own package)
└── public/
See PROJECT-STRUCTURE.md for route families, key files, and where to go for each concern.
Run pnpm <script>. The most used: dev, build, start (preview the production build on :3000), typecheck, lint, test, push, cartridge:generate|validate|deploy, config:inspect, config:push-env, bundlesize, storybook. Full table in SCRIPTS.md. The project's package.json scripts is the source of truth; grep it instead of guessing.
The sfnext binary (from @salesforce/storefront-next-dev, already a project dependency) is also reachable as pnpm sfnext <cmd> or b2c sfnext <cmd> (the b2c CLI prefers the project-local copy when run inside the project). Command reference: SFNEXT-CLI.md. The template also exposes pnpm b2c for the b2c CLI.
node scripts/check-typescript-only.js flags stray .js). Linting is OxLint (pnpm lint, zero warnings), formatting is Biome (pnpm format).@/ alias to src/. Server-only modules are suffixed .server.ts.Link/NavLink from @/components/link and useNavigate from @/hooks/use-navigate, not the React Router originals.loader/action only; no clientLoader/clientAction. Await only critical data; return non-critical data as promises (storefront-next:sfnext-data-fetching).package.json#storefrontNext and docs/COMPATIBILITY.md.| Symptom | Cause / fix |
|---|---|
pnpm install fails or engine warning | Node < 24 or pnpm < 10.28; upgrade both |
| Dev server exits immediately about short code | PUBLIC__app__commerce__api__shortCode missing in .env (not .env.default) |
| SCAPI 401/403 | Client ID / organization ID / short code do not match the same org, or the SLAS client lacks scopes; run sfnext setup-base-cartridge --slas-client-id <id> only if the base cartridge scopes are the issue |
.env change ignored | Restart pnpm dev; check with pnpm config:inspect |
Unknown sfnext command via b2c | First use installs the plugin; run inside the project so the local copy is used |
AGENTS.md doc index and docs/README-*.mdb2c docs search "<topic>" --category sfnext (or MCP docs_search) for the published Storefront Next guidesstorefront-next:sfnext-overview - Architecture and concept tourstorefront-next:sfnext-configuration - config.server.ts, PUBLIC__ env vars, multi-site URLsstorefront-next:sfnext-deployment - Build, push to MRT, cartridge deploy, pre-launch gatestorefront-next:sfnext-routing - File routes and site-aware linksstorefront-next:sfnext-extensions - Install, remove, and create extensionsstorefront-next:sfnext-theming - Rebranding src/theme/b2c-cli:b2c-mrt - Generic MRT project/environment managementWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub salesforcecommercecloud/b2c-developer-tooling --plugin storefront-next25 skills in this plugin
/sfnext-accessibilityBuild and fix accessible UI in a Storefront Next storefront (WCAG 2.1 AA): jsx-a11y lint findings, missing accessible names and labels, form error association, dialog focus management, aria-live status messages, keyboard behavior, color contrast, and verifying fixes with Storybook a11y/play() tests and the e2e axe scan with its baseline. Use for "accessibility", "a11y", "WCAG", "screen reader", "aria-label", "focus trap", "axe violation", pnpm lint:a11y, pnpm a11y, a11y-baseline.json, skip-a11y, STORYBOOK_A11Y_TEST_MODE, or an accessibility audit finding to fix. Do not use for general lint/typecheck gates (use `storefront-next:sfnext-quality-gates`), writing non-accessibility tests (use `storefront-next:sfnext-testing`), or color/token design (use `storefront-next:sfnext-theming`)./sfnext-analytics-consentStorefront Next analytics: engagement adapters (Einstein, Active Data, Data 360), adding a custom adapter, tracking consent gating, PageViewTracker, useAnalytics events, and first-touch attribution (dw_attribution). Use when configuring engagement.adapters in config.server.ts, writing an adapter with hasConsent, registering it in initializeEngagementAdapters, wiring the consent banner (trackingConsent, consentCategories, dw_dnt), firing trackViewProduct/trackCartItemAdd events, debugging why no analytics events are sent, or passing campaign attribution to orders. Do not use for general config loading or env vars (use `storefront-next:sfnext-configuration`), CSP/script allowlisting of third-party tags (use `storefront-next:sfnext-security`), or SEO meta/JSON-LD (use `storefront-next:sfnext-seo`)./sfnext-authenticationWork with Storefront Next's server-only authentication and session architecture (SLAS guest/registered tokens, httpOnly cookies, auth.server.ts middleware). Use for getAuth, useAuth, updateAuth, destroyAuth, protecting account routes, login/logout actions, guest-to-registered basket/wishlist merge, "session expired" redirects, 401 recovery loops, cc-at/cc-nx/usid/dwsid cookies, cookie names or expiry, passwordless login, social login, OTP email verification, passkeys, guest order lookup, or refresh-token lifetime settings. Do not use for Turnstile, CSP headers or cookie-domain config (use `storefront-next:sfnext-security`), calling SCAPI clients (use `storefront-next:sfnext-scapi`), or sharing sessions with SFRA (use `storefront-next:sfnext-hybrid-storefronts`)./sfnext-commerce-featuresCatalogue and router for optional Storefront Next commerce features: Shopper Context (qualifiers, source codes), Order Management returns/cancel/tracking (SOM/OMS), delivery estimates, feature stubs (@feature-stub), guest order lookup, the app_storefrontnext_base email cartridge, and the shipped extensions (bnpl, bopis, multiship, store-locator, ratings-reviews, customer-preferences, product-content, shipping-delivery, theme-switcher). For each: which flag, SLAS scope, Business Manager setting, cartridge, or extension registry entry it needs, and which in-project doc to read. Use when asked how to enable a feature, why a feature does not render, what prerequisites a feature has, or which stubs are mock data. Do not use for building a new extension (use `storefront-next:sfnext-extensions`), config loading (use `storefront-next:sfnext-configuration`), or SLAS login flows (use `storefront-next:sfnext-authentication`)./sfnext-componentsBuild and modify UI components in a Storefront Next storefront: page components with Suspense and use()/Await, createPage and withSuspense, Tailwind v4 token classes, shape tokens (rounded-ui, shadow-ui, border-ui), shadcn/ui primitives in src/components/ui (sync-shadcn), CVA variants, data-slot, DynamicImage, lazy-loaded overlays, and Storybook stories with snapshot tests. Use when creating or editing a component in src/components, adding a shadcn primitive, fixing styling that ignores the theme, writing a *.stories.tsx file, or running pnpm storybook:test. Do not use for re-branding colors, fonts, or logos (use `storefront-next:sfnext-theming`), route loaders (use `storefront-next:sfnext-data-fetching`), or Page Designer registration (use `storefront-next:sfnext-page-designer`)./sfnext-configurationConfigure a Storefront Next app: config.server.ts (defineConfig, metadata/runtime/app), AppConfig types in src/types/config.ts, PUBLIC__ environment variable overrides, getConfig(context) / useConfig(), extension config (app.extension, app.serverExtension), protected paths, server-only secrets, and multi-site settings (commerce.sites, url.prefix, seoRoutes, siteAliasMap, cookie domain). Use when editing config.server.ts, adding a config value, an env var is ignored or "not applied", `pnpm config:inspect` / `config:push-env`, "Ignoring environment variable" warnings, protected config path errors, setting up a second site or locale URLs, or going through the pre-launch config checklist. Do not use for creating a project or the npm script list (use `storefront-next:sfnext-project-setup`), pushing bundles or MRT env management (use `storefront-next:sfnext-deployment` / `b2c-cli:b2c-mrt`), or hybrid proxy and cookie-sharing with SFRA (use `storefront-next:sfnext-hybrid-storefronts`).Other plugins' skills for the same job