1. Getting started

Prerequisites

Version:

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 --version command.

  • 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 SitecoreAI

    Some code examples, images, and UI labels may still use XM Cloud while engineering assets are being updated.

    Important

    Although 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 search package 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:

"@sitecore-cloudsdk/core": "^0.5.1"

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.

XM Cloud is now SitecoreAI

Some code examples, images, and UI labels may still use XM Cloud while engineering assets are being updated.

To prepare your development environment:

  1. 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-starter or the spa-starters/angular app, for example, your Context ID and site name.

  2. Install and initialize Cloud SDK packages in your app. All your development work with the Cloud SDK will take place in the nextjs-starter or the spa-starters/angular app.

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:

  1. In your web browser, navigate to your app.
  2. In your web browser's developer tools, inĀ Local Storage, create a key called debug.
  3. For the debug key, set sitecore-cloudsdk:* as the value.
Note

Logs related to browser-side SDK code will display in your web browser's developer tools, in the console.

If you have suggestions for improving this article, let us know!