Spartacus’s flexibility allows customers to shop through both traditional computer and mobile environments. Spartacus is free, open-source, and updated every few weeks through the GitHub repository.
In this article, we’ll cover some of the features of Spartacus, how to use it, and some tips and tricks you should consider.
Spartacus is a purely frontend technology and is separate from backend commerce platforms, thus decoupling the website’s architecture. SAP Commerce Cloud remains constant and operates through REST APIs.
By taking advantage of decoupled architecture, frontend developers using Spartacus don’t need to sync their release schedule with backend platform releases. Instead, each team can work independently on its own development cycles and allow Spartacus to handle communications via REST services.
Because Spartacus libraries are imported into existing websites, Spartacus is inherently upgradable and extendable. Minor releases and patches should not affect compatibility. Releases of Spartacus follow standard versioning conventions.
Users can add their own customized features. However, Spartacus is designed to be extendable, so users can continue to upgrade existing sites to leverage the latest sets of components.
Spartacus is an open-source platform and was originally written by SAP developers. With an open-source platform, Spartacus provides broader access to both the SAP Commerce Cloud and unofficial SAP partners. Because of the open-source architecture, developers can quickly access code to explore new components, test out new functionalities, and modify storefronts.
Spartacus is developed with the agile model, which provides an avenue for quick changes and rapid releases approximately every two weeks. You can choose, however, if you want your setup to automatically incorporate new releases or if you would prefer to maintain a specific version of Spartacus.
Spartacus code developers strive to fully comply with the Progressive Web Application (PWA) checklist of capable, reliable, and installable when it comes to web applications. One important factor of this goal is incorporating responsive design and supporting a multitude of breakpoints — users can configure breakpoints as well. Supported breakpoints include:
Spartacus can also allow your e-commerce site to operate more like a traditional iOS/Android mobile app. It includes mobile-ready features along with solid performance and reliability.
Spartacus is flexible enough to work with various content management systems (CMS). In cases where the content manager works with the SAP Commerce CMS, storefront content is edited through SAP Commerce Cloud CMS tools. However, Spartacus can access content through third-party CMS applications too.
In this walk-through, we’ll create a new Angular application with the name
First, open a command prompt or terminal window. Then, create a new Angular application using the Angular CLI with the following command:
ng new mynewstore --style=scss
You’ll be asked about Angular routing — enter
n for “no.” The
mynewstore folder app and associated folder are created.
Now, access the newly created
mynewstore folder with the following command:
Using Angular Schematics is the easiest way to set up your application quickly.
First, let’s set up the project using schematics. This schematics command installs the latest release of Spartacus:
ng add @spartacus/schematics
If you want to install the most recent “Next” or Release Candidate, the above command can include
@rc at the end.
To verify the installed Spartacus library versions, open
package.json, and search for
Now, install dependencies needed by your Spartacus app with the following command:
Afterward, we’ll check app.module.ts for base URL and other settings. Open
src\app\app.module.ts and see if you want to make any setup changes.
A few features to check:
baseUrl: sets your SAP Commerce Cloud server
prefix: sets OCC prefix in calls; change
/occ/v2/(if on release 2005)
features.level: sets compatibility level
context: sets site constants like language, currency, and base site
To start your application, enter the command:
At this point, your application is compiled and started. To view the
mynewstore storefront — if everything is installed locally — browse to
Although it may be tempting to copy Spartacus source code and tweak it for your site, this breaks upgradability. Instead, reference Spartacus libraries and change site behavior in other ways.
Before developing your own storefront feature, check to see if it’s something already included in Spartacus or if it’s on the design horizon.
Developers can pick which Spartacus features to leverage according to e-commerce needs. For example, you may want to allow Express Checkout but not take advantage of Guest Checkout.
Spartacus provides lightweight, frontend capabilities to online storefronts. We covered some of the basic functionalities and pros of leveraging Spartacus, learned how to create a new Angular application and add Spartacus, and covered some tips and tricks.
Start proactively monitoring your ecommerce apps — try LogRocket for free.
Vite is a versatile, fast, lightweight build tool with an exceptional DX. Let’s explore when and why you should adopt Vite in your projects.
Explore advanced capabilities for content sharing with the
navigator.share API, including dynamic content sharing, custom share targets, and batch sharing.
We spoke with Chas to get his insights on building technology and internal processes for companies that are scaling quickly.
Cypress is one of today’s foremost tools for testing web applications. Let’s explore when and why you should adopt Cypress in your projects.