Upgrade JSS 22.0 Next.js apps to Content SDK 2.1
Content SDK is a major upgrade from previous versions of Sitecore JavaScript Services SDK (JSS) for SitecoreAI. It reduces the size and complexity of starter applications, removing redundant functionality not needed for SitecoreAI implementations. As a result, Content SDK applications are easier to understand and maintain than apps built with JSS.
This comprehensive guide covers all the changes you must make to your existing JSS 22.0 applications to migrate to Content SDK 2.1. However, because of the nature of JavaScript and Next.js application development, this guide doesn't account for all the customization you might have in your existing application.
While upgrading, consider the JSS templates and add-ons you used when creating your Next.js JSS application. You can find them in your package.json file. For example, a JSS 22.0 application based on the XM Cloud starter kit uses the following templates and add-ons, so this guide assumes your app includes all of them:
-
nextjs
-
nextjs-xmcloud
-
nextjs-sxa
-
nextjs-multisite
Some code examples, images, and UI labels may still use XM Cloud while engineering assets are being updated.
-
If you haven't already done so, upgrade your app to JSS 22.0.0.
-
We recommend you read the official release notes for React 19 and Next.js 16 to understand what has changed in these new versions.
-
Familiarize yourself with the JSS and Content SDK changelogs. If your application is heavily customized, the changelog can provide guidance on what additional changes you need that are not covered in this topic.
This topic covers the following subjects:
What's new in Content SDK?
Here's a short overview of the changes introduced in Content SDK:
-
Includes out-of-the-box support for the Design Studio that serves as a centralized interface to help teams visualize and test components across their organization.
-
Three brand new site templates in addition to the classic Skatepark template.
-
A new file,
sitecore.config.ts, serves as the central point for configuring your application's build and run time. -
Another new file,
sitecore.cli.config.ts, used to configure CLI commands for Content SDK that enable it to replace build-time and dev tools scripts. -
The new Sitecore Client Data Fetching API, represented by the
SitecoreClientclass, unifies all data fetching logic and replaces the previous data fetching plugins. -
A new utility named
defineProxy(previously called defineMiddleware in Content SDK version 1.5 and earlier), simplifies proxy composition and provides better visibility by removing the need for proxy plugins. -
Supports the enhanced SitecoreAI page builder in place of the Sitecore Experience Editor.
-
Analytics, event tracking, and personalization support out of the box.
Update application dependencies through all versions
For your upgraded application to work correctly, you will need to update dependencies.
To update your dependencies:
-
In your existing application's
package.jsonfile, update packages progressively:-
Remove any dependencies that start with
@sitecore-cloudsdk/and add the following:NoteSee the Cloud SDK integration section for further steps to complete the migration from
@sitecore-cloudsdkto the Content SDK packages. -
Update
@types/nodeto version^24.10.4. -
Update
@typescript-eslint/eslint-pluginto version^8.14.0. -
Update
@typescript-eslint/parserto version^8.14.0. -
Update
eslintto version^8.56.0. In Content SDK 1.1 and higher, ESLint 9 is the default linter, but you can continue using the older one or optionally upgrade to ESLint 9. -
Update
typescriptto version~5.4.0. -
Install
[email protected]for improved memory usage using the following command: -
Update React and Next.js:
-
Update
@sitecore-feaas/clientsideto version^0.6.0. -
Update
@sitecore/componentsto version~2.1.0. -
Replace
@sitecore-jss/sitecore-jss-nextjswith@sitecore-content-sdk/nextjs. Set the version to^2.0.0. -
Replace all references to
@sitecore-jss/sitecore-jss-nextjswith@sitecore-content-sdk/nextjsthroughout your application. -
Replace
@sitecore-jss/sitecore-jss-cliwith@sitecore-content-sdk/cli. Set the version to^2.0.0. -
Delete
@sitecore-jss/sitecore-jss-dev-tools.
-
-
Install dependencies with the following command:
-
Update your ESLint configuration by making the following changes to the
.eslintrcfile: -
Make the following changes to
tsconfig.json:-
Add above the
libentry: -
Delete the following from
compilerOptions.paths:
-
Create a Content SDK 2.1 application
To simplify the upgrade process as much as possible, create a Content SDK application. You can then copy some files from this template app into your existing app.
To create a Next.js Content SDK application:
-
In a console, run the following command:
-
If prompted to install the
[email protected]package, answery. -
Enter the folder path for the new app. For example, enter
./content-sdk-template, to create the named subfolder in your current working directory. -
When prompted, choose the same prerendering method (
SSGorSSR) as used in your existing JSS application.
The script then installs the application dependencies.
Update the SXA add-on
The Content SDK template has a lean footprint. It doesn’t have components that were previously available in the JSS starter kit. To use those components, the recommended approach is to copy them from Content SDK starter kit. Note that if you’ve customized your components in JSS, you must replicate them in the Content SDK versions too.
To update the SXA add-on:
-
Replace the following files with the new versions from the starter kit:
-
src/components/Image.tsx -
src/components/Promo.tsx -
src/components/Title.tsx -
src/assets/sass/components/title/_component-title.scss
-
-
Update the following SASS files:
-
src/assets/sass/components/_component-column-splitter.scss: -
In
/src/assets/sass/components/promo/_promo-shadow.scss, reposition CSS statements above the@include respond-to(all-mobile)block:
-
Disable automatic GraphQL code generation
To disable automatic GraphQL code generation:
-
Remove the following dependencies from
package.json: -
Remove the
graphql:updatescript and removegraphql-letreference frombootstrapscript: -
Delete the following files:
-
.graphql-let.yml -
/scripts/fetch-graphql-introspection-data.ts -
/src/temp/GraphQLIntrospectionResult.json
-
Update existing forms to use the new wrapper
To update existing forms:
-
In Content Editor, select the page containing the existing form.
-
Click Presentation > Details.
-
In the Final Layout tab, click Edit under Headless Layout.
-
Select the BYOC Wrapper control and click Change.
-
Select Feature > Headless Experience Accelerator > Forms > Form and click Select.
-
Click Edit.
-
Copy the
formIdfrom the Component Name parameter (only the value after?formId=). -
Paste it into the FormId field at the top.
-
Delete all items in the Parameters section.
-
Click OK.
-
Repeat for all forms.
When all forms are updated, remove the following from /src/byoc/index.client.tsx:
Migrate to Content SDK architecture
The following sections explain how to synchronize files in your existing JSS application with corresponding files from your Content SDK template app. This also includes steps to complete the Next.js 16 upgrade, Cloud SDK integration, React 19 refactor, and update other template files.
Update configurations and environment variables
This section updates your existing app's configurations and environment variables to match the new Content SDK app.
To update your JSS app's configurations and environment variables:
-
Copy the following files from the template app into your existing app:
-
sitecore.config.ts -
src/Providers.tsx -
src/Bootstrap.tsx
-
-
Throughout your app, replace all imports of
configfromtemp/configand use the newsitecore.config.tsfile instead:-
Locate all instances of the following:
-
Replace these with the following:
-
-
A new
pageparameter has been added toSitecoreContext. To support this change, update theSitecoreContextAPI configuration in the following files:-
[[...path]].tsx -
500.tsx -
404.tsx
In each file, set the
apiparameter to usescConfig.apiand thepageparameter to usepageas shown in the following example: -
-
Rename the following environment variables within your JSS app:
Old (JSS)
New (Content SDK)
SITECORE_API_KEYNEXT_PUBLIC_SITECORE_API_KEYSITECORE_API_HOSTNEXT_PUBLIC_SITECORE_API_HOSTSITECORE_SITE_NAMENEXT_PUBLIC_DEFAULT_SITE_NAMEDEFAULT_LANGUAGENEXT_PUBLIC_DEFAULT_LANGUAGEJSS_EDITING_SECRETSITECORE_EDITING_SECRET -
If your application currently depends on
SITECORE_EDGE_URL, remove all instances ofSITECORE_EDGE_URLfrom env files and deployment configurations. Set the following new variable(s) to the same value and restart the app. Rebuild for Next.js so thatNEXT_PUBLIC_*is in the client bundle.-
NEXT_PUBLIC_SITECORE_EDGE_PLATFORM_HOSTNAME- for Next.js projects so both server and client use the custom host. -
SITECORE_EDGE_PLATFORM_HOSTNAME- non Next.js or server only
If you have explicitly configured
edgeUrlinsitecore.config, set it to the following:For non‑Next.js environments, mirror this pattern with the
SITECORE_EDGE_PLATFORM_HOSTNAMEvariable instead.NoteNewly scaffolded apps use
defineConfig()and getedgeUrlfrom the new environment variable automatically, so you might not have theedgeUrlsection under edge.The default value of
<https://edge-platform.sitecorecloud.io>is used unless you use the new variables.SITECORE_EDGE_CONTEXT_IDdoes not need to be renamed unless you need client-side access.If needed, create
NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_IDwith the same value. Doing this will expose your context ID secret on the client. -
-
If your existing app uses
DISABLE_SSG_FETCHrename it toGENERATE_STATIC_PATHS.NoteThe meaning and value of this variable has been logically inverted. If your existing solution uses this variable in the code, you must adjust them accordingly.
-
Copy the
src/lib/sitecore-client.tsfile from your template app into the same folder in your existing JSS app. -
Middleware has been renamed to proxy in Next.js 16 to better reflect its purpose. Instead of Next.js discovering middleware automatically by filename, it now runs the
proxy.tsfile directly. Refactor all Next.js middleware in your existing app to use the newdefineProxyutility:-
Create
src/proxy.ts. Add your proxy logic here. The file must export a single function (default export or named proxy) that accepts aNextRequestand returns the result of the proxy chain as shown: -
Ensure that your proxy order is correct:
-
For Next.js apps using App Router - locale → multisite → redirects → personalize
-
For Next.js apps using Pages Router - multisite → redirects → personalize
-
NoteEnsure you delete
src/proxy.tsand the oldsrc/lib/middleware/(or equivalent) before addingsrc/middleware.tswithdefineMiddleware, using the template as reference. -
-
Individual API route files (for sitemap, robots, editing endpoints, health) still use the
Middlewareclasses to implement their actual behavior for those specific routes. Theproxy.tsfile only handles edge requests and routing behavior.Item
Description
For sitemap and robots.txt
Use
SitemapMiddlewareorRobotsMiddlewarefrom@sitecore-content-sdk/nextjs/middlewareEditing APIs
Use
EditingConfigMiddleware,EditingRenderMiddleware, orFEAASRenderMiddlewarefrom@sitecore-content-sdk/nextjs/editingHealthcheck
Use the
HealthcheckMiddlewarefrom@sitecore-content-sdk/nextjs/monitoring -
In
[[..path]].tsx,404.tsx,500.tsx, andLayout.tsx, remove all usages ofheadLinks.
Cloud SDK integration
The Content SDK has undergone a major architectural transformation to include functionality from the Cloud SDK. The Content SDK now includes tracking, events, and personalization.
To enable these changes:
-
In
Bootstrap.tsx:-
Find the CloudSDK initialization logic:
-
Replace it with the following:
-
Remove the following imports:
-
Add the following imports:
-
-
In
CdpPageView.tsx:-
Find the following import:
-
Replace it with the following:
-
You might also have to make further changes to other files that contains older Cloud SDK logic based on your implementation. See Initializing tracking, events, and personalization in the Content SDK for more information.
Refactor aligned with React 19 best practices
React logic in the Content SDK has been refactored to follow React 19 best practices. The following section outlines the breaking changes introduced by this refactor and provides examples of the new implementations.
-
The
@sitecore-content-sdk/reactpackage introduces the following updated types and signatures:-
useSitecore(options?: UseSitecoreOptions): SitecoreProviderState -
SitecoreProviderStatenow includes:-
page: Page -
api?: SitecoreProviderProps['api'] -
setPage?: (value: Page) => void (renamed from updatePage) -
componentMap: ComponentMap (new) -
loadImportMap: () => Promise<ImportMapImport> (new)
-
-
PlaceholderPropsis expanded to explicitly list all supported properties:
These updates make the context shape and placeholder behavior explicit and compatible with React 19 best practices, especially for server and client components. The additional fields (
componentMap,loadImportMap) support more flexible composition and lazy loading. To update your code:-
Review all imports and usages of
SitecoreProviderStateandPlaceholderProps. -
If you relied on implicit properties, update your type annotations to the new explicit interface.
-
If you used
updatePage, rename it tosetPage. -
If you previously inferred types from usage, consider importing the updated types from
@sitecore-content-sdk/reactto align with 2.1.
No runtime changes are required in this step beyond adjusting renamed fields.
-
-
The
withPlaceholderhigher-order component now only accepts the component as an argument and injects a placeholders prop derived fromprops.rendering.placeholders.-
Find implementations of a single placeholder:
-
Replace it with the following:
ImportantWhen rendering the wrapper on a server component in Next.js App Router while using
withAppPlaceholder, you must still pass therendering,page, andcomponentMapprops: -
If you rely on a multi-placeholder mapping as shown:
-
Convert it as shown:
-
-
The
withSitecorehigher-order component is deprecated. The recommended alternative is theuseSitecorehook.To update your code, find the current implementation:
Replace it with the following:
NoteIf you continue using
withSitecore, theupdatePageprop it previously injected is now namedsetPage. -
PlaceholderandAppPlaceholderare stricter and now pass only the following props to the components rendered for a placeholder:-
Context properties (
page,componentMap) -
fields,paramsandrenderingdataThe
modifyComponentPropscallback is still available, but it should not be required for simple prop injection. For example, the following usage:Can be streamlined using
passThroughComponentPropsas shown:
-
-
All built-in Content SDK components that previously relied on
React.forwardRef(such asRichText,Link, and others) now treatrefas a regular prop instead of usingforwardRef. This change follows React 19 recommendations best practices.ImportantPlease refer to the official React 19 upgrade guide to update other parts of your application that's not specific to the Content SDK.
-
The
SitecoreProvidercomponent now requires theloadImportMapprop. Update theSitecoreProviderimplementation as shown: -
The
DesignLibrarycomponent no longer receives an import map as a prop. Instead, it is provided by theSitecoreProvidercomponent. For Content SDK apps based on Pages Router, theDesignLibrarycomponent is present insrc/Layout.tsxand must be updated: -
The
renderEmptyPlaceholdermethod from thePlaceholderclass has been removed.If your implementation relies on that method for custom placeholders, you can use the
renderEmptyPlaceholderhelper method exported fromreactandnextjspackages. -
By disabling React Suspense in placeholders, components render faster without the added Suspense overhead. However, if your app uses lazy-loaded components inside a
<Placeholder>and expects a loading fallback to appear, you need to perform the following steps while upgrading:-
Audit
<Placeholder> usages where dynamic or lazy components are rendered. -
Add
disableSuspense={false}to any placeholder that depends on Suspense-based loading states.
-
Refactor components and interfaces
This section refactors all components, interfaces, and other files to match the new Content SDK app's structure.
To refactor your files:
-
Copy the new component
src/components/content-sdk/SitecoreStyles.tsxfrom your template app into the same folder in your existing JSS app. -
In
Layout.tsx, importSitecoreStylesand place the component afterScripts, as shown in the following example: -
Throughout your JSS app, remove all usages of the
publicUrlproperty of the now-obsolete config. -
Update references and imports for the following component, interfaces, higher-order components, and properties:
Old
New
Type
SitecoreContextSitecoreProvidercomponent
SitecoreContextPropsSitecoreProviderPropsinterface
SitecoreContextStateSitecoreProviderStateinterface
SitecoreContextReactContextSitecoreProviderReactContextinterface
WithSitecoreContextOptionsWithSitecoreOptionsinterface
WithSitecoreContextPropsWithSitecorePropsinterface
WithSitecoreContextHocPropsWithSitecoreHocPropsinterface
useSitecoreContext()useSitecore()HOC
withSitecoreContext()withSitecore()HOC
contextpageproperty
updateSitecoreContextupdatePageproperty
sitecoreContextpageproperty
NoteThe
withSitecorehigher-order component is deprecated. The recommended alternative is theuseSitecorehook. -
Remove the
SitecoreContextinterface and update any references with the newPageinterface from theSitecoreClient. -
Update references to the
getServerSidePropsandgetStaticPropsmethods togetComponentServerPropswithout changing the existing method signature.If your component contains code that's executed based on static or server side Next.js context, import the
isServerSidePropsContexthelper method and implement it based on the following example: -
Update references and imports for the following services if you use them directly or substitute them by using the methods in the
SitecoreClientclass:Old
New
Type
RestComponentLayoutServiceComponentLayoutServiceservice class
RestComponentLayoutServiceConfigComponentLayoutServiceConfiginterface
GraphQLEditingServiceEditingServiceservice class
GraphQLEditingServiceConfigEditingServiceConfiginterface
GraphQLDictionaryServiceDictionaryServiceservice class
GraphQLDictionaryServiceConfigDictionaryServiceConfiginterface
GraphQLLayoutServiceLayoutServiceservice class
GraphQLLayoutServiceConfigLayoutServiceConfiginterface
GraphQLPersonalizeServicePersonalizeServiceservice class
GraphQLPersonalizeServiceConfigPersonalizeServiceConfigtype
GraphQLErrorPagesServiceErrorPagesServiceservice class
GraphQLErrorPagesServiceConfigErrorPagesServiceConfiginterface
GraphQLRedirectsServiceRedirectsServiceservice class
GraphQLRedirectsServiceConfigRedirectsServiceConfigtype
GraphQLRobotsServiceRobotsServiceservice class
GraphQLRobotsServiceConfigRobotsServiceConfigtype
GraphQLSiteInfoServiceSiteInfoServiceservice class
GraphQLSiteInfoServiceConfigSiteInfoServiceConfigtype
GraphQLSitemapXmlServiceSitemapXmlServiceservice class
GraphQLSitemapXmlServiceConfigSitemapXmlServiceConfigtype
GraphQLSitePathServiceSitePathServiceservice class
GraphQLSitePathServiceConfigSitePathServiceConfiginterface
-
Delete the
DictionaryServiceinterface and remove any references to it. -
Update the
src/lib/component-props/index.tsfile in your existing app using the one from your template app. -
Throughout your app, wherever is used, do the following:
-
Update imports of
componentBuilderto usecomponentsinstead, as shown in the following example: -
Within
<SitecoreProvider>, replace usages of thecomponentFactoryprop to usecomponentsinstead, as shown in the following example:
-
-
Update any remaining imports of
temp/componentBuilderto use.sitecore/component-mapinstead. -
The
@sitecore-content-sdk/contentpackage has been decoupled from@sitecore-content-sdk/coreto create a more focused "core" that can be referenced by other packages. The following changes are only required if you directly import from@sitecore-content-sdk/core.-
The following submodules have been moved from
@sitecore-content-sdk/coreto@sitecore-content-sdk/content:Item
Old path
New path
client@sitecore-content-sdk/core/client@sitecore-content-sdk/content/clientcodegen@sitecore-content-sdk/core/codegen@sitecore-content-sdk/content/codegenconfig-cli@sitecore-content-sdk/core/config-cli@sitecore-content-sdk/content/config-cliconfig@sitecore-content-sdk/core/config@sitecore-content-sdk/content/configediting@sitecore-content-sdk/core/editing@sitecore-content-sdk/content/editingi18n@sitecore-content-sdk/core/i18n@sitecore-content-sdk/content/i18nlayout@sitecore-content-sdk/core/layout@sitecore-content-sdk/content/layoutmedia@sitecore-content-sdk/core/media@sitecore-content-sdk/content/mediapersonalize@sitecore-content-sdk/core/personalize@sitecore-content-sdk/content/personalizesite@sitecore-content-sdk/core/site@sitecore-content-sdk/content/siteUpdate all references to the old paths with the new ones.
-
All exports from the utils submodule are now available from the tools submodule. Update all references to the
@sitecore-content-sdk/core/utilssubmodule and replace it with@sitecore-content-sdk/core/tools. -
The following types and functions have been moved from
@sitecore-content-sdk/coreto@sitecore-content-sdk/content:Item
Old path
New path
HTMLLinktype@sitecore-content-sdk/core@sitecore-content-sdk/contentStaticPathtype@sitecore-content-sdk/core@sitecore-content-sdk/contentdefineConfig@sitecore-content-sdk/core@sitecore-content-sdk/contentform@sitecore-content-sdk/core@sitecore-content-sdk/contentUpdate all references to the old paths with the new ones.
-
The following tools have been moved from
@sitecore-content-sdk/core/toolsto@sitecore-content-sdk/content/tools:Item
Old path
New path
generateSites@sitecore-content-sdk/core/tools@sitecore-content-sdk/content/toolsGenerateSitesConfig@sitecore-content-sdk/core/tools@sitecore-content-sdk/content/toolsGenerateMapFunction@sitecore-content-sdk/core/tools@sitecore-content-sdk/content/toolsGenerateMapArgs@sitecore-content-sdk/core/tools@sitecore-content-sdk/content/toolsextractFiles@sitecore-content-sdk/core/tools@sitecore-content-sdk/content/toolswriteImportMap@sitecore-content-sdk/core/tools@sitecore-content-sdk/content/toolsWriteImportMapArgs@sitecore-content-sdk/core/tools@sitecore-content-sdk/content/toolsUpdate all references to the old paths with the new ones.
-
The following utilities and types have been removed from
@sitecore-content-sdk/core/toolsas they are no longer relevant or unused:Item
Description
generatePluginsNo longer relevant
PluginDefinitionNo longer relevant
ModuleTypeNo longer relevant
tryParseEnvValueUnused utility
isAbsoluteUrlUnused utility
-
The default SXA rewrite logic has been changed to align with Next.js best practices for locale and to support the optional Shall language be preserved upon redirect? checkbox introduced in the Redirect Rules section in SitecoreAI. For example, earlier, when en is set as the default locale, URLs that do not specify a locale (like /my-page) resolves to that default locale. With this change, the same rule results in a redirect without the default locale if no locale is present. To continue using it as before, you must enable the Shall language be preserved upon redirect?.
Finalize build process and cleanup
This section contains changes related to the build process and finalizes the upgrade process.
To edit the build process and clean up your project:
-
In your
package.jsonfile, do the following:-
Remove the
start:watch-componentsandbootstrapscripts and all mentions of these two scripts from the remaining scripts. -
Remove the
jssscript. -
Remove the
install-pre-push-hookscript. -
Remove the
scaffoldscript. -
Update the
buildscript with the following: -
Update the
lintscript by removing linting for thescriptfolder: -
(Optional) Add the following scripts, for dynamically generating the component map and building the Content SDK app:
-
Rename the
start:connectedscript todevand replace it with the following: -
Rename the
start:productiontostartand replace it with the following:
-
-
Copy the
sitecore.cli.config.tsfile from your template app into your existing app.-
Previously, all functions in the
buildarray of thedefineCliConfigoptions object accepted ascConfigproperty in theiroptionsobject. This property is no longer required and is provided internally during build time. For example, the previous implementation forwriteImportMapcontained thescConfigproperty as shown: -
The rest of the configuration remains the same after removing the property:
-
-
Because the build time artifacts
metadata.jsonandsites.json(the second of which used to be calledconfig.sites) are now created under the.sitecoretemp folder at the root of the app, you need to update the imports of these artifacts accordingly throughout your application, making sure to rename instances ofconfig.sitestosites.json. -
Content SDK introduces the
sitecore-tools:buildcommand that, similar tonext:build, is used to generate build-time artifacts required for your app to function. Make sure this script is executed before you start your application. -
In your existing app's
next.config.jsfile, make the following changes:-
Migrate all Next config plugin logic (previously located in the
src/lib/next-configfolder) and all associated custom settings into thenext.config.jsfile, then delete the now-redundant files from thelibfolder. -
Replace the existing
defaultLocaleproperty with the following:
-
-
Next.js 16 expects you to define allowable external image sources using
remotePatternsinstead ofimages.domains. Remove all entries ofimages.domainsand setremotePatternsto allow Sitecore media URLs. Refer to the template app'snext.config.js|tsfile for more information. -
The Page type now includes a
modefield of typePageMode, that provides runtime context (editing, preview, the Design Studio, etc). Update references to layout context properties likepageState,pageEditing, andrenderingTypewith the newpage.modefield as shown in the examples below:-
If the rendering mode
isDesignLibrary, find the following:Replace with:
-
If the rendering mode
isNormal, find the following:Replace with:
-
Similarly, if the rendering mode
isEditingorisPreview, update them to use the following:
-
-
If you've customized your existing JSS app, refer to the obsolete JSS functionality section and make all changes necessary to refactor your code and then remove the obsolete parts of your app, such as:
-
Using appropriate data fetching functionality provided by
scClient. Use your Sitecore Content SDK template app as a reference. -
Replacing imports of
SitecorePagePropsto use"@sitecore-content-sdk/nextjs"instead of"lib/page-props". For example:
-
In their unaltered forms, the following files provided by the Next.js starter kit will need to be updated:
-
src/pages/api/robots.ts -
src/pages/api/sitemap.ts -
src/pages/[[...path]].tsx -
src/pages/404.tsx -
src/pages/500.tsx -
src/Bootstrap.tsx -
src/_app.tsx
Obsolete and revised functionality in your existing app
Some parts of existing JSS apps are either revised or no longer required in Content SDK apps, meaning they can be removed. However, if your app contains custom code that uses any of this obsolete functionality, or if you have any customizations in the affected files or folders, you will need to modify your app accordingly.
After you've finished refactoring, you can remove any obsolete parts to reduce the overall size of your app:
-
The
scripts/configfolder, which contains the plugins that JSS used to generate the runtime config under thesrc/tempfolder. All of this has been replaced bysitecore.config.ts, and a config file is no longer generated at build time. -
The
scripts/scaffold-componentfolder, which contains the script for thejss scaffold componentcommand. This is now replaced by a new CLI commandsitecore-tools scaffold. -
The
scripts/templatesfolder, which contains the templates JSS used for scaffolding components. This is now replaced by the new CLI configurationsitecore.cli.config.ts. -
The
scripts/generate-config.tsscript that generated the runtime config file. This is now replaced bysitecore.config.ts. -
The
scripts/generate-metadata.tsscript that generated themetadata.jsonrequired for editing integration. This is now replaced by thegenerateMetadata()function insitecore.cli.config.tswhich is executed by the new CLI commandsitecore-tools build. -
The
scripts/generate-component-builderscript, which generated the component builder that manages registration of components. This is now replaced bycomponent-map. -
The
scripts/generate-plugins.tsscript is no longer required. -
The
scripts/bootstrap.tsscript that handled running build-time scripts. This is now replaced by the CLI andsitecore.cli.config.ts. -
The
scripts/utils.tsfile that stores utilities for scripts is no longer used. -
If you've already disabled graphQL code generation for your JSS app, the
/scriptsfolder and thetsconfig.scripts.jsonfile are no longer needed. -
The
src/lib/page-props-factoryplugins that created contextualSitecorePagePropsobjects. This is now replaced by the functions ofSitecoreClient. -
src/lib/site-resolver, which is now replaced byscClient.resolveSite(). -
src/lib/extract-path, which must now be imported from@sitecore-content-sdk/nextjs/utils. -
src/lib/sitemap-fetcher, which is now replacedscClient.getSiteMap(). -
src/lib/middleware. All proxy (previously called middleware) is now defined inproxy.tsand executed using thedefineProxyutility function. -
src/lib/next-config. All Next.js config settings are now consolidated innextj.config.js. -
The
src/lib/config.tstype, which defined runtime config, is now replaced bysitecore.config.ts. The following services are now incorporated intoSitecoreClient. If your solution includes customization of any of these services, you need to extendSitecoreClientand override any services that need to be extended:-
src/lib/graphql-client-factory -
src/lib/dictionary-service-factory.ts -
src/lib/layout-service-factory.ts -
src/lib/graphql-editing-service.ts
-
-
The
src/lib/page-props.tstype that definedSitecorePagePropshas been moved to the base@sitecore-content-sdk/nextjspackage, and must now be imported from there instead.
Removal of Experience Editor
Unlike JSS for SitecoreAI, Content SDK doesn't support the Experience Editor tool and, for that reason, doesn't include the chromes-based integration required by Experience Editor. Instead, all visual editing with Content SDK is done with the SitecoreAI page builder using metadata integration.
When migrating to Content SDK, Content Editor Preview is not supported. Content SDK removes all Experience Editor–based rendering and preview capabilities, including preview functionality accessed from the Content Editor. Preview and editing are supported only through Page Builder.
The following packages have been updated for Content SDK in relation to removal of Experience Editor support. Familiarize yourself with the updates and note any breaking changes this might introduce to your application so you can address them during the upgrade process:
sitecore-jss
-
Now present under
sitecore-content-sdk/corepackage. -
Removed the
HtmlElementRenderinginterface, meaning onlyComponentRenderinginterface is now used. -
field.editableis no longer available. Instead,field.metadatais used for edit mode. -
Removed the
EditMode.Chromesenum value. -
LayoutServiceContextno longer exposeseditMode. -
Renamed the
HorizonEditorutility class toPagesEditor. -
Removed the
ExperienceEditorutility class. -
Removed the
handleEditorAnchorsutility. -
Removed all
EditFrameutilities, including:-
DefaultEditFrameButton -
DefaultEditFrameButtons -
DefaultEditFrameButtonIds -
EditFrameDataSource -
ChromeCommand -
FieldEditButton -
WebEditButton -
EditButtonTypes -
mapButtonToCommand
-
sitecore-jss-react
-
Now present under the
reactpackage. -
Removed Chromes mode support.
-
Removed the
HtmlElementRenderinginterface. -
Removed the
EditFramePropsinterface and theEditFramecomponent. -
Updated
PlaceholderCommon.getPlaceholderDataFromRenderingDatato acceptisEditing(boolean) instead ofeditMode: -
All field components now reference
field.metadatainstead offield.editable.
sitecore-jss-nextjs
-
Now present under
sitecore-content-sdk/nextjs. -
Removed Chromes mode support.
-
Removed the
getPublicUrlfunction. -
Removed the
EditFramecomponent. -
Removed the
HtmlElementRenderinginterface. -
Removed the following services and middlewares:
-
EditingDataCache,EditingDataDiskCache, andEditingData. -
EditingDataMiddlewareandEditingDataMiddlewareConfig. -
EditingDataService. -
ServerlessEditingDataServiceandServerlessEditingDataServiceConfig. -
VercelEditingDataCache. -
The
editingDataServiceinstance.
-
-
EditingConfigMiddlewareno longer acceptsconfig.pagesEditMode. -
All field components now reference
field.metadatainstead offield.editable.
templates/next.js
-
Edit mode updates:
-
Removed exact checks for EditMode.Metadata.
-
Removed the editing data API router api/editing/data/[key].ts.
-
-
General configuration updates:
-
Removed
config.publicUrlusage. -
Removed the
PUBLIC_URLenvironment variable. -
Removed the
nextConfig.assetPrefixsetting. -
Removed the
nextConfig.env.PUBLIC_URLenvironment variable. -
Removed Next.js rewrites for the following:
-
Sitecore API Endpoints:
/sitecore/api/:path* -
Media items:
/-/:path* -
Sitecore service pages:
/sitecore/service/:path*
-
-
Next steps
To finalize the upgrade process, make sure you resolve any errors and warnings you encounter. Enable debug logging for Content SDK specific issues to assist you if necessary.