rsnext/examples/cms-sitecore-xmcloud
Steven 4466ba436b
chore(examples): use default prettier for examples/templates (#60530)
## Description
This PR ensures that the default prettier config is used for examples
and templates.

This config is compatible with `prettier@3` as well (upgrading prettier
is bigger change that can be a future PR).

## Changes
- Updated `.prettierrc.json` in root with `"trailingComma": "es5"` (will
be needed upgrading to prettier@3)
- Added `examples/.prettierrc.json` with default config (this will
change every example)
- Added `packages/create-next-app/templates/.prettierrc.json` with
default config (this will change every template)

## Related

- Fixes #54402
- Closes #54409
2024-01-11 16:01:44 -07:00
..
public (Example) Add CMS Sitecore XM Cloud Example (#54535) 2023-08-27 01:27:38 +00:00
scripts chore(examples): use default prettier for examples/templates (#60530) 2024-01-11 16:01:44 -07:00
sitecore/config (Example) Add CMS Sitecore XM Cloud Example (#54535) 2023-08-27 01:27:38 +00:00
src chore(examples): use default prettier for examples/templates (#60530) 2024-01-11 16:01:44 -07:00
.env.example (Example) Add CMS Sitecore XM Cloud Example (#54535) 2023-08-27 01:27:38 +00:00
.gitignore (Example) Add CMS Sitecore XM Cloud Example (#54535) 2023-08-27 01:27:38 +00:00
.graphql-let.yml chore(examples): use default prettier for examples/templates (#60530) 2024-01-11 16:01:44 -07:00
LICENSE.txt (Example) Add CMS Sitecore XM Cloud Example (#54535) 2023-08-27 01:27:38 +00:00
next-env.d.ts (Example) Add CMS Sitecore XM Cloud Example (#54535) 2023-08-27 01:27:38 +00:00
next.config.js chore(examples): use default prettier for examples/templates (#60530) 2024-01-11 16:01:44 -07:00
package.json (Example) Add CMS Sitecore XM Cloud Example (#54535) 2023-08-27 01:27:38 +00:00
README.md updated sitecore deploy button (#54678) 2023-08-28 17:59:53 +00:00
tsconfig.json (Example) Add CMS Sitecore XM Cloud Example (#54535) 2023-08-27 01:27:38 +00:00
tsconfig.scripts.json (Example) Add CMS Sitecore XM Cloud Example (#54535) 2023-08-27 01:27:38 +00:00

A Next.js Example Using Sitecore JSS and Sitecore XM Cloud

This example connects to a Sitecore XM Cloud site using the Sitecore JavaScript Rendering SDK (JSS) for Next.js and includes example components and configuration for headless SXA (Sitecore Experience Accelerator). For more information on creating and deploying a headless Sitecore solution to XM Cloud please refer to Vercel's Sitecore XM Cloud Integration Guide or official Sitecore documentation.

Demo

https://vercel-sitecore-xmcloud-demo.vercel.app

Deploy your own

Using the Deploy Button below, you'll deploy the Next.js project as well as connect it to your XM Cloud project with the required environment variables.

Deploy with Vercel

  • JSS_APP_NAME: The name of the JSS app that is configured in XM Cloud.
  • GRAPH_QL_ENDPOINT: The GraphQL Edge endpoint. This is required for Sitecore Experience Edge.
  • SITECORE_API_KEY: The Sitecore API key is required to build the app.
  • SITECORE_API_HOST: The host of the Sitecore API.
  • FETCH_WITH: The fetch method to the Sitecore API. This can be either GraphQL or REST.

How to use

Execute create-next-app with npm, Yarn, or pnpm to bootstrap the example:

npx create-next-app --example cms-sitecore-xmcloud cms-sitecore-xmcloud-app
yarn create-next-app --example cms-sitecore-xmcloud cms-sitecore-xmcloud-app
pnpm create-next-app --example cms-sitecore-xmcloud cms-sitecore-xmcloud-app

Configuration

To configure and run this example you can follow our Sitecore XM Cloud Integration Guide