Get the latest Sitecore JavaScript Rendering SDK (JSS) app locally with Next.js

Featured-Create-JSS-NextJs-App

The Sitecore JavaScript Rendering SDK (JSS) represents a set of JavaScript packages and sample apps that add support for JavaScript frameworks and permit the development of modern-day apps that devour Sitecore data.

The “JavaScript frameworks” noted above encompass Vue, React, React Native, Angular, and Next.js. Next.js is a framework constructed on the pinnacle of React. Its objectives are to assist developers in creating production-geared-up apps with minimum want for configuration and boilerplate code.

Getting the JSS app locally

1. Install JSS CLI globally using the below command.

npm install -g @sitecore-jss/sitecore-jss-cli

2. You can validate your installation using one of the below commands.

jss --help
jss --version

3. Creating JSS application based on Next.js template.

Once you have your JSS CLI installed you can navigate to the folder of your choice ( eg: c:\workspace\jssdemo ) and run the below command. The below command goes through multi-level questions which you can choose from PowerShell and you must be seeing the latest version of JSS installed.

npm init sitecore-jss nextjs
jss-installation-snapshot

4. Once it’s installed, you can navigate to the folder which in my case is ‘nextjs’ and you can either use jss setup to connect with your installed Sitecore or run the application in disconnected mode using jss start

If you want to create a JSS app for an older version of Sitecore using JSS CLI, follow the steps below:

  • First downgrade your JSS CLI version, for example with the above steps we installed v20 of JSS CLI.
    npm install -g @sitecore-jss/sitecore-jss-cli@19.0.0
  • Use the below command to create an app with branch param included (The Below command is strictly not supported with V20)
    jss create jss-next-local nextjs --branch release/19.0.0

For more parameters that the “create” command supports and to see more examples for create command using the previous version of JSS, you can visit the documentation here.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *