Install the NextJS starter kit
Now that you have reviewed the prerequisites, you can install the starter kit, create the environment file to connect to your Content Hub ONE tenant and serialize items, and log in to your Content Hub ONE instance.
-
Fork the NextJS starter kit repository to your personal or company account and then rename it. This creates a copy of the repository.
-
Clone the repository. This downloads the repository to your computer.
To install the Next JS starter kit:
-
Open an administrative command line, navigate to the root of the repository folder and run the command
npm install
. -
Also in the repository folder, make a copy of the .env.example file, and name it .env.
-
In the .env file, enter the following parameters. You can find the appropriate values for each parameter in the corresponding location shown in the table. Where available, you can use the Copy
button to add the value to your clipboard.
Parameter
Location
SITECORE_CLIENT_ID
In the Content Hub ONE app, on the menu bar, click Settings and, in the INTEGRATION section of the left pane, click OAuth client, and then select the Client Credentials option.
SITECORE_CLIENT_SECRET
In the Content Hub ONE app, on the menu bar, click Settings and, in the INTEGRATION section of the left pane, click OAuth client, and then select the Client Credentials option. This is required when uploading the demo images using the setup.js.
SITECORE_ENDPOINT_URL
The Preview API URL, for example,
https://content-api.sitecorecloud.io/api/content/v1/preview/graphql/
.SITECORE_DEV_AUTH_TOKEN
In the Content Hub ONE app, on the menu bar, click Settings and, in the INTEGRATION section of the left pane, click API keys, and then create an API key for Preview. This can be done through the Content Hub ONE app, CLI, or Content Management API.
-
Save the file.
ImportantThe client ID and client secret are required to run a script using the Content Management API to create content. For development, it is best to use the Preview API, including the
SITECORE_ENDPOINT_URL
and theSITECORE_DEV_AUTH_TOKEN
for the Preview API. For production, use the Delivery API values instead.