Wednesday, November 26, 2025

Bulk User Creation in Sitecore with Predefined Roles Using PowerShell (Inline Data - No CSV Needed)

 Hello Sitecorian Community! 👋

User onboarding is a routine task for any Sitecore administrator — but when the list grows beyond a handful of users, things start becoming slow, repetitive, and error-prone. A few days ago, I faced exactly this challenge while onboarding multiple content authors and admins across different departments.

Creating users manually via User Manager?

✔ Works

❌ Doesn’t scale

❌ Prone to mistakes

❌ Takes too much time

I wanted a clean automation approach — something quick, reliable, and without depending on CSV uploads, especially since many enterprises don’t allow file-based imports for security reasons.

So like always, PowerShell + SPE came to the rescue!

Let’s walk through the challenge and how I solved it.

Why Automate User Creation in Sitecore?

If you’ve ever created multiple users manually, you already know the pain:

  • Typing usernames and emails
  • Setting passwords
  • Assigning multiple roles
  • Making sure profile fields are correct
  • Repeating it for every single user

And just one mistake can lead to:

  • Wrong access levels
  • Incorrect roles
  • Broken workflows
  • Inconsistent naming

Automation helps you:

  • Save time
  • Maintain consistency
  • Avoid human errors
  • Create 10, 20, or 100 users in seconds
  • Ensure each user gets the correct predefined roles

Inline Data — No CSV, No External Dependency

In some organizations, importing CSV files is restricted due to compliance/security.

So I built this script to use inline PowerShell hashtables where user details are defined right inside the script.

It’s:

  • Self-contained
  • Easy to maintain
  • Easy to update
  • Perfect for DevOps teams
  • Ideal for one-time admin runs

Just open SPE → Paste the script → Run it.

PowerShell Script (Inline Users + Predefined Roles)

🔗 Script link placeholder (add your GitHub link):

https://github.com/gaurarun777/SitecorePowerShell/blob/main/Sitecore-BulkUserCreation.ps1

How This Script Helps

1. Faster Onboarding

Create 5, 50, or even 500 users in seconds — no repetitive clicking.

2. Guaranteed Consistency

Each user gets:

  • Correct roles
  • Correct password
  • Correct profile fields

Every time.

3. No CSV Upload Needed

All data sits inside the script.

Perfect for environments with strict security rules.

4. Human Errors Eliminated

No accidental typos.

No missed roles.

No duplicate users.

5. Reusable for Future Teams

Just update the user array and reuse the script anytime.

Conclusion

Bulk user creation doesn’t need to be painful.

With a simple PowerShell script and inline data, you can automate user onboarding in minutes — without relying on CSV files or manual entry.

This approach has already saved us hours of admin effort and ensures accuracy every single time.

I hope you enjoy this blog. Stay tuned for more Sitecore-related articles, tips, and tricks to enhance your Sitecore experience.

Till then, happy Sitecoring! 😊

Please leave your comments or share this article if it’s useful for you!

Automating Access Control in Sitecore: Granting, Revoking, or Denying Permissions on Multiple Nodes

 

Hello Sitecorian Community! 👋

If you’re managing a large Sitecore environment, you know the drill — setting permissions across hundreds (or even thousands) of content items can be incredibly time-consuming and prone to errors. Imagine having to manually update permissions for each item — it’s a tedious, repetitive task that steals valuable time and increases the risk of mistakes. And when something goes wrong, it can have serious security implications.

So, how do you automate this process? How can you ensure consistency, eliminate human error, and manage permissions at scale? Well, I’ve got a solution for you! In this blog post, I’ll walk you through a PowerShell script that makes managing permissions across multiple items a breeze.

The Problem: Manual Permissions Management in Sitecore

Managing user access and permissions is a key part of maintaining a secure Sitecore environment. But as your Sitecore instance grows, it can feel like you’re drowning in a sea of permission settings. Here’s why:

  • Granting Permissions: You need to make sure the right people or roles have access to the right content.
  • Revoking Permissions: When someone leaves a project or role, you must manually remove their access to sensitive content.
  • Denying Permissions: Sometimes, you need to deny access to specific roles, even overriding inheritance rules.

When you’re dealing with hundreds of content items, making these adjustments manually can become a nightmare.

Not to mention, a single mistake can lead to unauthorized access, potential data leaks, or just plain frustration. So, how can we fix this?

The Solution: Automating Access Control with PowerShell

Here’s where automation shines! By using PowerShell, we can automate the process of granting, revoking, and denying permissions for multiple items at once. This saves you a lot of time, reduces the risk of human error, and ensures consistent permissions across your Sitecore environment.

In this post, I’ll walk you through how the script works and how you can use it in your own Sitecore instance.

How the PowerShell Script Solves the Problem

The script works by applying permissions to multiple content items in a single operation. Whether you’re granting, revoking, or denying permissions, the script automates all of it with minimal input. Here’s how it addresses each of the challenges:

  1. Granting Permissions:
  • You can quickly assign read, write, delete, and other rights to a specific role for multiple nodes.
  • This can be done for all items in a folder, or even across the entire Sitecore tree.
  1. Revoking Permissions:
  • The script removes any explicit “Allow” or “Deny” permissions from items, making sure that old permissions don’t stick around longer than needed.
  1. Denying Permissions:
  • You can explicitly deny access, even overriding inheritance (which would normally propagate permissions from parent items).
  1. Database Flexibility:
  • The script allows you to select the Sitecore database (master, web, core) you want to work with, making it adaptable for different environments (e.g., live, staging).
  1. Inheritance Management:
  • You can control whether child items inherit permissions from their parent items or whether you want to break that inheritance and set custom permissions.

Key Features of the Script:

  • Grant, revoke, or deny permissions on multiple items.
  • Select the database (master, web, core) for changes.
  • Control inheritance for child items.
  • An interactive dialog for setting parameters (no need to modify the script every time).

The PowerShell Script: Let’s Take a Look

https://github.com/gaurarun777/SitecorePowerShell/blob/main/Sitecore-AccessControl-Automation.ps1

How to Use the Script

  1. Customize the Parameters:
  • Choose the database (master, web, core) where you want the changes to be applied.
  • Enter the role for which you want to set permissions.
  • Specify the item paths (one per line).
  • Select the permissions (Read, Write, Delete, etc.) and choose whether you want to grant, revoke, or deny them.
  1. Run the Script:
  • Execute the script in a PowerShell environment connected to your Sitecore instance. You’ll need administrative privileges to apply changes.
  1. Verify the Changes:
  • After running the script, verify that the permissions were updated as expected by checking the Access Control tab in Sitecore for the affected items.


Conclusion

Managing permissions across a large Sitecore instance no longer has to be a nightmare. With this PowerShell script, you can grant, revoke, or deny permissions in bulk — saving time, reducing the risk of errors, and maintaining consistency across your Sitecore environment.

Stay tuned for more Sitecore-related articles, tips, and tricks to enhance your Sitecore experience.

Till then, happy Sitecoring! 😊

Please leave your comments or share this article if it’s useful for you!


Monday, November 24, 2025

Blog 6: The Migration Journey from JSS to Sitecore Content SDK — A Developer’s Guide

Hello Sitecorian Community! 👋

Migrating from Sitecore JSS to the new Content SDK for XM Cloud is an important step for developers who want to simplify their workflows and reduce complexity in their applications. If you’re planning to make the switch, it’s crucial to understand the process and what to expect along the way. In this post, we’ll walk through the typical steps and challenges you’ll face during the migration journey from JSS to Content SDK.

Why Migrate to Sitecore Content SDK?

The release of Content SDK represents a significant change in how Sitecore handles headless development for XM Cloud. It is designed to replace JSS for Next.js projects, offering a more streamlined and simplified way to connect with Sitecore’s content delivery services.

For developers familiar with JSS, the migration may seem daunting at first. However, once you understand the changes in architecture and configuration, the benefits become clear. The Content SDK is more focused and optimized for XM Cloud, offering cleaner, leaner starter apps, fewer files, and fewer moving parts.

But before you dive into the migration process, there are a few key things to know about the Content SDK.

The Biggest Change — Goodbye Experience Editor

One of the biggest shifts when migrating from JSS to the Content SDK is the removal of the Experience Editor. Previously, the Experience Editor (EE) was a core feature of JSS, allowing developers and marketers to visually edit components and page content.

In the Content SDK, the Experience Editor is replaced by the XM Cloud Page Builder, which is now the primary tool for page customization. If your current JSS application relies on Experience Editor features (like edit frames or chrome rendering), you’ll need to rethink those workflows. While the transition may initially feel like a significant disruption, the Page Builder covers most of the functionality that Experience Editor provided, simplifying the overall setup.

Typical Steps in the Migration Journey

1. Update Dependencies and Clean Install

The first step in migrating your project is to update the dependencies. This involves replacing the JSS Next.js dependency with the new Content SDK version. Along with this, you’ll want to remove old CLI and development tool packages that are no longer supported in the Content SDK.

After updating dependencies, perform a clean install of your project. This helps clear out any outdated files and ensures you’re starting with a fresh environment.

2. Set Up a Template App

Once your project is cleaned up, the next step is to create a new Content SDK template app. This serves as a useful reference to help you understand how the new SDK is structured. You can compare this template app with your existing JSS app to see which files, folder structures, and configurations need to be updated.

3. Switch to New Configuration Files

In the Content SDK, there are new configuration files, notably sitecore.config.ts and sitecore.cli.config.ts, that replace the scattered config setup used in JSS.

  • sitecore.config.ts is now the main configuration file for build and runtime settings.
  • sitecore.cli.config.ts handles build tools and development commands.

It’s essential to copy these configuration files into your project and update your imports accordingly to ensure your app is aligned with the new structure.

4. Update Environment Variables

Content SDK introduces new naming conventions for environment variables. For instance, SITECORE_API_KEY now becomes NEXT_PUBLIC_SITECORE_API_KEY. These changes are important to ensure your app can still connect to the Sitecore backend properly.

Updating all relevant environment variables early on is key to avoiding connectivity issues later in the process.

5. Refactor Components and Imports

As you start migrating your app, you’ll notice that some components and interfaces have changed. For example, SitecoreContext is now replaced with SitecoreProvider, and several hooks and props have new names. While these updates are relatively straightforward, it’s important to systematically go through your codebase and make the necessary changes.

6. Remove Unused Files and Scripts

JSS apps often contain extra scripts for scaffolding, configuration, and build setup, which are no longer required in Content SDK. As you migrate, make sure to delete unnecessary scripts and folders to clean up the project and make it more manageable.

What’s Different in the New SDK?

When you start working with the Content SDK, there are a few key differences that will stand out:

  • Unified Data Fetching: Instead of relying on multiple services to fetch layout, dictionary data, and other content, the Content SDK uses a single SitecoreClient class to manage all data fetching. This simplifies the process and reduces the need for multiple data fetching plugins.
  • Simplified Middleware: The Content SDK introduces the defineMiddleware utility, which simplifies middleware handling and integrates it better with how Next.js works.
  • Cleaner Project Structure: The new SDK eliminates the need for temporary or generated configuration files, which were often a source of confusion in JSS. Instead, the configuration is more streamlined and centralized in a consistent way.

Challenges You May Encounter

While the migration process itself is not overwhelmingly complex, there are a few challenges developers typically face:

  • Learning the New Architecture: The Content SDK introduces new concepts, such as the SitecoreClient class and the defineMiddleware utility. It may take some time to get used to these changes, especially if you’re coming from a JSS background.
  • Removing Deprecated Features: Features like Experience Editor are no longer supported, which can be a challenge for teams who are heavily reliant on that functionality. Transitioning to the Page Builder may take time to adjust to, but it offers a more unified experience for content editing.
  • Refactoring Components: Updating component names, imports, and structure can be a bit tedious, especially in larger projects. However, this step is necessary to ensure that the app is compatible with the new SDK.

What You Need to Know Before You Start

If you’re preparing to migrate your app from JSS to Content SDK, here are a few things to keep in mind:

  1. Don’t Rush: Migrating from JSS isn’t something you can complete in one sitting. Take it step by step, ensuring that you update all the necessary dependencies and configurations along the way.
  2. Use the Content SDK Starter App: The new Content SDK template app is an invaluable resource. Compare it side by side with your JSS app to easily spot what needs updating.
  3. Test Thoroughly: After making the migration, test your application thoroughly to ensure that all content is loading correctly, and all features are working as expected.

Conclusion: A New Era for XM Cloud Development

Migrating from JSS to Content SDK is a manageable process that results in a more streamlined, simplified development workflow. With fewer files, more cohesive data fetching, and a cleaner project structure, the Content SDK is a major improvement for headless development on XM Cloud.

While there are changes to be made and new concepts to learn, the benefits of the Content SDK — including faster development and easier maintenance — make it worth the effort. Whether you’re starting a new project or migrating an existing one, the Content SDK is the future of Sitecore’s headless development platform.

I hope you enjoy this blog. Stay tuned for more Sitecore related articles.

Till that happy Sitecoring :)

Please leave your comments or share this article if it’s useful for you.

Tuesday, November 18, 2025

Blog 5: A New Era with Sitecore Content SDK — Farewell to JSS

Hello Sitecorian Community! 👋

In our previous blogs, we’ve covered the basics of the Sitecore Content SDK and how it compares to Sitecore JSS. Now, it’s time to dive deeper into what makes Sitecore Content SDK such an exciting shift for developers working with XM Cloud. If you’re already familiar with JSS, you’ll definitely want to know how the Content SDK takes headless content management to the next level. Let’s explore the future of Sitecore development!

What Exactly is Sitecore Content SDK?

At its core, Sitecore Content SDK is a set of tools and APIs designed specifically for XM Cloud to help developers connect seamlessly with their content, making it easier to build modern front-end applications. Whether you’re using Next.js, React, or Angular, the Content SDK provides a unified, simplified way to pull data and integrate it with your front-end.

Here’s why it’s a big deal:

  • Streamlined APIs: Fetch data from Sitecore more easily with fewer complexities.
  • Lightweight: Compared to JSS, Content SDK results in much smaller and simpler applications, reducing the maintenance burden.
  • Starter Templates: Kickstart your development quickly with ready-to-use templates tailored for Content SDK, ensuring you can focus on what matters most for your project.

In short, the Content SDK represents a leaner, more efficient way to develop headless applications on XM Cloud, putting you on the fast track to building faster and more maintainable solutions.

The Evolution: From JSS to Content SDK

To truly appreciate the Sitecore Content SDK, it helps to understand its evolution from the JSS SDK. JSS has been the go-to solution for headless applications in Sitecore for years, enabling developers to build decoupled, front-end apps that communicate with Sitecore via APIs.

However, the Content SDK takes a much more focused approach. Sitecore’s goal with the Content SDK is to simplify and optimize the development process, specifically for XM Cloud. This means removing unnecessary features and complexity, resulting in smaller, more focused applications that are easier to develop and maintain.

Key Differences Between JSS and Content SDK

If you’ve worked with JSS, you’ll immediately notice several major differences when transitioning to the Content SDK. Let’s take a closer look at what sets them apart:

Feature/Aspect

Sitecore JSS SDK

Sitecore Content SDK

Supported Products

Works with Sitecore XM/XP and XM Cloud

Exclusively for XM Cloud

Complexity & Size

Larger, more complex applications

Smaller, streamlined apps with less boilerplate

Visual Editing

Supports Experience Editor (EE) and XM Cloud Pages Builder

Only supports XM Cloud Pages Builder

Component Mapping

Automatically maps components for you

Manual mapping required, but can be auto-generated

Configuration Files

Multiple config files scattered around

Centralized configuration in sitecore.config.ts

Data Fetching

Several plugins for data fetching

Unified approach with the SitecoreClient class

Middleware Handling

Relies on separate plugin files

Simplified with defineMiddleware in Next.js

CLI Tooling

Traditional JSS CLI commands

New, optimized CLI commands in Content SDK

The Content SDK provides a reduced and focused footprint, making applications easier to understand and maintain. It’s designed to streamline the development process for XM Cloud, removing unnecessary features and focusing solely on what you need for cloud-based headless apps.

New Concepts and Tools in Content SDK

With the Content SDK, you get a few exciting new tools and concepts to make your development process smoother:

  • SitecoreClient Class: This new class offers a framework-agnostic way to interact with Sitecore’s headless APIs. It consolidates your data-fetching process into a single, easy-to-use interface.
  • CLI Tools: Content SDK introduces a new set of CLI commands, such as sitecore-tools project component scaffold, allowing you to easily generate components, configure your build process, and more.
  • Centralized Configuration: No more scattered configuration files — everything is now neatly organized into two primary configuration files, sitecore.config.ts and sitecore.cli.config.ts.
  • Middleware Handling: The new defineMiddleware function makes middleware composition simpler and more visible within Next.js, improving the way middleware is handled and executed.
  • Source: Sitecore Content SDK GitHub Repository

Pros and Cons of Sitecore Content SDK

As with any new technology, there are pros and cons to adopting the Sitecore Content SDK. Let’s break it down:

Pros

  • Reduced Size and Complexity: Applications are smaller, easier to maintain, and have better performance.
  • Seamless Integration with XM Cloud Pages: Content SDK integrates directly with XM Cloud Pages, making visual editing straightforward.
  • Unified Data Fetching: All content is retrieved through the SitecoreClient class, simplifying data access.
  • Modern, Efficient Workflow: Perfect for developers using modern JavaScript frameworks, with streamlined tools and integrations.

Cons

  • No Experience Editor Support: The shift to XM Cloud Pages means Experience Editor (EE) support is no longer available.
  • Migration Effort: Existing JSS applications will need to be updated to adopt Content SDK.
  • Learning Curve: Developers will need to familiarize themselves with new tools, like SitecoreClient and the new CLI commands.
  • Source: Sitecore Content SDK Pros and Cons

Conclusion: Embrace the Future with Sitecore Content SDK

The Sitecore Content SDK is the next big step for developers working with XM Cloud. With its simplified, streamlined architecture, improved tools, and smaller application footprint, it offers a much more efficient way to build headless applications. While there’s a learning curve and a migration path for existing JSS users, the benefits of easier maintenance, faster development, and seamless integration make it a worthwhile transition.

If you’re starting a new project or migrating from JSS, now is the perfect time to dive into the Sitecore Content SDK and experience the future of headless development with XM Cloud.

I hope you enjoy this blog. Stay tuned for more Sitecore related articles.

Till that happy Sitecoring :)

Please leave your comments or share this article if it’s useful for you.

Blog 4: Best Practices and Troubleshooting During Migration from JSS to Sitecore Content SDK

Hi Sitecorian Folks! 👋

Welcome to the fourth installment in our blog series on migrating from Sitecore JSS to the Sitecore Content SDK. By now, you’ve set up your Content SDK environment and completed the migration of your Next.js app. But as any developer knows, the migration process doesn’t always go smoothly on the first try. In this blog, we’ll cover best practices for ensuring a successful migration, along with common issues you may encounter and how to troubleshoot them.

Let’s dive into it!

1. Best Practices for a Smooth Migration

a) Start with a Small, Isolated Migration

Migrating an entire app at once can be overwhelming and risky. Instead, break the migration into smaller, isolated tasks:

  • Start with a test environment: Set up a clean instance of Sitecore Content SDK and migrate only a small portion of your app.
  • Migrate core components first: Begin by migrating the simplest, most foundational components such as content fetching logic and page layouts.

Why this works: A phased approach reduces risk and makes it easier to address problems as they arise.

b) Review and Adjust Sitecore Item Models Early

Sitecore Content SDK uses a more streamlined and developer-friendly content delivery model than JSS. Review your current Sitecore templates and item models before migrating:

  • Simplify complex models: Identify any overly complicated content structures and consider refactoring them to take full advantage of the SDK’s architecture.
  • Leverage Sitecore Experience Edge: For a unified content management experience, ensure your Sitecore instance is set up with Sitecore Experience Edge, which will simplify content delivery and reduce unnecessary complexity.

Why this works: Cleaning up content models ahead of time ensures your app will perform well and will be easy to maintain in the future.

c) Optimize Your Authentication Setup

The Sitecore Content SDK uses OAuth for authentication, which might differ from the authentication methods you were using in JSS (e.g., Forms Authentication). Here’s what you should do:

  • Update OAuth settings: Ensure your API authentication is properly configured with Sitecore’s OAuth flow.
  • Test authentication early: Try making API calls with your OAuth tokens to ensure the authentication process is smooth and secure.

Why this works: Updating your authentication setup early will help prevent authentication issues later on during content fetching or deployment.

2. Common Migration Issues and How to Troubleshoot Them

While the Sitecore Content SDK simplifies many processes, there are still some common issues developers encounter. Here’s how you can address them:

a) Incompatible API Calls

JSS applications often rely on specific API calls, such as GraphQL queries or Sitecore Web API endpoints. When migrating to the Sitecore Content SDK, these API calls will need to be refactored.

  • Solution: Identify where you’re using legacy API calls (e.g., GraphQL) and replace them with Content SDK’s simplified methods.

For instance, in the Content SDK, fetching content is done like this:

import { createClient } from '@sitecore/content-sdk';
const client = createClient({
endpoint: 'https://your-sitecore-instance-url',
apiKey: 'your-api-key'
});

async function getContent() {
const response = await client.fetch('homePage'); // Simple fetch
return response.data;
}

Why this happens: The Sitecore Content SDK provides its own methods for content fetching, which is different from how JSS accessed content.

b) Missing or Incorrect Content

After migration, you may notice that some content is missing or displayed incorrectly in your app. This can be caused by mismatched item models or outdated content structures.

  • Solution: Verify that your Sitecore item models are compatible with the Content SDK’s architecture. You may need to refactor some of your Sitecore templates or content models.

Also, ensure that you’re properly mapping content fields to their corresponding values in the Content SDK.

Why this happens: The Sitecore Content SDK relies on a different content model structure than JSS, so adjustments are often required.

c) Media Handling Issues

In JSS, you may have used custom GraphQL queries to fetch media. The Content SDK simplifies this, but there are still common pitfalls:

  • Solution: Use the new media fetching methods in the SDK. For example:
const getMediaItem = async (mediaId) => {
const response = await client.fetch(`media/${mediaId}`);
return response.data;
};

Ensure that all media paths and fields are correctly migrated and that URLs are properly formatted.

Why this happens: Media handling in the Sitecore Content SDK is different from JSS, and migrating these resources requires updating your code to use the SDK’s new media API.

d) Performance Bottlenecks

Even though the Sitecore Content SDK is optimized, migration may introduce performance issues if your code isn’t efficient.

  • Solution: After migration, profile your app’s performance using tools like Chrome DevTools or Sitecore’s built-in performance tools. Look for redundant API calls, inefficient data-fetching strategies, or overly complex queries that can slow down the application.

Why this happens: Migrations often introduce inefficiencies due to outdated code patterns or overlooked performance bottlenecks.

3. Testing and QA: Key Considerations

After completing the migration, rigorous testing is essential to ensure everything works as expected:

  • Test Across Environments: Run your app in both development and production environments. Ensure that your content is being delivered correctly and that there are no caching issues.
  • Automate Testing: Set up automated tests for content fetching, media handling, and rendering, especially for key components like homepages, product listings, or articles.
  • Monitor Logs and Errors: Check Sitecore logs and browser developer tools for any errors that may have been introduced during the migration. Log any issues for quicker troubleshooting.

Why this works: Thorough testing and debugging are key to a successful migration, ensuring all functionality works correctly across different environments.

Conclusion

Migrating from JSS to Sitecore Content SDK is a rewarding transition that brings long-term benefits in terms of performance, scalability, and maintainability. By following best practices, proactively troubleshooting issues, and conducting thorough testing, you can ensure a smooth migration experience.

In the next blog, we’ll dive into how to optimize your Sitecore Content SDK setup and fine-tune your app for the best performance post-migration.

I hope you enjoy this blog. Stay tuned for more Sitecore related articles.

Till that happy Sitecoring :)

Please leave your comments or share this article if it’s useful for you.

Monday, November 17, 2025

Blog 3: Hands-on Migration Walkthrough: Migrating Next.js from JSS to Sitecore Content SDK

Hi Sitecorian Folks! 👋

Welcome back to our hands-on migration series! In the last blog, we covered how to prepare your project for migrating from JSS to the Sitecore Content SDK. Now it’s time to get into the nitty-gritty details with a practical, step-by-step walkthrough of how to migrate a Next.js app to the Sitecore Content SDK.

By the end of this blog, you’ll be ready to start migrating your own Next.js apps with the Sitecore Content SDK. Let’s dive right in!

1. Setting Up Your Sitecore Content SDK Environment

Before diving into code migration, the first thing you’ll need to do is set up the Sitecore Content SDK in your development environment.

Step 1: Install Dependencies

For this migration, you’ll need to install the required packages for Next.js and the Sitecore Content SDK. The official Sitecore documentation provides instructions on how to integrate the SDK with your app.

# Create a new Next.js project (if you don't have one)
npx create-next-app sitecore-content-sdk-nextjs
cd sitecore-content-sdk-nextjs
# Install Sitecore Content SDK dependencies
npm install @sitecore/content-sdk @sitecore/nextjs

These packages enable seamless communication between your Next.js front-end and Sitecore’s headless APIs.

Step 2: Set Up Your Sitecore Instance

To work with the Content SDK, you’ll need a Sitecore instance, either on Sitecore XM Cloud or a self-hosted Sitecore solution. Here’s how to configure it for headless delivery:

  • Create a Sitecore Experience Edge for content delivery (this is necessary to access headless content through APIs).
  • Generate an API key from the Sitecore Experience Edge dashboard. This key will be used to authenticate API calls.

For more details on configuring Sitecore XM Cloud and Experience Edge, refer to the official Sitecore XM Cloud documentation.

Once you have the API key, you’ll configure the Content SDK to point to your Sitecore instance.

2. Migrating Content Fetching Logic

In JSS, content was often fetched using GraphQL queries or Sitecore Web API calls. The Sitecore Content SDK simplifies this process by using built-in API calls that are easier to integrate into modern front-end frameworks.

Here’s an example of how content fetching changes when migrating from JSS to Content SDK:

JSS Example (Before):

In JSS, you might have used GraphQL to fetch content:

query getHomePageData {
homePage {
title
description
featuredImage {
src
alt
}
}
}

Sitecore Content SDK Example (After):

With the Content SDK, fetching content is more direct and streamlined:

import { createClient } from '@sitecore/content-sdk';

const client = createClient({
endpoint: 'https://your-sitecore-instance-url',
apiKey: 'your-api-key'
});

async function getHomePageContent() {
const response = await client.fetch('homePage'); // Fetches the homepage data
return response.data;
}

export default async function HomePage() {
const content = await getHomePageContent();

return (
<div>
<h1>{content.title}</h1>
<p>{content.description}</p>
<img src={content.featuredImage.src} alt={content.featuredImage.alt} />
</div>

);
}

Key Sources:

3. Migrating Component Structure

In JSS, components were typically tied to Sitecore items, and you used JSS’s React components (or other framework-specific components) to fetch and render content. The Content SDK simplifies this structure by enabling direct API calls.

Here’s a practical migration of a Featured Article component:

JSS Example (Before):

import { graphql } from 'react-apollo';
import gql from 'graphql-tag';

const FeaturedArticle = ({ data }) => {
return (
<div>
<h2>{data.featuredArticle.title}</h2>
<p>{data.featuredArticle.content}</p>
</div>

);
};

const GET_FEATURED_ARTICLE = gql`
query getFeaturedArticle {
featuredArticle {
title
content
}
}
`
;
export default graphql(GET_FEATURED_ARTICLE)(FeaturedArticle);
Sitecore Content SDK Example (After):
import { createClient } from '@sitecore/content-sdk';
import { useState, useEffect } from 'react';

const client = createClient({
endpoint: 'https://your-sitecore-instance-url',
apiKey: 'your-api-key'
});

const FeaturedArticle = () => {
const [article, setArticle] = useState(null);

useEffect(() => {
async function fetchData() {
const response = await client.fetch('featuredArticle');
setArticle(response.data);
}

fetchData();
}, []);

if (!article) return <div>Loading...</div>;

return (
<div>
<h2>{article.title}</h2>
<p>{article.content}</p>
</div>

);
};

export default FeaturedArticle;

Key Sources:

4. Migrating Media Management

Media management is another important aspect when migrating from JSS to Content SDK. Sitecore’s media handling improves in the Content SDK, offering easier ways to manage and display media.

In JSS, you may have used GraphQL to fetch media data. With the Content SDK, media items can be easily accessed via the API:

JSS Example (Before):

query getMediaItem {
mediaItem(id: "12345") {
url
altText
}
}

Sitecore Content SDK Example (After):

const getMediaItem = async (mediaId) => {
const response = await client.fetch(`media/${mediaId}`);
return response.data;
};

const MediaComponent = ({ mediaId }) => {
const [media, setMedia] = useState(null);
useEffect(() => {
async function fetchMedia() {
const mediaData = await getMediaItem(mediaId);
setMedia(mediaData);
}
fetchMedia();
}, [mediaId]);
if (!media) return <div>Loading…</div>;
return <img src={media.url} alt={media.altText} />;
};

Key Sources:

5. Testing and Debugging

Once your migration is complete, it’s essential to thoroughly test and debug your Next.js app. Even though Sitecore Content SDK simplifies the process, here are a few best practices for testing:

  • Check for Missing Data: Ensure that all your content models and APIs are correctly integrated into your app.
  • Profile Performance: Although the Content SDK is optimized, make sure to profile your application using tools like Chrome DevTools to avoid performance bottlenecks.
  • QA Across Environments: Always test both in local development and production environments to ensure smooth content delivery.

For testing and debugging tips, refer to Sitecore’s best practices guide for headless applications.

Conclusion

That’s a wrap on our hands-on migration from JSS to Sitecore Content SDK! 🎉 We’ve walked through the essential steps of migrating your Next.js app, including setting up the SDK, migrating content fetching logic, simplifying components, and working with media management.

In our next blog, we’ll dive into best practices and troubleshooting tips to help you with any bumps along the way.

I hope you enjoy this blog. Stay tuned for more Sitecore related articles.

Till that happy Sitecoring :)

Please leave your comments or share this article if it’s useful for you.


Thursday, November 13, 2025

Blog 2: Preparing for Migration from JSS to Sitecore Content SDK

Hi Sitecorian Folks! 👋

Welcome back! In the last blog, we introduced the Sitecore Content SDK and discussed why it’s a better solution for headless content management compared to JSS. Now, it’s time to roll up our sleeves and talk about what needs to be done before you actually start migrating your projects.

Migrating from Sitecore JSS to the Content SDK may seem daunting at first, but with a clear plan in place, it can be a smooth transition. In this blog, we’ll walk through the key steps you should take to prepare for the migration.

1. Assess Your Current JSS Project

Before migrating, the first step is to assess your current setup and identify any potential issues that might arise during the transition. This will help you create a migration strategy and avoid surprises down the road.

Key things to assess:

  • API Integrations: Review how you’re fetching data in your JSS application. Are you using GraphQL, REST APIs, or Sitecore Web API? The Content SDK uses its own set of APIs, so you’ll need to identify where changes are needed.
  • Front-end Framework: Check which front-end framework (React, Angular, Vue, etc.) your app is using. The Sitecore Content SDK has built-in support for modern frameworks like Next.js and React, but you’ll need to adjust your setup accordingly.
  • Sitecore Item Models: Take a look at the way your Sitecore items are structured. The Content SDK uses a more streamlined and developer-friendly model for content delivery, so you may need to adjust your content structure for optimal performance.
  • Media Management: If your app uses media items, make sure you’re ready to switch over to the new content delivery mechanisms.

2. Understand the Core Differences in Architecture

The architecture of Sitecore Content SDK is more streamlined than JSS, and understanding the differences will make your migration smoother. Here’s what you need to know:

  • Content Delivery: The Content SDK relies on headless delivery via RESTful APIs rather than embedding content directly in the app, which was often done in JSS via API calls to Sitecore.

Action Item: If you were using custom data-fetching logic in JSS, you’ll need to replace this with the Content SDK’s simplified API structure.

  • Authentication and Authorization: JSS apps often relied on Sitecore’s Forms Authentication or custom OAuth configurations. The Content SDK uses OAuth to authenticate API calls in a more modern and secure way.

Action Item: Ensure your authentication system is compatible with OAuth-based access tokens used in the Content SDK.

  • Deployment: JSS apps often had separate deployments for the back-end and front-end. With the Content SDK, the deployment process is more unified, as Sitecore XM Cloud is used for both content management and content delivery.

Action Item: Review your current deployment setup and plan how you’ll integrate the front-end and back-end deployments under the new Sitecore architecture.

3. Plan the Migration Timeline

Moving from JSS to the Content SDK doesn’t need to be an overnight project. In fact, it’s a good idea to break down the migration into manageable phases.

Here’s how you can approach it:

  • Phase 1: Setup and Testing: Set up a clean environment for your Content SDK app. This can be done in parallel with your existing JSS setup to minimize downtime.
  • Install the necessary dependencies for the Content SDK and choose the front-end framework (Next.js, React, etc.).
  • Create a small test project to familiarize yourself with the new structure and API calls.
  • Phase 2: Migrate Core Components: Begin migrating critical features and components over to the Content SDK. You can start with less complex elements (e.g., page layouts, media items, or simple Sitecore items).
  • Action Item: Focus on the main components that are essential for the content delivery in your app.
  • Phase 3: Full Migration: Once the core components are migrated, start moving over the remaining parts of the app. This is when you’ll want to fully switch over to the Content SDK and test every part of the application.
  • Phase 4: QA and Optimization: After the migration, run through rigorous QA testing to ensure everything works as expected. Optimize your content fetching, API calls, and front-end rendering for performance.

4. Identify and Mitigate Potential Migration Issues

As with any migration, there will be challenges along the way. Here are some common issues developers face when migrating from JSS to the Content SDK — and how to handle them:

  • Incompatible API Calls: The Content SDK introduces new API structures that are different from JSS. If your app relies heavily on JSS-specific API calls (like graphql), you’ll need to refactor your code to work with the SDK’s APIs.

Solution: Identify all places where you’re calling APIs directly in your code and plan to replace them with the SDK’s native methods.

  • Content Model Mismatches: Sitecore’s content models may need to be updated to take full advantage of the Content SDK’s enhanced features.

Solution: Review your Sitecore templates, fields, and content models to ensure they’re compatible with the Content SDK’s streamlined architecture. Consider redesigning models for better performance.

  • Authentication Changes: If you’re using custom authentication mechanisms with JSS, you’ll need to ensure they’re compatible with the Content SDK’s OAuth-based system.

Solution: Check your authentication settings and switch to the Content SDK’s OAuth-based authentication if needed.

  • Performance Bottlenecks: Even though the Content SDK offers improved performance, you may encounter issues if your code isn’t optimized.

Solution: After migration, take the time to profile your application’s performance. Look for redundant API calls or inefficient data-fetching strategies and optimize them.

5. Documentation and Resources to Help You Along the Way

Before diving into the actual migration, here are some helpful resources:

  • Sitecore Content SDK Documentation: Always the best place to start for official guidelines and best practices.
  • Migration Guides: Look for migration-specific documentation from Sitecore to ensure you’re following the right steps.
  • Developer Forums: Sitecore’s community forums, Stack Overflow, and GitHub repositories can be invaluable for troubleshooting common issues.

Conclusion

With the right preparation, migrating from JSS to the Sitecore Content SDK doesn’t have to be a major challenge. By carefully assessing your current setup, understanding the architectural differences, and planning your migration in phases, you can make the transition smoother and more efficient.

In the next blog, we’ll dive deeper into the step-by-step migration process, including hands-on examples for migrating your Next.js app from JSS to the Content SDK. Stay tuned!

I hope you enjoy this blog. Stay tuned for more Sitecore related articles.

Till that happy Sitecoring :)

Please leave your comments or share this article if it’s useful for you.


🚀 Blog 1: Introduction to Sitecore Content SDK

Hi Sitecorian Folks! 👋

Welcome to the first post in our blog series about migrating from Sitecore JSS to the new Sitecore Content SDK. If you’ve been working with Sitecore for any length of time, you’re probably already familiar with JSS (JavaScript Services). It was a great tool for building headless applications, but Sitecore is moving forward, and with that comes the Sitecore Content SDK.

In this post, we’ll walk through why JSS needed to be replaced and how the Content Blog 1: Introduction to Sitecore Content SDK SDK solves the challenges that developers face today. So let’s dive right into it!

The Problem with JSS (and Why We Needed a Change)

If you’ve worked with JSS, you know the drill. Building headless apps with Sitecore required multiple moving parts:

  • Complex API Configurations: You had to juggle multiple APIs (GraphQL, Web API) to fetch data from Sitecore and integrate it into your front-end framework.
  • Separate Deployment: Your front-end app (React, Angular, etc.) needed to be deployed separately from Sitecore’s back-end, adding an extra layer of complexity to the delivery pipeline.
  • Slow Performance: Over time, managing multiple systems for content delivery could lead to performance bottlenecks, making the overall development experience less efficient.

The takeaway: It wasn’t that JSS was a bad tool — it did its job well. However, as modern web development evolved, Sitecore recognized there was a better, more unified way to manage headless content.

Why Sitecore Content SDK Became the Solution

Enter Sitecore Content SDK. This new toolkit solves the pain points that JSS couldn’t fully address. Let’s break down how the Content SDK is a game-changer for developers:

Challenge in JSS

Solution with Content SDK

1. Complex Content Fetching

Simplified Content Fetching: Introduces built-in methods to pull content directly with modern, easier-to-consume APIs.

2. Fragmented Architecture

Unified Architecture: Built-in support for headless content delivery that integrates directly into Sitecore XM Cloud, simplifying development and deployment.

3. Performance Bottlenecks

Performance Improvements: Optimized content access and reduced unnecessary API calls ensure faster loading and more efficient content delivery.

4. Extra Configuration per Framework

Better Developer Tools: Includes official templates and integrations specifically for popular frameworks like Next.js and React, providing a faster start.

Key Features of the Sitecore Content SDK

The Sitecore Content SDK isn’t just a replacement for JSS; it’s a major upgrade. Here are the features that make it stand out:

  • Pre-built Integrations: Out-of-the-box support for popular frameworks (Next.js, React) to get you started quickly.
  • Modern API Design: Cleaner, more intuitive RESTful APIs for fetching and managing content from Sitecore.
  • Built-in Support for Sitecore Experience Edge: A unified API for content delivery and management that significantly reduces complexity.
  • Improved Authentication: Simplified OAuth-based authentication for secure API access.

What Does This Mean for Developers?

The Sitecore Content SDK means developers can work faster and more efficiently with modern JavaScript frameworks. It reduces setup time, improves performance, and offers an easier, more maintainable approach to building headless applications.

If you’ve been working with Sitecore for a while, this is exciting news. The shift to the Content SDK gives us the flexibility to work with the tools we love, while Sitecore manages the complexity behind the scenes.

What’s Next?

That’s a wrap for this introduction to Sitecore Content SDK. In our next blog, we’ll dive into the preparations you need to make before migrating your existing JSS projects to the Content SDK. We’ll talk about how to assess your current setup and what steps you can take to ensure a smooth transition.

I hope you enjoy this blog. Stay tuned for more Sitecore related articles.

Till that happy Sitecoring :)

Please leave your comments or share this article if it’s useful for you.