A fundamental choice that developers must make when starting a JSS implementation is which workflow to use during development. Developers can choose between one of the following workflows:
We recommend that all JSS projects start code-first, even if the intent is to switch to Sitecore-first right after scaffolding the new app. Initializing projects from our code-first application samples and then importing them into Sitecore sets up the proper item structures in Sitecore.
We recommend that all projects switch to Sitecore-first as soon as possible, with the exception of apps built for client-side embedding. Multisite projects, in particular, have complex information architectures and therefore benefit the most from switching to the Sitecore-first workflow early on.
The previous recommendations apply fully when using JSS to build fully-fledged applications where the list of site definitions in Sitecore contains an entry that matches the JSS application name and JSS components are used across the entire website/application.
JSS applications that are embedded in a single page, whether MVC or SXA, can move away from the standard recommendations. In this use case, the JSS app is treated as a page component and does not need a site definition entry. Any front-end components built in the JSS app can only be used on the page where the app is embedded.
Based on feedback from our customers, embedded apps can successfully use the code-first workflow all the way to production. This is because all components and templates are scoped to a single page on the site, so complexities like templates inheritance and multisite considerations are not relevant. This allows front-end developers to have greater control over templates and even deviate from traditional Sitecore conventions, assuming that the authoring experience is not compromised.