Next.js + Salesforce Commerce Cloud

R
Renaudil y a 2 jours
0

Description

Starter kit for high-performance commerce with Salesforce Commerce Cloud and Next.js.

npx boilerapp next-js-salesforce-commerce-cloud

Documentation

Next.js Commerce + Salesforce Commerce Cloud

A high-perfomance, server-rendered Next.js App Router ecommerce application.

This template uses React Server Components, Server Actions, Suspense, useOptimistic, use cache and more.

Providers

This version of Next.js Commerce is integrated with Salesforce Commerce Cloud. The integration code for Salesforce Commerce Cloud can be found in the lib/sfcc directory.

For information on other commerce providers, additional details, and the core Next.js Commerce template, please refer to the official Next.js Commerce repository.

Enviroment variables

This project requires the following environment variables for connecting to Salesforce Commerce Cloud:

SFCC_ORGANIZATIONID=""
SFCC_SHORTCODE=""
SFCC_SITEID="RefArch"
SFCC_CLIENT_ID=""
SFCC_SECRET=""
SITE_NAME="ACME Store"
SFCC_REVALIDATION_SECRET=""
  • SFCC_ORGANIZATIONID: Salesforce Commerce Cloud Organization ID
  • SFCC_SHORTCODE: Salesforce Commerce Cloud instance short code
  • SFCC_SITEID: ID of the target site
  • SFCC_CLIENT_ID: SLAS API Client ID
  • SFCC_SECRET: SLAS API Client Secret
  • SITE_NAME: User-defined name for the site
  • SFCC_REVALIDATION_SECRET: User-defined string for on-demand revalidation

Please refer to the official Salesforce Commerce API documentation for details on how to retrieve these values:

Store configuration

This project works with a standard Salesforce Commerce Cloud RefArch site with minimal modifications. However, for the homepage to display content correctly, two product categories must be created:

  • hidden-homepage-carousel: This category populates the main carousel on the homepage
  • hidden-homepage-featured-items: This category populates the featured products section on the homepage

Create these two categories and assign products to them within Business Manager.

Running locally

You will need to use the environment variables defined in .env.example to run Next.js Commerce. It's recommended you use Vercel Environment Variables for this, but a .env file is all that is necessary.

Note: You should not commit your .env file or it will expose secrets that will allow others to control your Salesforce Commerce Cloud store.

  1. Install Vercel CLI: npm i -g vercel
  2. Link local instance with Vercel and GitHub accounts (creates .vercel directory): vercel link
  3. Download your environment variables: vercel env pull
pnpm install
pnpm dev

Your app should now be running on localhost:3000.

Prix

Gratuit

FREE

Commentaires (0)

FAQ

Questions Fréquemment Posées

Vous avez une question ? Nous avons les réponses. Si vous ne trouvez pas ce que vous cherchez, n'hésitez pas à nous contacter.

Boilerapp est une plateforme communautaire dédiée au partage de boilerplates, de starter kits et de modèles de projets pour développeurs. Notre objectif est simple : vous faire gagner du temps sur la configuration initiale (setup) pour que vous puissiez coder ce qui compte vraiment. Que vous cherchiez une simple base de code ou un projet SaaS complet, vous le trouverez ici.

Vous avez d'autres questions ?

Notre équipe est là pour vous aider. Contactez-nous et nous vous répondrons dès que possible.