Start a JSS app in disconnected mode
To develop a JSS application locally without access to a running Sitecore instance, you must start your JSS application in disconnected mode.
This procedure only applies to JSS applications that fetch data using the REST Layout and Dictionary services. You must follow a different procedure to start the application in disconnected mode when using GraphQL services.
Because you do not have access to a Sitecore instance, you must mock content data using local files using the YAML or JSON formats.
Running a JSS application in disconnected mode is advantageous when developers do not have access to a Sitecore instance, their primary expertise is in JavaScript, or when it would be undesirable for front-end developers to have their own Sitecore instance (technical or business limitations).
If you plan on working with a Next.js JSS application, you must include the nextjs-styleguide
add-on when you create the app. The add-on is responsible for adding the data
and sitecore/definitions
folders required for running the app in disconnected mode.
The following diagram shows the flow of requests from the application to the data files.
Developers can import applications developed in disconnected mode to Sitecore, creating all necessary Sitecore items for the applications to run in connected mode later.
A common development path might be for an application's lifecycle to begin in disconnected mode, and at later development stages transition to connected mode if the limitations of disconnected import need to be circumvented.
JSS applications include a script in their package.json
file to start the application in disconnected mode.
To start the application in disconnected mode:
-
In a terminal, navigate to your JSS application folder and run the following script:
RequestResponsejss start
The script starts the local development server.
-
In your browser, open
http://localhost:3000
if it does not open automatically.