Unfolding guide to setup JSS Next.js App in XM Cloud

 

In this guide, I will explain how you can setup your Next.js app in XM Cloud using XM Deploy App. The main motive is to reach at a point where we will be creating and using Components created using XM Cloud component builder and along with that Custom Component in Next.js app

Recently, I have configured a new site, which un-covered some key points we need to consider while site setup.https://portal.sitecorecloud.io/

Prerequisites

  1. You should have a XM Cloud account with Organization Admin or Organization Owner role access.
  2. A Valid Sitecore XM Cloud License.
  3. A Current and Compatible version of Node.js.
  4. A suitable Integrated Development Environment (IDE) such as Visual Studio Code.
  5. Github or Azure DevOps working account.
  6. Git installed, so handle push and pull.

Setup Site in XM Cloud

So lets begin step by step.

Step 1: Login into your XM Cloud portal and Click on XM Cloud Deploy

 Step 2: Click on Create Project

 Step 3: Give a name to your project, Do worry if you mis-spelled anything. You can edit later as well.

Step 4: Select where do you want to keep your repository which XM Cloud Deploy app will create it for you

Step 5: First time you have to login into your Git Account and allow permissions to XM Cloud. Later Deploy App will remember your account, so it’s a one time process

Step 6: It’s a very important Step as you are creating your first environment, You can name it Dev, Development or whatever but its better to give proper name.

I have selected Auto Deploy “Yes” which means when changes are merged into main branch, the Deploy App will initiate file deployment process automatically. Later I will show you how you can configure it listen to changes for Develop Branch instead of Main branch.

Step 7: Review and Start Deployment

Step 8:  Magic Begins

Step 9: In this step you will be redirected to new window, showing you the project creation progress.

Step 10: Completion and Lets Checkout XM Cloud Interface

 

Step 11: Once you click on XM Cloud it will ask you to select 2 options, either select the predefined Basic Template or Start from scratch. But lets stop here.

 

At this point I wanted to show you what happened till now.

Step 12: Checkout Github Repository

Goto your Github Account, Now you will see a new repository created with the name you have given to your project.

This repository is private and now you should clone it on your system. Off course you can clone it later as well, so I better leave on you.

Step 13: Creating Site

Lets create our Site now, I will try to explain more about Site collection and Site but for now lets continue. On step 11, we had left with an option to Select from scratch, so will choose that option.

In the above screenshot, you are creating a site but it is asking you to selected OR CREATE a collection.

So logic is, a site collection can contain multiple sites in it. It’s same like multi-site concepts. So my inputs were like below:

And click on create.

Step 14: Progressing…

Step 15: Checkout Newly created Site:

You can see, the site collection is created and under it my first Site named Company-A is also created.

Till now it’s a blank site, it donot have any components, no headers, nothing.

Step 16: Checkout Content Editor

Click on Content and select Content Editor.

Content editor will open in new tab, so we will come back on this page later.

Step 17: Better understanding of collection and site in Content Editor:

In above snapshot you can now relate to step 13. While you are in content editor you can checkout other items as well as this site is created based on Helix Architecture.

Step 18: Goto Page Builder

Go to previous already open tab and click on Page Builder option when you will hover on the site box.

This will open in new tab as well.

Step 19: Checkout NextJs App

If you remember, in Step 12, I told you to clone the repo, if not done then please clone the project now.

Create a new folder with same site name and open that folder in visual studio code. Mark that folder as trusted as Visual studio should ask you while opening that folder.

This is your main branch.

Step 20: Reviewing

Till now we have got our Next.js project repo, Site Content Editor, Site Page Builder Interface.

If you login back to portal.sitecorecloud.io, the you should see your site

 

Conclusion:

In this blog, I tried to lay the foundation of NextJs App in Sitecore XM Cloud instance. In next blog, I will try to explain how you can configure your NextJs App with XM Cloud.

Comments

Popular posts from this blog

Working with Device Detection Module in Sitecore

Setup A/B Testing in Sitecore - Part 1

Resolving: Failed to start service Sitecore Marketing Automation Engine Error