Skip to main content

Transitioning from code-first to Sitecore-first

Abstract

When to switch to Sitecore-first and how to clean the JSS app of code-first artifacts

JSS applications created based on official application samples are set up to use the code-first workflow by default. In most cases, JSS apps transition from working with disconnected data and importing that into Sitecore to treating Sitecore as the main source of data.

In the code-first workflow, Sitecore templates and content are created in JavaScript by using the Manifest API.

The Manifest API is not a complete replica of everything that can be done with Sitecore items in Sitecore. If the front-end development team has hit a roadblock in the code-first workflow, it might be time to switch to the Sitecore-first workflow.

We recommend you to switch to using the Sitecore-first development when:

  • An app started its life as a code-first disconnected prototype and is transitioning to integrate with Sitecore.

  • App developers are more comfortable working in Sitecore than in JavaScript and prefer a familiar back end.

  • The import process is too limiting, and the app is transitioning to use Sitecore item serialization.

  • You want to create branch templates.

  • You want to add renderings to the layout of standard values items.

  • You want the ability to configure the Datasource Location field on components.

  • You want more control over the Layout Service response.

To transition to Sitecore-first development, you can simply avoid pushing import data to Sitecore.

However, following the decision to switch to Sitecore-first development, we recommend you remove code-first artifacts from the app to avoid clutter and prevent accidental deployment.

Working after removal

Once code-first artifacts have been removed from the app, you develop as before but without expecting any new items in Sitecore to come from the JSS application.

From this point onwards, you will most likely be working in connected mode, where your app is running locally but fetching data from a Sitecore instance that is available via HTTP(S).