Environment Variables

Environment variables for your front-end app#

These are the environment variables that can be used with the Next.js / Nuxt applications.

Required environment variables#

  1. UNIFORM_API_URL = URL value

    Defines the base URL to use in all Uniform content APIs (Map and Page Service, for example). Typically, this will point to your Sitecore instance. If the ContentSync feature is enabled, this can point to a blob storage account with the cached blobs of Uniform API.

    For example: {UNIFORM_API_URL}/uniform/api/content/...

  2. UNIFORM_API_TOKEN = secret

    Defines the security token to use in all Uniform content APIs and will be appended to the uniform_token query string.

    For example: .../map.json?uniform_token={UNIFORM_API_TOKEN}

    This value must match the value defined in Sitecore as either Uniform.API.Token setting, or Uniform.API.Token connection string or UNIFORM_API_TOKEN environment variable.

  3. UNIFORM_API_SITENAME = string value

    Defines the name of Site Configuration (configured in Sitecore) to use in all the Uniform content API requests (Map and Page Service).

    For example: .../uniform/api/content/{UNIFORM_API_SITENAME}/...

    When used with Sitecore JSS, this value set the sc_site query string that is used in the Layout Service requests. For example: .../sitecore/api/layout/render/jss?sc_site={UNIFORM_API_SITENAME}...

  4. UNIFORM_API_KEY = guid of Sitecore API key item id

    ThisĀ isĀ usedĀ forĀ SitecoreĀ JSSĀ solutions and specifies the API Key that will be used for the Sitecore Layout Service requests. Required (for Sitecore JSS based solutions only).

Optional environment variables#

  1. UNIFORM_MODE = preview or mixed

    Default Value: mixed

    • When set to mixed, it enables the deployment service and SSR functionality.
    • When set to preview, it disables the ability to handle site deployments within next/nuxt server, useful for when running a Preview service or SSR for JSS Rendering Host to support Experience Editor.
  2. UNIFORM_PUBLISH_TARGET = none or fake or azureblob or custom

    Default Value: none.

    Defines the publish provider to use in all Deployment requests,

    • none is the same as fake and corresponds to the FakePublishProvider that does not do anything except reporting success and preventing .temp/{ticket} folder from being deleted (if UNIFORM_OPTIONS_DEBUG is off).
    • azureblob stands for AzureBlobPublishProvider and it requires extra configuration to work.
    • custom stands for CustomPublishProvider allows running custom shell script to upload files.

    Top tip for production environments we recommend configuring this setting in Sitecore.

  3. UNIFORM_OPTIONS_DEBUG = bool value

    Default Value: false.

    When enabled (1 or true or yes value):

    • enables verbose logging in the console
    • prevents deleting .temp/{ticket} folders after when generating HTML files and publishing them.
  4. UNIFORM_PUBLISH_TEMP_DIR = string value

    Default Value: .temp

    Allows changing the default temp directory used when generating HTML files and publishing them.


    Default Value: 90000 (90 seconds)

    Allows changing the default timeout used by fetchRetry from fetch-retry lib used server-side when requesting map.json file during site deployment requests.


    Default Value: 10000 (10 seconds)

    Allows changing the default timeout used by fetchRetry from fetch-retry lib used server-side when fetching content from Uniform APIs during preview and deployment requests

Advanced environment variables#

These variables are all optional and reserved for special use only and not recommended to be used in production unless specifically instructed by our support team.


    Default Value: empty string

    Replaces UNIFORM_API_URL during the deployment requests for the scope of that deployment operation only.


    Default Value: /uniform/api/content/{UNIFORM_API_SITENAME}/map.json?uniform_token={UNIFORM_API_TOKEN}

    Allows changing the default URL that full-site deployment requests will use to get the list of all pages.


    Default Value: true

    Allows disabling preview mode parameter (uniform_preview=true) during Uniform API requests in preview mode. Allows using the database defined in the Site Configuration instead of the master database, which is used by default in preview. To disable, set it to any value other than 1, true, or yes.


    Default Value: false

    Allows enabling (1 or true or yes value) links prefetching for near-instant page switch when pure React presentation is used. Renders <link rel="preload" as="fetch" ... /> in <head> for every SmartLink rendered on the page.

  5. UNIFORM_BUILD_MODE = export or ssr

    Default Value: ssr, controlled by Uniform plugin.

    • when set to export: instructs Next.js app to run in SSG mode with next build && next export outputting static articacts to the out folder.
    • when set to ssr: instructs the Next.js app to work in the SSR mode.

Setting defaults#

The starter kits come with the uniform.config.js file that allows setting some of these values as defaults. You can leverage this pattern to extend which environment variables are defined as defaults here.

const dotenv = require("dotenv");
const defaults = {
UNIFORM_API_SITENAME: "uniform-mvc-kit",
function processDefault(key, fallback) {
if (!key) {
return null;
process.env[key] = process.env[key] || fallback;
module.exports = function () {
Object.keys(defaults).forEach((k) => processDefault(k, defaults[k]));

Overriding the Environment Variables at runtime#

Depending on the use case, you may need to override the value of a certain environment variable at runtime (during site deployment), and therefore the values will be scoped to a given deployment operation.

This allows supporting multi-site environments where the value of UNIFORM_API_SITENAME can be provided when the site deployment service is triggered.

This also means that your Next/Nuxt app can run with minimal configuration and source most of the values from Sitecore.