Start a JSS app in connected mode

Abstract

Develop locally against a running Sitecore instance

To develop a JSS application locally against a running Sitecore instance, you must start your JSS application in connected mode.

When running your JSS application in connected mode, the rendering of the application is performed by the browser.

The Sitecore databases hold the content, layout data, and component registrations, so you do not need to define mock data locally in the application. The application retrieves data from Sitecore through HTTP requests.

The following diagram shows how the HTTP requests to acquire Sitecore data.

HTTP data requests from a JSS app in connected mode.

Tip

All JSS applications created with a framework-specific SDK using the JSS CLI command jss create include a script in their package.json file to start the application in connected mode.

To start the application in connected mode:

  1. Follow the steps to connect and deploy your application to Sitecore.

  2. In a terminal, run the following script:

    jss start:connected

    The script starts the local development server.

    Note

    If you migrated from the code-first to the Sitecore-first development workflow and renamed the script jss start:connected, you must run the newly named script instead.

  3. In your browser, open http://localhost:3000 if it does not open automatically.

Note

If you are signed in to Sitecore in Experience Editor mode, running the JSS app in connected mode might result in extra code-like markup being delivered to your JSS application. If this happens, switch your site to Preview or Normal mode in Sitecore and the extra markup disappears.