- Getting started
Prerequisites
This topic describes what you need before you get started with the Cloud SDK and how to prepare your development environment.
Check that you have the following, before getting started:
-
Sitecore subscriptions, depending on your application requirements.
-
Node.js 18.17 or later. Check your installed version by using the
node --versioncommand. -
A Content SDK application based on the starter kit, or a JSS application based on one of the XM Cloud Front End Application Starter Kits. For JSS, the version of your JSS app determines which version of the Cloud SDK to use.
XM Cloud is now SitecoreAISome code examples, images, and UI labels may still use XM Cloud while engineering assets are being updated.
ImportantAlthough this documentation also describes using the Cloud SDK in a standalone Next.js application, you need a Content SDK or JSS app connected to SitecoreAI to use the SDK.
-
If you plan to use the Cloud SDK
searchpackage to build search experiences, create a support case in the Sitecore Cloud Portal to connect your Sitecore Search instance to your SitecoreAI environment. This is to ensure that your Context ID contains the search resource. You'll use the Context ID when you initialize the SDK.
sidebar. Compatibility with JSS
The Cloud SDK is compatible with all versions of the Content SDK, but not with all versions of the JSS.
The version of your JSS app determines which version of the Cloud SDK packages to install.
To make sure you install the correct version of Cloud SDK packages, check the version of the listed Cloud SDK dependencies in the package.json file of your JSS app. For example, the JSS 22.7.0 package.json file lists the Cloud SDK core package version 0.5.1 as a dependency:
In this case, make sure that all other Cloud SDK packages you install are also version 0.5.1. If you install a previous or later version of a Cloud SDK package, some functionality might not work.
Prepare your development environment
If you're using a Content SDK app based on the starter kit or a JSS app based on the XM Cloud Front End Application Starter Kits, with JSS version 21.6 or later, then your app is connected to SitecoreAI, and the Cloud SDK is already included in the nextjs, the nextjs-starter, and the spa-starters/angular apps, respectively.
Some code examples, images, and UI labels may still use XM Cloud while engineering assets are being updated.
To prepare your development environment:
-
Set up your local development environment as part of getting started with front-end development in SitecoreAI.
This involves setting environment variables in the
nextjs-starteror thespa-starters/angularapp, for example, your Context ID and site name. -
Install and initialize Cloud SDK packages in your app. All your development work with the Cloud SDK will take place in the
nextjs-starteror thespa-starters/angularapp.
Enable debug logs
During development, we recommend that you enable debug logs for the Cloud SDK. This helps you trace code execution and diagnose errors, speeding up your work with the SDK.
To enable logs:
- In your web browser, navigate to your app.
- In your web browser's developer tools, inĀ Local Storage, create a key called
debug. - For the
debugkey, setsitecore-cloudsdk:*as the value.
Logs related to browser-side SDK code will display in your web browser's developer tools, in the console.
To enable logs:
-
In your source code, in the file where you load environment variables, such as
.env, add the following key-value pair:
Logs related to server-side code will display in your terminal.