This repo contains both the starter kit with content items and required configuration files.
This kit is pre-wired for edge-side rendering and static site generation for Sitecore JSS and is created to fast track the activation of both Uniform Optimize and Deploy capabilities together with a Sitecore JSS solution.
You can also use this kit to start a vanilla project, simply remove everything from /src/components and adjust the Sitecore site name from uniform-jss-kit to whatever you want and get cracking.
- Sitecore 9.3+ instance available with Sitecore JSS installed and configured.
- "Uniform for Sitecore v5" installed and configured on your Sitecore instance. Check out these docs for more info.
- Install the Sitecore package with the starter kit items from
/sitecore/App_Data/packagesfolder (optional). - Create Sitecore API key as per Sitecore JSS documentation here.
- Create an
.envfile next topackage.json(see.env-example) and provide the values for your Sitecore instance:# the Sitecore endpoint where Uniform Connector is installed and configured UNIFORM_API_URL=https://sitecore.dev.local UNIFORM_API_TOKEN='Uniform API token, see the docs' UNIFORM_API_KEY: 'Sitecore API key value' JSS_EDITING_SECRET: 'Sitecore JSS edititing secret from JavaScriptServices.ViewEngine.Http.JssEditingSecret setting'
See Sitecore documentation on Walkthrough: Connecting a Next.js JSS app to Sitecore editors
- Add
NPM_TOKENenvironment variable with the value we provided you with. npm installjss setupand follow the steps Sitecore JSS requires and use the API key you created during the Pre-requisites step above.jss deploy configto deploy the application config from/sitecore/configfolder into your Sitecore instance.npm run buildto build the app.npm startto start the app in connected mode.- For development, use
npm run devcommand.
-
Install
@cloudflare/wranglernpm package
npm i @cloudflare/wrangler@1.19.2 -g -
Create a Cloudflare account: https://dash.cloudflare.com/login
-
Create a Cloudflare API token:
- Follow the link: https://dash.cloudflare.com/profile/api-tokens
- Select "Create Token" button
- Select "Edit Cloudflare Workers" among API token templates
- In a new "Create Token" window don't change any Permissions (they are predefined correctly); indicate "All Accounts" in Account Resources section and "All Zones" in Zone Resources section. Client IP Address Filtering section can be skipped.
- Press "Continue To Summary" and then "Create Token" buttons.
- IMPORTANT! Copy and save your API Token somewhere. It only shown once after the initial setup.
- Finalize the worker setup: navigate to the Workers page (Click Workers link on the right pane on the Cloudflare main page) and click the Setup button next to your worker name; Choose to proceed with free account on the next page
-
Enable config:
uniform-jss-kit.Uniform.Deployment.HostedService.Cloudflare.config.disabledand specify required variables:- update
CF_ACCOUNT_IDwith your Cloudflare account ID - update
CF_API_TOKENwith created Cloudflare API token - update
CF_WORKER_NAMEwith preferable worker name
- update
-
Default Cloudflare worker domain:
https://<WORKER-NAME>.<CLOUDFLARE-ACCOUNT-NAME>.workers.dev
Note: Remove or update the robots.txt if you going to use this kit in production