Salesforce Commerce Development Setup
Before Writing Code
Fetch live docs before setting up a project.
- Web-fetch:
https://github.com/SalesforceCommerceCloud/sfcc-ci for sfcc-ci CLI commands
- Web-search: "site:developer.salesforce.com sf cli getting started 2026" for sf CLI setup
- Web-search: "site:developer.salesforce.com SFRA getting started 2026" for SFRA project setup
- Web-fetch:
https://github.com/SalesforceCommerceCloud/storefront-reference-architecture for SFRA reference
- Web-search: "site:developer.salesforce.com commerce cloud b2c b2b documentation 2026"
Conceptual Architecture
Prerequisites
B2C Commerce (SFCC) requires:
- Business Manager account (provided by Salesforce or your org)
- Sandbox instance (e.g.,
dev01-realm-customer.demandware.net)
- API client credentials (client ID + secret) for sfcc-ci authentication
- Account Manager credentials for WebDAV/OCAPI
B2B Commerce (Lightning) requires:
- Salesforce org (Developer Edition, sandbox, or production) with B2B Commerce license
- sf CLI installed (
npm install -g @salesforce/cli)
- Scratch org or sandbox for isolated development
CLI Tools
| Tool |
Platform |
Install |
Auth |
| sfcc-ci |
B2C |
npm install -g sfcc-ci |
sfcc-ci client:auth (client ID + secret) |
| sf CLI |
B2B |
npm install -g @salesforce/cli |
sf org login web or sf org login jwt |
Key sfcc-ci Commands:
sfcc-ci code:deploy -- upload code to sandbox
sfcc-ci code:activate -- activate a code version
sfcc-ci sandbox:create / sandbox:list -- manage on-demand sandboxes
sfcc-ci job:run -- execute Business Manager jobs
Key sf CLI Commands:
sf project deploy start -- deploy metadata to org
sf org create scratch -- create scratch org
sf apex run test -- run Apex tests
sf data import tree -- import sample data
Project Structures
B2C SFRA Cartridge Project:
sfra-project/
cartridges/
app_storefront_base/ # Base (never modify)
app_custom_storefront/ # Custom overlay
cartridge/
controllers/, models/, scripts/
templates/, client/ (js, scss)
dw.json, package.json, webpack.config.js
B2C PWA Kit Project:
pwa-kit-project/
app/
components/, pages/, hooks/, utils/
commerce-api/ # Commerce Cloud API client
config/
default.js, production.js
package.json, .env
B2B Lightning Project:
b2b-lightning-project/
force-app/main/default/
lwc/, classes/, triggers/
objects/, flexipages/
experiences/, permissionsets/
config/project-scratch-def.json
sfdx-project.json, .forceignore
Configuration Files
dw.json (B2C):
- Placed in project root; configures hostname, code-version, cartridge list, excludes
- Never commit with credentials -- use environment variables or
.env excluded from VCS
sfdx-project.json (B2B):
- Placed in project root; defines packageDirectories, sourceApiVersion, namespace, login URL
.forceignore (B2B):
- Excludes files from deployment (jsconfig.json, .eslintrc.json, logs, OS files)
Key Configuration Fields
B2C dw.json fields:
hostname -- sandbox domain
username / password -- credentials (prefer env vars)
code-version -- target code version
cartridges -- array of cartridge names to upload
exclude -- files/directories to skip
B2B sfdx-project.json fields:
packageDirectories -- array of source paths (typically force-app)
sourceApiVersion -- Salesforce API version (e.g., "61.0")
namespace -- package namespace (empty for unmanaged)
sfdcLoginUrl -- org login URL
Sandbox and Org Types
| Type |
Platform |
Purpose |
| Development sandbox |
B2C |
Developer-specific feature work |
| Staging sandbox |
B2C |
Pre-production validation |
| On-demand sandbox |
B2C |
Temporary, via sfcc-ci sandbox:create |
| Scratch org |
B2B |
Short-lived, disposable dev org |
| Developer sandbox |
B2B |
Partial copy of production |
| Full sandbox |
B2B |
Full copy of production for UAT |
Environment Variables
Store credentials as environment variables, never in committed files.
B2C: SFCC_CLIENT_ID, SFCC_CLIENT_SECRET, SFCC_HOSTNAME, SFCC_USERNAME, SFCC_PASSWORD, SFCC_CODE_VERSION
B2B: SF_USERNAME, SF_ORG_ALIAS, SF_CLIENT_ID, SF_JWT_KEY_FILE (for CI/CD connected app auth)
Deprecated Technologies
| Deprecated |
Replacement |
| dwupload |
sfcc-ci |
| sfdx CLI (old) |
sf CLI (unified) |
| Prophet Debugger |
Official Salesforce VS Code extensions |
Best Practices
B2C Commerce
- Use
sfcc-ci for all deployments; never use manual WebDAV upload
- Never modify
app_storefront_base directly; always overlay in custom cartridge
- Build assets (
npm run compile:js, npm run compile:scss) before deployment
- Keep
dw.json out of version control (add to .gitignore)
B2B Commerce
- Use
sf project deploy start for metadata deployment; avoid Change Sets
- Create scratch orgs for feature development; keep them isolated
- Use source tracking (
sf project deploy preview) to review changes before deploy
- Use Permission Sets for access control; avoid modifying profiles directly
Both Platforms
- Use environment variables for all secrets and instance-specific configuration
- Set up CI/CD pipelines for automated testing and deployment
- Use linting (ESLint, Prettier for JS; Apex PMD for Apex)
Fetch the sfcc-ci documentation, SFRA getting-started guide, and sf CLI reference for exact commands and latest project structures before setting up.
1---2name: sf-setup3description: Set up a Salesforce Commerce development environment — sfcc-ci CLI for B2C, sf CLI for B2B, Business Manager access, sandbox management, dw.json configuration, .sfdx project setup, and project structures for SFRA, PWA Kit, and Lightning. Use when starting a new Salesforce Commerce project.4allowed-tools: Read, Write, Edit, Bash, Grep, Glob, WebSearch, WebFetch5metadata:6 source: https://skillmd.com/skills/orcaqubits/sf-setup7---89# Salesforce Commerce Development Setup1011## Before Writing Code1213**Fetch live docs before setting up a project.**14151. Web-fetch: `https://github.com/SalesforceCommerceCloud/sfcc-ci` for sfcc-ci CLI commands162. Web-search: "site:developer.salesforce.com sf cli getting started 2026" for sf CLI setup173. Web-search: "site:developer.salesforce.com SFRA getting started 2026" for SFRA project setup184. Web-fetch: `https://github.com/SalesforceCommerceCloud/storefront-reference-architecture` for SFRA reference195. Web-search: "site:developer.salesforce.com commerce cloud b2c b2b documentation 2026"2021## Conceptual Architecture2223### Prerequisites2425**B2C Commerce (SFCC) requires:**26- Business Manager account (provided by Salesforce or your org)27- Sandbox instance (e.g., `dev01-realm-customer.demandware.net`)28- API client credentials (client ID + secret) for sfcc-ci authentication29- Account Manager credentials for WebDAV/OCAPI3031**B2B Commerce (Lightning) requires:**32- Salesforce org (Developer Edition, sandbox, or production) with B2B Commerce license33- sf CLI installed (`npm install -g @salesforce/cli`)34- Scratch org or sandbox for isolated development3536### CLI Tools3738| Tool | Platform | Install | Auth |39|---|---|---|---|40| sfcc-ci | B2C | `npm install -g sfcc-ci` | `sfcc-ci client:auth` (client ID + secret) |41| sf CLI | B2B | `npm install -g @salesforce/cli` | `sf org login web` or `sf org login jwt` |4243**Key sfcc-ci Commands:**44- `sfcc-ci code:deploy` -- upload code to sandbox45- `sfcc-ci code:activate` -- activate a code version46- `sfcc-ci sandbox:create` / `sandbox:list` -- manage on-demand sandboxes47- `sfcc-ci job:run` -- execute Business Manager jobs4849**Key sf CLI Commands:**50- `sf project deploy start` -- deploy metadata to org51- `sf org create scratch` -- create scratch org52- `sf apex run test` -- run Apex tests53- `sf data import tree` -- import sample data5455### Project Structures5657**B2C SFRA Cartridge Project:**5859```60sfra-project/61 cartridges/62 app_storefront_base/ # Base (never modify)63 app_custom_storefront/ # Custom overlay64 cartridge/65 controllers/, models/, scripts/66 templates/, client/ (js, scss)67 dw.json, package.json, webpack.config.js68```6970**B2C PWA Kit Project:**7172```73pwa-kit-project/74 app/75 components/, pages/, hooks/, utils/76 commerce-api/ # Commerce Cloud API client77 config/78 default.js, production.js79 package.json, .env80```8182**B2B Lightning Project:**8384```85b2b-lightning-project/86 force-app/main/default/87 lwc/, classes/, triggers/88 objects/, flexipages/89 experiences/, permissionsets/90 config/project-scratch-def.json91 sfdx-project.json, .forceignore92```9394### Configuration Files9596**dw.json (B2C):**97- Placed in project root; configures hostname, code-version, cartridge list, excludes98- **Never commit with credentials** -- use environment variables or `.env` excluded from VCS99100**sfdx-project.json (B2B):**101- Placed in project root; defines packageDirectories, sourceApiVersion, namespace, login URL102103**.forceignore (B2B):**104- Excludes files from deployment (jsconfig.json, .eslintrc.json, logs, OS files)105106### Key Configuration Fields107108**B2C dw.json fields:**109- `hostname` -- sandbox domain110- `username` / `password` -- credentials (prefer env vars)111- `code-version` -- target code version112- `cartridges` -- array of cartridge names to upload113- `exclude` -- files/directories to skip114115**B2B sfdx-project.json fields:**116- `packageDirectories` -- array of source paths (typically `force-app`)117- `sourceApiVersion` -- Salesforce API version (e.g., `"61.0"`)118- `namespace` -- package namespace (empty for unmanaged)119- `sfdcLoginUrl` -- org login URL120121### Sandbox and Org Types122123| Type | Platform | Purpose |124|---|---|---|125| Development sandbox | B2C | Developer-specific feature work |126| Staging sandbox | B2C | Pre-production validation |127| On-demand sandbox | B2C | Temporary, via `sfcc-ci sandbox:create` |128| Scratch org | B2B | Short-lived, disposable dev org |129| Developer sandbox | B2B | Partial copy of production |130| Full sandbox | B2B | Full copy of production for UAT |131132### Environment Variables133134Store credentials as environment variables, never in committed files.135136**B2C:** `SFCC_CLIENT_ID`, `SFCC_CLIENT_SECRET`, `SFCC_HOSTNAME`, `SFCC_USERNAME`, `SFCC_PASSWORD`, `SFCC_CODE_VERSION`137138**B2B:** `SF_USERNAME`, `SF_ORG_ALIAS`, `SF_CLIENT_ID`, `SF_JWT_KEY_FILE` (for CI/CD connected app auth)139140### Deprecated Technologies141142| Deprecated | Replacement |143|---|---|144| dwupload | sfcc-ci |145| sfdx CLI (old) | sf CLI (unified) |146| Prophet Debugger | Official Salesforce VS Code extensions |147148## Best Practices149150### B2C Commerce151- Use `sfcc-ci` for all deployments; never use manual WebDAV upload152- Never modify `app_storefront_base` directly; always overlay in custom cartridge153- Build assets (`npm run compile:js`, `npm run compile:scss`) before deployment154- Keep `dw.json` out of version control (add to `.gitignore`)155156### B2B Commerce157- Use `sf project deploy start` for metadata deployment; avoid Change Sets158- Create scratch orgs for feature development; keep them isolated159- Use source tracking (`sf project deploy preview`) to review changes before deploy160- Use Permission Sets for access control; avoid modifying profiles directly161162### Both Platforms163- Use environment variables for all secrets and instance-specific configuration164- Set up CI/CD pipelines for automated testing and deployment165- Use linting (ESLint, Prettier for JS; Apex PMD for Apex)166167Fetch the sfcc-ci documentation, SFRA getting-started guide, and sf CLI reference for exact commands and latest project structures before setting up.