From storefront-next
Creates and configures Storefront Next projects for Salesforce Commerce Cloud. Covers CLI creation, project structure, environment variables, and the sfnext development workflow.
How this skill is triggered — by the user, by Claude, or both
Slash command
/storefront-next:sfnext-project-setupThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill guides you through creating and configuring a Storefront Next project — a server-rendered SPA built on React 19, React Router 7, Vite, and Tailwind CSS v4.
This skill guides you through creating and configuring a Storefront Next project — a server-rendered SPA built on React 19, React Router 7, Vite, and Tailwind CSS v4.
Storefront Next storefronts run on Managed Runtime (MRT) with all SCAPI requests executing server-side. Projects are created with create-storefront from @salesforce/storefront-next-dev and use TypeScript exclusively (.ts/.tsx files only — .js/.jsx/.mjs/.cjs are forbidden).
# Create a new storefront project (interactive)
pnpm dlx @salesforce/storefront-next-dev create-storefront
# Or create with a name flag
pnpm dlx @salesforce/storefront-next-dev create-storefront --name my-storefront
# Navigate into the project
cd my-storefront
# Install dependencies
pnpm install
# Start development server
pnpm dev
Projects can also be created from Business Manager, which sets up the storefront with Commerce Cloud credentials pre-configured.
my-storefront/
├── .env.default # Default environment variables (template)
├── .env # Local overrides (git-ignored)
├── config.server.ts # Centralized configuration with defaults
├── vite.config.ts # Vite build configuration
├── package.json # Dependencies and scripts
├── src/
│ ├── app.css # Global styles and Tailwind theme
│ ├── root.tsx # Root layout component
│ ├── routes/ # File-based routes (React Router 7)
│ │ ├── _app.tsx # App layout (authenticated shell)
│ │ ├── _app._index.tsx # Home page
│ │ └── _app.product.$productId.tsx
│ ├── components/ # Reusable UI components
│ │ ├── ui/ # shadcn/ui base components (customizable)
│ │ └── ... # Custom components
│ ├── config/ # Configuration schema and context
│ │ └── schema.ts # Config type definitions
│ ├── lib/ # Utilities and API client setup
│ │ ├── api-clients.ts # createApiClients() factory
│ │ ├── utils.ts # cn() utility and helpers
│ │ └── registry.ts # Page Designer component registry
│ ├── locales/ # Translation files
│ │ └── en-US/
│ │ └── translations.json
│ ├── middlewares/ # Server middleware
│ │ ├── auth.server.ts # Authentication middleware
│ │ └── basket.server.ts # Basket middleware
│ ├── providers/ # React context providers
│ ├── hooks/ # Custom React hooks
│ ├── extensions/ # Extension modules
│ └── test-utils/ # Shared test utilities
├── public/ # Static assets
└── cartridges/ # Page Designer cartridge metadata
See Project Structure Reference for detailed directory explanations.
Copy .env.default to .env and configure required Commerce Cloud credentials:
cp .env.default .env
PUBLIC__app__commerce__api__clientId=your-client-id
PUBLIC__app__commerce__api__organizationId=your-org-id
PUBLIC__app__commerce__api__siteId=your-site-id
PUBLIC__app__commerce__api__shortCode=your-short-code
PUBLIC__app__defaultSiteId=your-site-id
PUBLIC__app__commerce__sites='[{"id":"your-site-id","defaultLocale":"en-US","defaultCurrency":"USD","supportedLocales":[{"id":"en-US","preferredCurrency":"USD"}],"supportedCurrencies":["USD"]}]'
See Environment Variables Reference for the complete variable list and naming rules.
# Start development server with hot reload
pnpm dev
# Build for production
pnpm build
# Run tests
pnpm test
# Run Storybook
pnpm storybook
# Check bundle size
pnpm bundlesize:test
.ts and .tsx files; JavaScript files are blocked by ESLintloader functions; never use client loadersasync/await (enables streaming)createPage() HOC — Standardizes page patterns with Suspense| Issue | Cause | Solution |
|---|---|---|
| SCAPI 401 errors | Missing or invalid credentials | Verify .env variables match your Commerce Cloud org |
| JavaScript file errors | .js/.jsx files in source | Rename to .ts/.tsx; ESLint blocks JS files |
| Dev server not starting | Missing dependencies | Run pnpm install |
| Config not loading | Missing config.server.ts defaults | Define defaults before using environment overrides |
storefront-next:sfnext-configuration - Ongoing configuration management and multi-site setupstorefront-next:sfnext-routing - File-based routing conventionsstorefront-next:sfnext-data-fetching - Server-side data loading patternsstorefront-next:sfnext-deployment - Building and deploying to MRTnpx claudepluginhub salesforcecommercecloud/b2c-developer-tooling --plugin storefront-nextManages Storefront Next application configuration via config.server.ts, environment variables, and multi-site setup. Use when editing config or adding PUBLIC__ env vars.
Build Next.js/React apps for Saleor storefronts/Apps with App Router conventions, server/client components, GraphQL integration, MacawUI, and Tailwind CSS.
Provides patterns for Next.js 15 storefronts with Medusa v2: App Router structure, server/client components, JS SDK integration, data fetching, caching, server actions.