The original address

What is Spartacus?

Spartacus is a free, open source JavaScript Web application that released version 1.0 in May 2019 and continues to release new updates every few weeks. It allows you to quickly create your own Javascript based branded storefront for the SAP Commerce Cloud. Spartacus is written with Angular and published as a set of libraries. The recommended way to use JavaScript is to build your own JavaScript Web application and import the Spartacus library. The storefront is ready to use out of the box without modification, but Spartacus is designed to be upgradable, customizable and extensible to meet all of your brand and functional requirements.

Spartacus is a strategic approach to maintaining customizable storefronts using the SAP Commerce Cloud. It replaces the accelerator template first introduced in SAP Commerce V4.4 to provide a ready-made entry implementation. While Accelerator templates allow partners to quickly develop an omnishare-channel experience by changing the sample storefront, the templates are not easy to upgrade, they are JSP-based, and the storefront is tightly coupled to the SAP Commerce core platform.

Spartacus Architecture

Although Spartacus is separate from the SAP Commerce Cloud, it only works on the SAP Commerce Cloud platform. Spartacus relies on the SAP Commerce Cloud API and CMS content to run. It is 100% API-driven and designed to run in a headless fashion. You are free to extend the libraries that come with Spartacus to include your own customizations. Your Spartacus implementation can also be extended through the SAP Extension Suite. Because Spartacus is separate from the SAP Commerce Cloud platform, you can choose to separate front-end and back-end development, and possibly even have separate deployment/release cycles. Your Spartacus storefront can also be scaled independently of the SAP Commerce Cloud platform. The only time you might need to tweak a version is in the case of the APIs available to Spartacus in the SAP Commerce Cloud. For example, Spartacus 2.0 has some functionality that can only be activated by leveraging APIs published in SAP Commerce Core 2005.

Spartacus uses a combination of languages, technologies, and libraries, including Angular, TypeScript, RxJS, NGRX, Sass, and Bootstrap. The final output is pure JavaScript. Angular is currently used as a development framework, but the goal is to allow the use of other frameworks.

Spartacus is responsive and includes support for mobile, tablet, desktop, and wide desktop breakpoints, but you are free to configure your own breakpoints. Spartacus also comes with a built-in Progressive Web Application (PWA) feature that you can configure your storefront to use. This will make your storefront more like a traditional native iOS/Android mobile app, with excellent performance and reliability as well as mobile native features.

Links to a series of Spartacus learning videos at Open SAP

Spartacus is purely a set of libraries that contain a set of core libraries, components, and styles. It has its own release cycle and aims to release every two weeks. You have complete control over whether or not you accept these library updates. You can choose which version of the library you want to use in your application (Spartacus uses Semantic version control 2.0), which can be used to fully configure and customize your storefront. See this page for more details about major release updates.

Customization is different from accelerators; You never customize the Spartacus code directly — you override or replace styles and code. This approach allows for easy upgrades. For more information about extending Spartacus, you can check out our video library.

Underlying Frameworks/Libraries

If you have been developing SAP Commerce Cloud solutions in the past, you may be more familiar with our accelerators (described below), which are Spring Model View Controller (MVC) based applications. Since Spartacus is a JavaScript application, the underlying framework/library is completely different. You may need to spend time familiarizing yourself with these technologies/frameworks before you start developing your Spartacus application.

The following covers the main sites of the frameworks/libraries in use and is a good reference for information that can help with your development efforts:

  • Languages: Typescript, Sass
  • Frameworks: Angular, RxJS, NgRx
  • Dependency management: Yarn, npm
  • Build: Angular CLI (under the hood: webpack, ng-packagr)
  • Testing: Jasmine, Cypress, Karma
  • Code Quality: Prettier, TSLint
  • IDE: Visual Studio Code (or equivalent)
  • Source control / distribution: Github, npmjs

SAP called Spartacus public class: https://open.sap.com/courses/…

SAP Commerce Cloud Accelerators

Because Spartacus is separate from the SAP Commerce Cloud, you do not need to use Spartacus. You are free to create and maintain your own JavaScript Web applications, or you can continue to use the Accelerator templates embedded in the SAP Commerce Cloud, although these are not the strategic direction forward. Spartacus will not have the same features as all of SAP Commerce Cloud Accelerators at release time, but these gaps will be covered in the Spartacus documentation.

If you’re already using an Accelerator based solution and want to migrate to Spartacus, it’s best to start from scratch. Spartacus went completely from accelerator to paradigm in terms of technology and architecture (templates and libraries, headless and embedded, JSP and Angular). They are so different that it is impossible to port the code based on Accelerator to the Spartacus storefront. That said, because Spartacus is separate from the SAP Commerce Cloud platform, you can simplify the transition to Spartacus by running both the Accelerator-based store and the Spartacus storefront. For example, if you currently have a B2B Accelerator storefront and want to set up a new B2C storefront, you can use Spartacus to create a B2C storefront while still hosting your B2B accelerator-based storefront. Assume that you have set up the source repository to build and deploy B2B Accelerator storefronts to add B2C storefronts:

  • Modify your repository to include the correct structure for building/deploying JavaScript-based storefronts.
  • Configure your manifest.json file to define the API aspect that Spartacus calls.
  • Define a new application in your manifest. JSON file that points to the location of your Spartacus storefront.

You can continue to add new Spartacus storefront applications and configure your endpoints to allow specific traffic into your storefront. They are still using the same SAP Commerce Cloud platform, so you can run multiple storefronts simultaneously while still keeping the same information (customers, shopping carts, orders, and so on).

Scalability

As mentioned above, because your Spartacus storefront is separate from the SAP Commerce Cloud storefront, you can choose to extend it separately. Other scaling considerations, such as content delivery networks (CDNs), can also be leveraged to help reduce the load. In addition, Spartacus will include PWA capabilities, such as cache first network capabilities, which will give you the option to cache resources locally on user devices. Lazy loading can also be used to determine if/when parts of a component are loaded. Finally, because Spartacus is API-driven, it can quickly add new functionality to the Spartacus storefront using the SAP business technology platform, the Kyma runtime, and the accompanying Extensible Microservices.

Server-side vs. Client-Side Rendering

By default, Spartacus is set to client-side rendering, but you can configure server-side rendering (SSR). It is important to consider the pros and cons of each option and determine which one best fits your needs. For e-business solutions that often require SSR search engine optimization (SEO) outweighs any benefits of client-side presentation.

Support

You can use this Slack Channel

More of Jerry’s original articles can be found on “Wang Zixi “: