What is Spartacus? Intro to PWA solution for SAP Commerce Cloud

Care to share?

It is hard to explain Spartacus in a single sentence, so I’ll give you a bit of historical background that will help us see the full picture. However, in the simplest possible definition, Spartacus is an open-source project, a storefront framework, and a set of JS libraries.

What is SAP Spartacus? 

“Spartacus is a lean, Angular-based JavaScript storefront for SAP Commerce Cloud. Spartacus talks to SAP Commerce Cloud exclusively through the Commerce REST API.”

That’s what you’ll read in the documentation. I’d like to tell you here what it actually means!

Spartacus Extended Training for SAP Commerce Cloud developers >

Historical background of PWA for SAP

Back in time, when SAP Commerce was called Hybris, the accelerator concept was created. 

“SAP Commerce Accelerator is a ready-to-use web implementation template that enables you to jumpstart your implementation and easily build and maintain a feature-rich and flexible commerce solution.”

It is a ready-to-use eCommerce implementation that you can install and run quickly. Then, as it is a template, you can customize it. Accelerators have monolithic Java-based architecture and storefront development is done using JSP (Java Server Pages).

Monolithic architecture and JSPs are clearly outdated nowadays but I’m certainly not discrediting a technology just because it’s old-fashioned, especially if it serves its purpose. So let’s have a look at objective reasons why SAP decided on a new way of developing storefronts for SAP Commerce. Monolithic architecture often leads to scalability problems. Although it gives a lot of flexibility in development, it may cause some trouble in upgrades and deployment. Imagine that you are making a small visual change to your storefront. Deploying it to production may require rebuilding the whole server and restarting it. It also requires a full-stack developer to do this. Talking about staff leads us to the second problem, which is JSP. As far as I know, It’s not so easy to find a developer willing to work with JSP these days. It’s a technology that is declining in popularity and has numerous problems (which I won’t list here but you can easily explore for yourself). The third issue with the accelerator storefront is that it is a template code. This leads to upgradability difficulties.

This technical debt led to the development of a new single-page app storefront in 2017, which is called Spartacus. SAP cooperates with Divante on that project. The 1.0 version was released in 2019.

Accelerators are still available widely used and may still be the primary choice for some projects. However, as soon as Spartacus gains feature parity with accelerators (which is planned for 2020), the situation should flip around.

Spartacus project

What is the Spartacus project?

Spartacus is three things:

1. An Open-Source Project

First of all, it is an open-source project hosted on Github. It is mainly developed and maintained by SAP and Divante but anyone can contribute. What I like about it is that everything is transparent. You can see the source code. You can see the issues and check their status. You also can post your own issues and add comments. What’s more, anyone can join the Slack workspace and make the most of the support from a growing and open community.

2. Storefront framework

It is kind of a framework for building decoupled storefronts that communicate with SAP Commerce Cloud through the REST API. It is often called a headless storefront but I don’t like that name, personally. Spartacus is Angular-based, so it allows you to build SPA and PWA storefronts using this enterprise-ready framework. The Spartacus team promises to be up to date with the newest version of Angular. What I can add here is that Spartacus brings a quite nice developer experience for former accelerator-based storefront developers as some good concepts from the previous were reused (I’ll probably extend that topic in another blog post).

3. Set of libraries

Spartacus is also a set of JavaScript libraries available on npm.js. This is a shift in approach compared to work with accelerators which were shipped as a template code. In Spartacus, there’s no need to change the source code; you just import fine-grained libraries, override or extend given components/services, and implement your custom ones. The library-based approach provides simple upgradability along with full extensibility.

Wrapping up

Spartacus is a huge technological leap forward from the monolithic architectures of the 2000s to the decoupled modern JavaScript apps of the 2020s.

I hope that this article helped you understand what Spartacus is and where it came from. If not, leave a comment or contact me directly. I’m eager to help you get started with Spartacus. In my next post, I’ll share some knowledge sources so that you can deep dive into Spartacus. Also, feel free to jump into our other resources dedicated to Spartacus PWA.

Published March 3, 2020