- Install Sitecore 10.3 XP0 on local machine
Link sitecore 10.3XPO :-
Sitecore Downloads
- Install Powersehll Extensions on your local Sitecore instance
- Install Sitecore Headless Services for Sitecore XP on your local Sitecore instance Sitecore Headless Rendering 21.0.0
Install SXA module
Sitecore Experience Accelerator on your local Sitecore instance
See the Sitecore Experience Accelerator 10.3.0 dowload page
Once you have the above installed the local instance should have options to create a Headless Tenant and Folder
Create a Headless Tenant and Folder
Ensure all the search index and rebuilt
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-murmu-software-infotech.png)
Install Node js Download | Node.js (nodejs.org). Latest whilst writing this blog was v18.14.0
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-1.png)
Should create a tenant successfully
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-murmu-software-infotech-2.png)
Now create a Headless Site
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore2.png)
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore3.png)
Select the modules to install
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-5.png)
Keep the Site settings as is for now and will generate the deployment secret later
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore5.png)
Click the ok button
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-7.png)
Site should be crated within the tenant
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-8.png)
Setup the rendering host :-
Site Settings – Check for the rendering host- should have set to Default
/sitecore/content/mycompany/retail/Settings/Site Grouping/retail
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-9-1024x231.png)
Find the Default rendering host on this location-
/sitecore/system/Settings/Services/Rendering Hosts/Default
Server side rendering engine endpoint URL:-
http://localhost:3000/api/editing/render
Server side rendering engine application URL:-
Application name:- e.g :- demoheadless
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore7-1024x229.png)
Where is the above value coming from – when a next js app is created by default it is hosted on port 3000. Please see section below- NEXT STEPS
Create JSS Api key : –
/sitecore/system/Settings/Services/API Keys
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore11-1024x301.png)
Set the CORS and Allowed Controllers to all domains. Set this to *
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-12.png)
Install JSS globally : –
Link install globally CLI: –
Sitecore CLI page link
open PowerShell in Admin mode:- and run below command
npm install -g @sitecore-jss/sitecore-jss-cli
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-13.png)
Initialise JSS App:-
Make sure App name is same
Use following command-
npx create-sitecore-jss –templates nextjs,nextjs-sxa –appName demoheadless –hostName demosc.dev.local –fetchWith GraphQL
Possible values for templates arguments-
Base templates– nextjs. Other possible values-
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-14.png)
Other templates
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-15.png)
appName – enter the app name provided in the rendering host. See Setup the rendering host section
hostname– enter the hostname of the Sitecore instance
Where would you like your new app created? – provide the location to create a next jss app
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-16-1024x101.png)
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-17-1024x121.png)
How would you like to prerender your application? – Select SSG
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-18-1024x99.png)
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-19.png)
Following files will be created in a new folder (demoheadless) –
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-20.png)
Setup JSS App : –
Run this command:- jss setup
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-21.png)
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-22.png)
Enter yes
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-22-1.png)
Path to the Sitecore folder :- C:\inetpub\wwwroot\demosc.dev.local
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-23.png)
Sitecore hostname:-
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-24.png)
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-25.png)
Api key: –
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-26.png)
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-27.png)
Finally create your next js App
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-28.png)
Open your app in vs code
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-29.png)
NEXT STEPS : –
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-30-1024x532.png)
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-31-1024x448.png)
This path past in vs code below location
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-32-1024x336.png)
This is your JSS_EDITING_SECRET key :-
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-33-1024x326.png)
Next steps: –
Go to .env fills
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-34-1024x334.png)
Thean run jss deploy config
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-36.png)
Note the config was deployed to C:\inetpub\wwwroot\XP103.sc\App_Config\Include\zzz folder in the Sitecore instance
Start your App this command : jss start:connected
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-37.png)
Application should listen to http://localhost:3000
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-38-1024x235.png)
Give the Error:-
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-39.png)
Then run this command : – $env:NODE_TLS_REJECT_UNAUTHORIZED=0
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-40.png)
After run this cammnd app restart : –
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-41.png)
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-42.png)
Lets add some content, for this open the Home page in experience editor and see this error-
Error- Connection to your rendering host failed with an Unauthorized error. Ensure the JSS Editing Secret is configured.
Update the JSS Editing Secret in Sitecore instance at following path (best practice-you have to patch the config instead of updating the Sitecore configs directly)
App_Config\Sitecore\JavaScriptServices\Sitecore.JavaScriptServices.ViewEngine.Http.config
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-43-1024x451.png)
Open this file in notepad++
Update the value to the deployment secret used earlier in .env file-
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-46-1024x245.png)
And past here API-SECRET:-
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore45-1.png)
After update-
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-47-1024x472.png)
Layout Services–
Lets check if the layout services are accessible-
Get Item data (home) and secret key-
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-48-1024x473.png)
Graphql–
https://demosc.dev.local/sitecore/api/graph/edge/ui?sc_apikey={A1B5B260-FC74-412D-936B-20EFC751F4D7}
![](https://sitecoredevservices.com/wp-content/uploads/2023/06/sitecore-murmu-software-infotech-3.png)