JSS vs SXA: Choosing the Best Sitecore Approach
When it comes to Sitecore, two of the most talked about features in recent years have, without a doubt, been JSS and SXA.
But what are JSS and SXA? How are they different and what are the strengths, weaknesses, and use cases for each? Let’s take a look at what each one offers, how each fits into a Sitecore application, and when it makes sense to pull the trigger and utilize one.
What is JSS?
Sitecore JavaScript Services (JSS) is billed by Sitecore as “a complete SDK for JavaScript developers that enables you to build full-fledged solutions using Sitecore and modern JavaScript UI libraries and frameworks.”
But beyond the tagline, what does JSS actually do? The main benefit of JSS is that it allows for the development of headless applications that utilize JavaScript frameworks, such as React, React Native, Angular, or Vue.
While using these frameworks and creating headless applications was possible before the introduction of JSS, JSS empowers these architectures, while maintaining the full set of content creation and personalization tools available within Sitecore.
This means that an application can now take full advantage of modern rendering approaches, like Server-Side Rendering with Rehydration (SSR) or Full Client Side Rendering (CSR), and still maintain support for Sitecore features for multilingual applications, advanced analytics, personalization, and the Experience Editor.
No longer is there a forced compromise on one technology for the sake of the other. This allows for more advanced, performant, and dynamic solutions for complex applications, while not giving up the standard benefits of Sitecore.
In addition to supporting JavaScript frameworks and multiple rendering modes, JSS supports new development workflows as well. Using the “Code-First” workflow, JSS apps can now be developed without any Sitecore instance present. This allows front-end developers to build JavaScript applications using mock data and a manifest file that is then imported into Sitecore, speeding up development efforts and bringing the focus to the front end and user experience.
What is SXA?
Sitecore Experience Accelerator (SXA) is a Sitecore accelerator that speeds up the production of websites and allows for the reuse of components, layouts, and templates across sites.
The key word when it comes to SXA is “accelerator.” Although the focus of JSS is on enabling modern technologies, frameworks, and architectures within Sitecore, the primary focus of SXA is speed of development.
SXA does this in a handful of ways, including drag-and-drop “reusable renderings,” built-in support for multiple grid systems, and pre-baked themes. The drag-and-drop reusable renderings are pre-built components (HTML, CSS, and JavaScript included) and cover a wide range of options. There are renderings available for text, images, videos, and social media plugins — with the goal being less overall development time on standard components. As far as the grid systems are concerned, by default, SXA comes with three different options to choose from: Bootstrap, Foundation, and Grid 960.
In addition to reusable renderings and grid systems, SXA includes the concept of pluggable themes. Themes act as a starting point and an easy way to style and skin an application and are set up to inherit from base themes, as well as being extensible. SXA also provides accelerators for page designs and partial designs, sharing pages between sites in the same tenant, data modeling, and asset optimization.
The best option: one, both, or neither?
So, what’s the best option for a Sitecore application? As with anything, the short answer is: it depends.
JSS and SXA clearly serve different purposes and aren’t necessarily mutually exclusive. While JSS is not yet fully implemented within SXA, in the newest releases JSS is supported through SXA site management. The big missing parts of functionality when using both together are the SXA toolbox, drag-and-drop components, and themes.
That said, JSS and SXA can be used together without those missing features, or they can simply coexist on the same Sitecore instance, as separate sites.
So, it isn’t necessarily an either/or question, but more a question of which to use when. Both JSS and SXA have their own strengths, weaknesses, and use cases. When looking to make a choice, the best bet is to assess an application’s needs against those items.
When it comes to JSS, its biggest strength is that is provides headless-architecture capabilities and seamless integration with modern JavaScript frameworks, while maintaining support for many of Sitecore’s most important features. While it may not be a good fit for low complexity or static websites — where things like React and SSR are often overkill — JSS is a perfect fit for highly dynamic applications.
On the SXA end, the biggest strength and most prominent use case is when speed to market is the most important aspect of an application. The pre-existing components and rapid-development workflow can be a huge benefit in these cases.
However, while the component library can increase development speed, using it definitely has drawbacks. As with most pre-existing component libraries and grid systems, the tradeoff for the increased development speed is design, accessibility, and performance limitations. While SXA is built in a way that makes it customizable — and many of the limitations can be overcome — many of the speed benefits also start to disappear when a large portion of the components require custom development work.
This brings SXA’s use case back to the same question: is speed to market paramount? Or does the application in question have additional customization, accessibility, design, and performance considerations that need to be accounted for? The answer to that question is going to vary from application to application, but as the list of customization grows, a custom-design system and component library may begin to make more sense than drag-and-drop renderings.
Summing it up
Like with any development tool, neither JSS nor SXA is a magic bullet or one-size-fits-all solution. It would be a mistake to treat either one that way. Making an objective assessment when it comes time to pull one or the other out of the toolbox is the only smart choice.
At the end of the day, because JSS and SXA both have strengths, weaknesses, and individual use cases, it’s best to assess the needs, complexity, and requirements of the application being designed and choose the right tool for the job.