Deploying a Next.js Store on Saleforce Commerce Cloud (SFCC)

Deliver a sub-second Next.js website on Salesforce Commerce Cloud with Layer0

Next.js is an open-source React-based isomorphic framework for server-side rendered applications. To ensure fast page loads, Next.js automatically splits code and dynamically generates the HTML every time a new request comes in with the use of a server. Key benefits of Next.js include: built-in server-side rendering, automatic code splitting, page caching and route prefetching, file-system routing, and CSS-in-JavaScript styling. 

Salesforce Commerce Cloud (SFCC), formerly known as Demandware, is a cloud-based solution designed for complex omni-channel retail that can support complex order management and pricing. Salesforce Commerce Cloud is one of the more popular eCommerce backend platforms with three proprietary frontends and two robust APIs available to its customers. SFCC proprietary frontends include: Mobile First Reference Architecture (MFRA) / Storefront Reference Architecture (SFRA) and SiteGensis. MFRA/SFRA has opened up SFCC to modern development practices such as CI/CD, and are an upgrade from the old SiteGenesis storefront. However, this frontend is still jQuery-based mobile site. In addition, the platform does not support the building blocks of speedy page loads, i.e. PWA, AMP or SSR. in fact, Salesforce Commerce Cloud's backend JavaScript engine isn't suitable for SSR. As a result, website speed optimization is left to the platforms' customers, system integrators, designers and developers.  

SFCC offers two APIs are: Open Commerce API (OCAPI) and Commerce Cloud API (CCAPI) which is in beta. 

The Open Commerce API (OCAPI) is a RESTful API used by SFCC which consists of three component APIs:

  • Shop API — Provides access to Commerce Cloud digital storefront functionality
  • Data API — Provides access to digital application configuration and integration functionality on a per object basis
  • Meta API — Provides access to a formal description of the resources and documents available in the Open Commerce API.

OCAPI is a fairly robust API, however if your site is still on Pipelines architecture you may have a harder time integrating your existing customizations with OCAPI. In those cases use synthetic APIs and migrate that functionality to OCAPI at a later date. CCAPI layer in beta seems promising, but it is too early to judge the extent in which it will support speedy headless storefronts. 

Layer0 lets you deliver your Next.js storefront on Salesforce Commerce Cloud in sub-seconds. The average website on Layer0 sees median speeds of 320ms loads, as measured by Largest Contentful Paint (LCP). But Layer0 is much more than a website accelerator. It is a Jamstack platform for eCommerce. Layer0 makes websites faster for users and simpler for frontend developers. The platform was built specifically for large-scale, database-driven websites such as eCommerce and Travel and includes the following benefits: 

  • Jamstack for eCommerce via both pre and just-in-time rendering
  • Zero latency networking via prefetching of data from your product catalog APIs
  • An edge that can be configured natively in your Next.js app (CDN-as-JavaScript
  • Edge rules that can run locally, in pre-prod and production environments  
  • Automated, full-stack preview URLs from GitHub, GitLab, or Bitbucket with every new branch and push
  • Performant split plits at the edge and A/B tests that do not slow down the site, canary deploys, and personalization
  • Serverless JavaScript that is much easier and more reliable than AWS Lambda

With Layer0, your Next.js SFCC store will run in sub-second speeds and your developers will be empowered to control edge caching and reduce rework using the various developer productivity tools that come with the platform. 

Check out Shoe Carnival, a sub-second SFCC storefront on Layer0. The shoe retailer has reduced page loads by 92%, outperforms 98% of leading websites, and increased revenue 40% on Layer0.

Layer0 is a main contributor to React Storefront (RSF), an open-source PWA framework based on Next.js. The eCommerce framework powers over billion dollars in eCommerce revenue a year. Try it out if you are in the process of building a modern frontend for an eCommerce site. Or if you're already using Next.js, use the this guide to deploy your Next.js application on Layer0 and get sub-second loads in as little as 1 hour of work. 

Deploy in minutes

Moovweb XDN works with all frontends
Deploy freeTakes 2 minutes