Composable Commerce Architecture
Activate when architecting a headless / composable commerce implementation on Salesforce Commerce Cloud (B2C or B2B): bespoke storefronts, micro-frontends, BFF middleware, multi-brand/multi-region front-ends over shared Commerce APIs. Composable commerce trades the shipped storefront for flexibility and frontend ownership — it is a deliberate architectural choice, not a default.
Before Starting
- Confirm the composable choice is warranted. Composable commerce adds complexity: you now own a frontend codebase, a BFF, CDN config, caching, and observability. If the business can live with the shipped storefront, do that first.
- Inventory the Commerce APIs in scope. Salesforce Commerce API (SCAPI) covers catalog, cart, checkout, promotions, customer. Gaps (custom flows) become BFF-only features.
- Understand the caching contract. Composable sites live or die by cache strategy. Decide what is page-cached (catalog, PLP), what is edge-computed (personalization), what is origin-only (cart, checkout).
Core Concepts
Headless vs composable
Headless = decoupled frontend over one backend. Composable = best-of-breed assembly: Commerce Cloud for transactions, Contentful/Amplience for CMS, Algolia/Coveo for search, ShipStation for fulfillment. The integration layer (BFF) is what makes it composable.
Backend-for-Frontend (BFF)
A thin service layer between the storefront and Commerce Cloud APIs. Aggregates calls, translates responses for the frontend, hosts business logic the frontend should not have (pricing rules, promo eligibility). Typically Node.js or serverless functions.
MACH stack positioning
MACH = Microservices, API-first, Cloud-native, Headless. Salesforce Commerce Cloud with SCAPI fits MACH; pair with Next.js / Remix for the frontend. Cloud-native = the frontend lives in Vercel / Netlify / Cloudflare Pages, not in Commerce Cloud hosting.
Edge rendering and CDN
Catalog pages are rendered at the edge (ISR / SSG), cached in CDN. Authenticated cart and checkout are origin-rendered. Personalization is edge-computed from a user cookie or header.
Common Patterns
Pattern: Next.js storefront with SCAPI + BFF
Next.js app on Vercel, reads from a Node BFF deployed on Vercel functions or a separate container. BFF authenticates to SCAPI via Client Credentials, applies markups, serves aggregated responses. CDN caches PLP/PDP at edge with ISR revalidation.
Pattern: Multi-brand single Commerce Cloud
Brands share catalog/inventory but have distinct storefronts. BFF routes per brand. Brand config in Commerce Cloud site preferences; frontend derives brand from hostname.
Pattern: Decompose monolith storefront incrementally
Phase 1: keep existing storefront; add headless for one PDP experiment. Phase 2: entire PLP+PDP composable; checkout stays on shipped. Phase 3: full composable including checkout. Gives learning at each phase.
Decision Guidance
| Situation |
Recommended Approach |
Reason |
| Standard B2C UX needs |
Shipped storefront |
Lowest TCO |
| Brand-specific UX with perf requirements |
Composable + Next.js |
Frontend ownership |
| Multi-region with localization needs |
Composable + edge rendering |
Latency control |
| Short timeline, generic UX |
Stay with shipped |
Composable takes 6-9 months minimum |
| Team lacks frontend engineering |
Don't go composable |
Ops burden ≠ shipped |
Recommended Workflow
- Validate the composable decision vs shipped storefront with a capability gap analysis.
- Draft the component architecture: storefront, BFF, CDN, PIM, CMS, search, payments.
- Map every customer-facing flow to SCAPI endpoints; identify gaps that need custom Apex + custom APIs.
- Select the frontend framework and deployment target; prototype a PDP to validate latency budget.
- Build the BFF with a contract between frontend and Commerce Cloud; version the contract from day one.
- Define caching strategy per route; instrument observability.
- Rollout incrementally: A/B test the composable experience against the shipped storefront.
Review Checklist
Salesforce-Specific Gotchas
- SCAPI rate limits are per-client, not per-user. A busy BFF can exhaust rate limits and throttle every user; design token rotation and per-endpoint budgets.
- Session affinity for cart lives with Commerce Cloud. Composable frontends must pass the cart token consistently; losing it = empty cart.
- B2B promotions and pricing often require Apex extension points. Plan the custom API surface alongside the frontend.
Output Artifacts
| Artifact |
Description |
| Capability gap analysis |
Composable justification |
| BFF service contract |
Endpoint catalog, schemas, versioning |
| Caching strategy doc |
Per-route cache, CDN config, invalidation |
| Decomposition roadmap |
Phased cutover with rollback |
Related Skills
architect/multi-cloud-architecture — adjacent cloud composition
integration/integration-pattern-selection — BFF integration choice
security/oauth-and-jwt-patterns — BFF auth to SCAPI
1---2name: composable-commerce-architecture3description: Composable commerce on Salesforce: headless API layer, micro-frontends, BFF pattern, CDN strategy, third-party composability over B2C/B2B Commerce. NOT for the supported PWA Kit on Managed Runtime composable storefront — use architect/headless-commerce-architecture. NOT for standard B2C storefront setup — use admin/b2c-commerce-store-setup.4---56# Composable Commerce Architecture78Activate when architecting a headless / composable commerce implementation on Salesforce Commerce Cloud (B2C or B2B): bespoke storefronts, micro-frontends, BFF middleware, multi-brand/multi-region front-ends over shared Commerce APIs. Composable commerce trades the shipped storefront for flexibility and frontend ownership — it is a deliberate architectural choice, not a default.910## Before Starting1112- **Confirm the composable choice is warranted.** Composable commerce adds complexity: you now own a frontend codebase, a BFF, CDN config, caching, and observability. If the business can live with the shipped storefront, do that first.13- **Inventory the Commerce APIs in scope.** Salesforce Commerce API (SCAPI) covers catalog, cart, checkout, promotions, customer. Gaps (custom flows) become BFF-only features.14- **Understand the caching contract.** Composable sites live or die by cache strategy. Decide what is page-cached (catalog, PLP), what is edge-computed (personalization), what is origin-only (cart, checkout).1516## Core Concepts1718### Headless vs composable1920Headless = decoupled frontend over one backend. Composable = best-of-breed assembly: Commerce Cloud for transactions, Contentful/Amplience for CMS, Algolia/Coveo for search, ShipStation for fulfillment. The integration layer (BFF) is what makes it composable.2122### Backend-for-Frontend (BFF)2324A thin service layer between the storefront and Commerce Cloud APIs. Aggregates calls, translates responses for the frontend, hosts business logic the frontend should not have (pricing rules, promo eligibility). Typically Node.js or serverless functions.2526### MACH stack positioning2728MACH = Microservices, API-first, Cloud-native, Headless. Salesforce Commerce Cloud with SCAPI fits MACH; pair with Next.js / Remix for the frontend. Cloud-native = the frontend lives in Vercel / Netlify / Cloudflare Pages, not in Commerce Cloud hosting.2930### Edge rendering and CDN3132Catalog pages are rendered at the edge (ISR / SSG), cached in CDN. Authenticated cart and checkout are origin-rendered. Personalization is edge-computed from a user cookie or header.3334## Common Patterns3536### Pattern: Next.js storefront with SCAPI + BFF3738Next.js app on Vercel, reads from a Node BFF deployed on Vercel functions or a separate container. BFF authenticates to SCAPI via Client Credentials, applies markups, serves aggregated responses. CDN caches PLP/PDP at edge with ISR revalidation.3940### Pattern: Multi-brand single Commerce Cloud4142Brands share catalog/inventory but have distinct storefronts. BFF routes per brand. Brand config in Commerce Cloud site preferences; frontend derives brand from hostname.4344### Pattern: Decompose monolith storefront incrementally4546Phase 1: keep existing storefront; add headless for one PDP experiment. Phase 2: entire PLP+PDP composable; checkout stays on shipped. Phase 3: full composable including checkout. Gives learning at each phase.4748## Decision Guidance4950| Situation | Recommended Approach | Reason |51|---|---|---|52| Standard B2C UX needs | Shipped storefront | Lowest TCO |53| Brand-specific UX with perf requirements | Composable + Next.js | Frontend ownership |54| Multi-region with localization needs | Composable + edge rendering | Latency control |55| Short timeline, generic UX | Stay with shipped | Composable takes 6-9 months minimum |56| Team lacks frontend engineering | Don't go composable | Ops burden ≠ shipped |5758## Recommended Workflow59601. Validate the composable decision vs shipped storefront with a capability gap analysis.612. Draft the component architecture: storefront, BFF, CDN, PIM, CMS, search, payments.623. Map every customer-facing flow to SCAPI endpoints; identify gaps that need custom Apex + custom APIs.634. Select the frontend framework and deployment target; prototype a PDP to validate latency budget.645. Build the BFF with a contract between frontend and Commerce Cloud; version the contract from day one.656. Define caching strategy per route; instrument observability.667. Rollout incrementally: A/B test the composable experience against the shipped storefront.6768## Review Checklist6970- [ ] Capability gap analysis shows composable is warranted71- [ ] BFF contract versioned and documented72- [ ] Caching strategy defined per route (edge / origin)73- [ ] Personalization approach clear (cookie / header / edge function)74- [ ] PCI scope minimized (checkout on hosted payment or tokenized)75- [ ] Observability: RUM, BFF logs, Commerce Cloud API metrics joined76- [ ] Rollback plan to shipped storefront documented7778## Salesforce-Specific Gotchas79801. **SCAPI rate limits are per-client, not per-user.** A busy BFF can exhaust rate limits and throttle every user; design token rotation and per-endpoint budgets.812. **Session affinity for cart lives with Commerce Cloud.** Composable frontends must pass the cart token consistently; losing it = empty cart.823. **B2B promotions and pricing often require Apex extension points.** Plan the custom API surface alongside the frontend.8384## Output Artifacts8586| Artifact | Description |87|---|---|88| Capability gap analysis | Composable justification |89| BFF service contract | Endpoint catalog, schemas, versioning |90| Caching strategy doc | Per-route cache, CDN config, invalidation |91| Decomposition roadmap | Phased cutover with rollback |9293## Related Skills9495- `architect/multi-cloud-architecture` — adjacent cloud composition96- `integration/integration-pattern-selection` — BFF integration choice97- `security/oauth-and-jwt-patterns` — BFF auth to SCAPI