1. Deploying SitecoreAI

App Configuration API

The App Configuration API enables developers to configure the necessary settings to:

You can add configuration patches for your JSS application in your Sitecore instance by renaming and editing the \App_Config\Sitecore\JavaScriptServices\Sitecore.JavaScriptServices.ExampleApp.config.example file.

Alternatively, for JSS applications based on official templates, you can include the necessary <app /> configuration in the /sitecore/config directory of the application's source code.

You must add the patches in the <apps> node of the <javaScriptServices> configuration node.

App Configuration API example

A minimal configuration contains the following required attributes:

  • name
  • sitecorePath
  • inherits

For example:

xml
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <javaScriptServices>
      <apps>
        <app name="exampleApp"
             sitecorePath="/sitecore/content/ExampleApp"
             inherits="defaults"
        />
      </apps>
    </javaScriptServices>
  </sitecore>
</configuration>

App Configuration API attributes

The following table lists the available App Configuration attributes and their default values.

In the \App_Config\Sitecore\JavaScriptServices\Sitecore.JavaScriptServices.Apps.config file, in the defaults configuration patch, you can inspect any default values for some of the available attributes.

Tip

The App Configuration API includes a basic token-replacement system implemented by the configuration.replaceConfigurationTokens pipeline. By default, the pipeline only supports the $name token.

To configure apps in Sitecore, you can use the following attributes:

AttributeUsage
nameRequired. The unique name of the application.
sitecorePathRequired. The path to the application's content and routes when imported. It is created during the first import.
inheritsRequired. Indicates the app from which to inherit other, non-specified settings. Inheritance cascades through multiple app definitions.
filesystemPathThe file system deployment path for the JavaScript Rendering SDK application. Must match the sitecoreDistPath in package.json.Default: /dist/$name
serverBundleThe bundled file name of the application's server.js.Default: server.bundle
importUserThe Sitecore user account to use during the import process. Specifying the user account allows restricting the actions of the import using security and workflow.Default: sitecore\JssImport
importLanguageThe Sitecore fallback language to use during the import if the manifest does not contain a language value.Default: en
importDatabaseThe Sitecore database to use during import.Default: master
importDeviceThe device layer where the import process creates renderings.Default: /sitecore/layout/Devices/Default
rootPlaceholdersA comma-delimited list of the placeholder names at the root of your app layout.Default: main
templatesPathThe path for importing generated templates. If the path does not exist, it is created during the import process, including any ancestor folders.Default: /sitecore/templates/$name
renderingsPathThe path for importing generated renderings. If the path does not exist, it is created during the import process, including any ancestor folders.Default: /sitecore/layout/renderings/$name
layoutPathThe path for importing the main layout of the app. If the path does not exist, it is created during the import process, including any ancestor folders.Default: /sitecore/layout/Layouts/JavaScriptServices/$name
placeholdersPathThe path for importing generated placeholder settings. If the path does not exist, it is created during the import process, including any ancestor folders.Default: /sitecore/layout/placeholder settings/$name
appDatasourcesPathThe path for importing app-level datasource items. If the path does not exist, it is created during the import process, including any ancestor folders.Default: /sitecore/content/$name/Components
routeDatasourcesPathThe name of the child folder to create under route items for route-level datasource items.Default: Page Components
mediaLibraryPathThe path for importing media items. If the path does not exist, it is created during the import process, including any ancestor folders.Default: /sitecore/media library/$name
defaultWorkflowThe default workflow applied to the standard values of generated templates.Default: /sitecore/system/Workflows/JSS Development Workflow
appTemplateThe template of the generated root app item. If changed, this template must inherit from the default app template.Default: /sitecore/templates/JavaScriptServices/App
routeBaseTemplateThe template the import process must use as a base for generating the app-specific route template. If changed, this template must inherit from the default route template.Default: /sitecore/templates/JavaScriptServices/Route
routeTemplateNameThe name to use for the generated route template.Default: $name Route
layoutTemplateThe template for creating the app's main layout item. If changed, this must inherit from the JSS JavaScript Main Layout.Default: /sitecore/templates/JavaScriptServices/JavaScript Main Layout
folderTemplateThe template for creating generic folders (for example, for datasource items).Default: /sitecore/templates/Common/Folder
placeholderSettingsFolderTemplateThe template for creating placeholder setting folders.Default: /sitecore/templates/System/Layout/Placeholder Settings Folder
renderingsFolderTemplateThe template for creating renderings folders.Default: /sitecore/templates/System/Layout/Renderings/Rendering Folder
layoutFolderTemplateThe template for creating folders for the app's main layout.Default: /sitecore/templates/System/Layout/Layout Folder
templateFolderTemplateThe template for creating template folders.Default: /sitecore/templates/System/Templates/Template Folder
mediaLibraryFolderTemplateThe template for creating folders in the media library.Default: /sitecore/templates/System/Media/Media folder
protectDeveloperItemsBoolean value indicating whether developer items, such as template and layout items, must have their read-only/protected flag turned on by the import process.Default: true
optimizeImportIndexingBoolean value indicating whether the import must use a BulkUpdateContext and refresh indexes on import completion.Default: true
datasourceStrategyThe name of the datasource import strategy. The setting must reference the name of an IDatasourceStrategy configured in the /javaScriptServices/datasourceStrategies config section.Default: preferRouteLevel
analyzeAllowedControlsBoolean value indicating whether the import must attempt to populate the Allowed Controls field on placeholder settings based on rendering usage within the imported routes.Default: true
dictionaryDomainThe name or GUID of the Sitecore Dictionary Domain used with the app. If not configured, the application dictionary falls back to the default dictionary of the context database.Default: (none)
dictionaryPathThe item path or GUID for the dictionary domain item of the current app. If the path does not exist, it is created during the import process, including any ancestor folders. The import service creates dictionary domains and imports dictionary entries in this location.Default : /sitecore/content/$name/$name Dictionary
layoutServiceConfigurationThe name of a named Layout Service configuration for integrated mode app rendering. The app must reference this configuration explicitly if not running in integrated mode.Possible values: jss, defaultDefault: jssNoteGenerally, you use the jss configuration for Sitecore Layout Service REST requests and the default configuration for Experience Edge GraphQL queries.Specifying the language is required for all Edge queries. When using integrated GraphQL queries against the Edge GraphQL schema, the default configuration ensures that a $language value is injected in all queries. The jss configuration does not provide the language value, keeping it backward compatible with version 18.0.0.
graphQLEndpointEnables integrated GraphQL queries. If you are not using integrated GraphQL, you can remove or omit this attribute.
serverSideRenderingEngineInstructs Sitecore on which rendering engines to use when rendering the JSS app server-side.Possible values: nodejs and http.For SitecoreAI, the only valid value is http.
serverSideRenderingFunctionNameName of the exported JS function on your serverBundle to call when rendering in integrated mode.Only relevant when you set the value of serverSideRenderingEngine to nodejs.Default: renderView
serverSideRenderingEngineEndpointUrlDefines an HTTP endpoint for a remote rendering host.Only relevant when you set the value of serverSideRenderingEngine to http.Default: (none)
serverSideRenderingEngineApplicationUrlDefines the URL for creating absolute links for any relative links in the rendered HTML necessary for the Experience Editor. If not specified (default), the import process extracts the hostname from the serverSideRenderingEngineEndpointUrl.Only relevant when you set the value of serverSideRenderingEngine to http.Default: ""
serverSideRenderingEngineEditOnlyControls whether Sitecore must process requests to non-API routes when using an external rendering host.Default: true.ImportantTo use the Experience Editor explore mode, you must change the value to false,
debugSecurityBoolean value to enable/disable security debugging. Set to true if you have app import connection issues to log details about the server-side processing of the shared secret. Do not use it unless debugging a connection issue. Use it together with --debugSecurity CLI flag to diagnose client-side security issues.Default: false
If you have suggestions for improving this article, let us know!