Mastering SAP Spartacus: A Deep Dive into the SAP Composable Storefront
- September 02, 2023
Welcome to the world of SAP Spartacus, a popular headless storefront solution based on the Angular web application framework that uses the Commerce REST API. Spartacus is taking center stage in the growth story of headless commerce, which is projected to reach USD 3.9 billion in market size by 2025!
First released in 2019, SAP Spartacus has undergone significant updates and improvements. As a result, it has now been rebranded as SAP Commerce Cloud, Composable Storefront to reflect its advanced modular and flexible architecture. So, let’s dive into the universe of SAP Spartacus and explore its endless possibilities.
SAP Spartacus Timeline
SAP Spartacus was first released in 2019 and has been updated regularly with new features and improvements. Here is a brief SAP Spartacus timeline that presents its rapid evolution:
2019: SAP Spartacus was launched as an open-source project on GitHub, with the first version (1.0) released in July. It supported features such as server-side rendering, progressive web app, internationalization, and accessibility. It also provided a sample data extension and a B2C storefront template.
2020: SAP Spartacus released several minor and major versions, such as 1.1, 1.2, 1.3, 1.4, 2.0, 2.1, and 3.0. It added features such as lazy loading, schematics, outlets, feature flags, CMS-driven dialogs, and B2B storefront template. It also introduced the Spartacus Storefront Library to provide more components and modules for the storefront.
2021: It released further versions, going up to version 4.0. In these releases, it added features such as web components, micro frontends, schema.org markup, data isolation, and B2B organization management. It also rebranded itself as SAP Commerce Cloud, Composable Storefront.
2022: SAP Spartacus released versions 4 and beyond to version 5.1. The features added included personalization, promotions, loyalty programs, and B2B cost center management. It was renamed to SAP Commerce Cloud, Composable Storefront since version 5.03. In these updates, it integrated with other SAP products and services, such as SAP Customer Data Platform, SAP Marketing Cloud, and SAP Upscale Commerce.
2023: SAP Commerce Cloud, Composable Storefront released further versions and went up to version 6.0 in 2023. It has now added features such as voice assistant, emotion recognition, predictive analytics, and B2B approval workflow. It also adopted the latest Angular version and technologies, such as Angular Ivy, Angular Elements, and Angular Material.
What are the benefits of using SAP Spartacus or SAP Commerce Composable Storefront?
SAP Spartacus or SAP Commerce Composable Storefront offers several benefits for both developers and business users, such as:
Extensibility- Developers can easily add, remove, or replace any feature or component in the storefront without affecting the core functionality. They can also leverage existing Angular libraries and tools to enhance the storefront. Moreover, they can use micro frontends to split the storefront into smaller and independent modules that can be developed and deployed separately.
Progressive Web App (PWA)- The storefront is designed to be a PWA, which means it can provide a fast, reliable, and engaging user experience across different devices and platforms. Users can access the Spartacus PWA storefront offline, receive push notifications, and install it on their home screens.
Server-Side Rendering (SSR)- It supports SSR, which means it can render the initial page on the server side before sending it to the browser. This can improve the performance, SEO, and accessibility of the storefront.
Internationalization (i18n)- The storefront supports i18n, which means it can display content in different languages and formats based on the user’s preferences and location. The storefront uses Angular i18n tools to handle translations, currencies, dates, numbers, and units.
Open Source Development- The Composable Storefront is open source and hosted on SAP GitHub Spartacus, which means developers can contribute to the SAP Spartacus development, report issues, request features, and access SAP documentation. The storefront also follows the Semantic Versioning (SemVer) convention to ensure compatibility and stability.
SEO optimization- The storefront supports SEO optimization, which means it can improve the visibility and ranking of the storefront in search engines. Spartacus uses Angular Universal to generate static HTML pages for each route, which can be crawled and indexed by search engines. The storefront also uses schema.org markup to provide structured data for each page, which can enhance the appearance and relevance of the storefront in search results.
Accessibility- SAP Spartacus supports accessibility, which means it can provide a user-friendly and inclusive experience for all users, regardless of their abilities or disabilities. It follows the Web Content Accessibility Guidelines (WCAG) 2.1 to ensure that the storefront is perceivable, operable, understandable, and robust. Spartacus also uses ARIA (Accessible Rich Internet Applications) attributes to provide semantic information for screen readers and other assistive technologies.
Versatility- Like other SAP tools, SAP Commerce Cloud, Composable Storefront is versatile and allows customization for various industries including automotive, consumer goods, medical, chemical, industrial equipment, and retail industries.
If you are using an accelerator-based storefront on SAP Commerce Cloud, it’s a good idea to migrate to SAP Commerce Cloud, Composable Storefront from the accelerator-based storefront to align with the latest e-commerce trends and reap the above benefits.
What are the requirements and prerequisites for using SAP Spartacus or SAP Commerce Composable Storefront?
To use SAP Spartacus or SAP Commerce Composable Storefront, you need to have the following requirements and prerequisites:
SAP Commerce Cloud 2105 or newer- The latest release of SAP Commerce Cloud is recommended. Older versions of SAP Commerce Cloud do not support all the APIs and features that SAP Spartacus 4.3.8 or later will require.
CORS- You also need to enable CORS (Cross-Origin Resource Sharing) on your backend server to allow communication between the storefront and the API.
Angular CLI, Node.js, and npm- You need to have these tools installed and updated in your development environment to work with SAP Spartacus. You also need to install Angular Schematics for Spartacus to generate a new Angular project with Spartacus dependencies.
A code editor- You need to have a code editor that supports TypeScript, HTML, CSS, and Angular development. Some popular choices are Visual Studio Code, WebStorm, or Sublime Text.
A web browser- You must have a web browser that supports modern web standards and Spartacus PWA features. Some popular choices are Google Chrome, Mozilla Firefox, or Microsoft Edge.
How to install and set up SAP Spartacus or SAP Commerce Composable Storefront?
To install and set up SAP Spartacus or SAP Commerce Composable Storefront, you need to follow the below SAP Spartacus implementation process-
- Install and configure the Spartacus Sample Data Extension on your SAP Commerce Cloud instance. You can use the ImpEx scripts or the Commerce Cloud Portal to install the extension.
- Enable CORS (Cross-Origin Resource Sharing) on your SAP Commerce Cloud server. This allows the storefront to communicate with the Commerce REST API from a different origin.
- Configure the base URL for the storefront using Angular Schematics for Spartacus or the environment.ts file. This is the URL that points to your SAP Commerce Cloud server where the Commerce REST API is hosted.
- Create a new Angular project using Angular CLI: `ng new my-storefront –style=scss`
- Add Angular Schematics for Spartacus: `ng add @spartacus/schematics`
- Choose the options for your storefront, such as the base URL, the features, the styling, and the languages.
- Run the storefront using Angular CLI: `ng serve`
- Open your web browser and navigate to `http://localhost:4200`
- Check if the storefront is working properly and displaying the correct data and content using the browser’s developer tools or the SmartEdit tool.
- Integrate the storefront with all systems and then set up authentication to complete the process.
- Remember to customize the storefront appearance and functionalities and use the Spartacus Storefront Library to add more features and components.
How to customize and extend SAP Spartacus or SAP Commerce Composable Storefront?
To customize and extend SAP Spartacus or SAP Commerce Composable Storefront, you can use various techniques and methods, such as:
Angular Components- You can create your own Angular components or override the existing ones from Spartacus using Angular templates, styles, and logic. You can also use Angular directives, pipes, and services to enhance your components.
CMS Components- Create your own CMS components or override the existing ones from Spartacus using the SmartEdit tool or the ImpEx scripts. You can also use CMS attributes, slots, pages, and templates to configure your components.
Spartacus Outlets- Use Spartacus outlets to inject your own content or logic into specific places in the storefront without modifying the original components. You can also use outlet contexts to pass data or events between components.
Spartacus Configurations- Use Spartacus configurations to customize various aspects of the storefront, such as the routing, the authentication, the localization, the personalization, and the optimization. You can also use feature modules to enable or disable certain features.
Spartacus Styles- Apply Spartacus styles to customize the look and feel of the storefront using SCSS variables, mixins, and functions. You can also use Bootstrap utilities and themes to apply common styles.
What are the limitations and challenges of using SAP Spartacus or SAP Commerce Composable Storefront?
SAP Spartacus or SAP Commerce Composable Storefront is still under development and may not have all the features and functionalities that you need for your storefront. Some of the limitations and challenges that you may face are:
Feature gaps- Some features that are available in the traditional SAP Commerce Cloud Accelerator are not yet supported by Spartacus, such as personalization, promotions, loyalty programs, or B2B features. You may need to customize or extend Spartacus to meet your specific requirements.
Learning curve- Spartacus requires some knowledge and skills in Angular development, as well as familiarity with SAP Commerce Cloud APIs and concepts. You may need to invest some time and effort to learn and master these technologies.
Compatibility issues- The SAP Composable Storefront or Spartacus may not be compatible with some third-party integrations or extensions that are designed for the traditional SAP Commerce Cloud Accelerator. You may need to update or replace these integrations or extensions to work with Spartacus.
Performance issues- SAP Spartacus may have some performance issues due to its headless architecture, which relies on multiple API calls and data transfers between the front end and the back end. You may need to optimize your network configuration, caching strategy, and data modeling to improve the performance.
What are the best practices and tips for using SAP Spartacus or SAP Commerce Composable Storefront?
To use SAP Spartacus or SAP Commerce Composable Storefront effectively and efficiently, you can follow some best practices and tips, such as:
Stay updated- Keep track of the latest updates and releases of Spartacus on GitHub, as well as the official Spartacus documentation and blog posts. You can also join the community forums and webinars to learn from other developers and experts.
Follow the guidelines- Follow the coding standards, naming conventions, and design principles that are recommended by Spartacus. You can also use code analysis tools such as ESLint, Prettier, or SonarQube to ensure code quality and consistency.
Use feature flags- Use feature flags to enable or disable certain features in your storefront without affecting other features. This can help you test new features in different environments or scenarios before releasing them to production.
Use micro frontends- Use micro frontends to split your storefront into smaller and independent modules that can be developed and deployed separately. This can help you improve the scalability, maintainability, and reusability of your code.
Use web components- Use web components to create reusable UI elements that can be used across different frameworks and platforms. This can help you reduce dependencies, increase interoperability, and enhance the Spartacus user experience.
Use the SAP Repositories Management Portal- The SAP Repositories Management Portal is a web-based tool that helps you manage your SAP Commerce Cloud repositories, such as code, data, and media.
Conclusion
This guide has covered all aspects of SAP Spartacus, the game-changing headless storefront solution for SAP Commerce Cloud. For more details on effective SAP Spartacus implementation, you can also check out the official Spartacus documentation from SAP.
Now, if you’re looking to implement SAP Spartacus, Spadoom can be your guiding light. As an SAP Gold Partner with 6+ years of diverse experience, we’re your SAP customer experience heroes! Reach out to us now to implement or migrate to SAP Spartacus or SAP Commerce Cloud Composable Storefront.
Frequently Asked Questions
Is SAP Spartacus a CMS?
SAP Spartacus is not a CMS, but a JavaScript web application that allows you to create your own branded storefront for SAP Commerce Cloud. Spartacus uses the SAP Commerce Cloud CMS to render dynamic content and components but does not provide any CMS functionality.
What is the new name for SAP Spartacus?
SAP Spartacus has been renamed as SAP Commerce Cloud, Composable Storefront since version 5.03. This reflects the fact that Spartacus has become an official SAP product and the primary storefront for SAP Commerce Cloud and emphasizes the composable and modular nature of Spartacus.
Who uses SAP Spartacus?
SAP Spartacus is used by customers who want to leverage the benefits of a modern, headless, and API-driven storefront for SAP Commerce Cloud. It is perfect for all industries. Some examples of customers who use Spartacus are T-Mobile, Samsung, and Sonae MC5.
How can I customize and extend SAP Spartacus?
SAP Spartacus offers customization via Angular Schematics for components and CSS for appearance. Utilize its extensibility features like outlets, CMS components, and interceptors to modify its default behavior.
How can I connect SAP Spartacus to other systems besides SAP Commerce Cloud?
While Spartacus integrates with SAP Commerce Cloud, it can connect to other systems using custom connectors. Implement your connectors or use those from SAP or third parties.