create-content-sdk-app 2.0.2 → 2.1.0-canary.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.MD +202 -202
- package/dist/templates/nextjs/.cursor/rules/general.mdc +81 -81
- package/dist/templates/nextjs/.cursor/rules/javascript.mdc +112 -112
- package/dist/templates/nextjs/.cursor/rules/project-setup.mdc +100 -100
- package/dist/templates/nextjs/.cursor/rules/sitecore.mdc +150 -150
- package/dist/templates/nextjs/.env.container.example +27 -27
- package/dist/templates/nextjs/.env.remote.example +51 -51
- package/dist/templates/nextjs/.gitattributes +11 -11
- package/dist/templates/nextjs/.prettierrc +8 -8
- package/dist/templates/nextjs/.vscode/extensions.json +8 -8
- package/dist/templates/nextjs/.vscode/launch.json +15 -15
- package/dist/templates/nextjs/.windsurfrules +186 -186
- package/dist/templates/nextjs/LICENSE.txt +202 -202
- package/dist/templates/nextjs/eslint.config.mjs +81 -81
- package/dist/templates/nextjs/gitignore +28 -28
- package/dist/templates/nextjs/package.json +68 -68
- package/dist/templates/nextjs/sitecore.config.ts.example +40 -40
- package/dist/templates/nextjs/src/proxy.ts +11 -3
- package/dist/templates/nextjs/tsconfig.json +40 -40
- package/dist/templates/nextjs-app-router/.cursor/rules/app-router-setup.mdc +116 -116
- package/dist/templates/nextjs-app-router/.cursor/rules/general.mdc +80 -80
- package/dist/templates/nextjs-app-router/.cursor/rules/javascript.mdc +112 -112
- package/dist/templates/nextjs-app-router/.cursor/rules/sitecore.mdc +174 -174
- package/dist/templates/nextjs-app-router/.env.container.example +27 -27
- package/dist/templates/nextjs-app-router/.env.remote.example +51 -51
- package/dist/templates/nextjs-app-router/.gitattributes +11 -11
- package/dist/templates/nextjs-app-router/.windsurfrules +290 -290
- package/dist/templates/nextjs-app-router/eslint.config.mjs +21 -29
- package/dist/templates/nextjs-app-router/gitignore +31 -31
- package/dist/templates/nextjs-app-router/package.json +54 -55
- package/dist/templates/nextjs-app-router/postcss.config.mjs +5 -5
- package/dist/templates/nextjs-app-router/sitecore.config.ts.example +40 -40
- package/dist/templates/nextjs-app-router/src/app/globals.css +1 -1
- package/dist/templates/nextjs-app-router/src/proxy.ts +11 -3
- package/dist/templates/nextjs-app-router/tsconfig.json +48 -48
- package/package.json +2 -2
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "content-sdk-nextjs",
|
|
3
|
-
"description": "Application utilizing Content SDK and Next.js",
|
|
4
|
-
"version": "0.1.0",
|
|
5
|
-
"private": true,
|
|
6
|
-
"config": {
|
|
7
|
-
"appName": "content-sdk-nextjs",
|
|
8
|
-
"graphQLEndpointPath": "/sitecore/api/graph/edge",
|
|
9
|
-
"language": "en",
|
|
10
|
-
"template": "nextjs"
|
|
11
|
-
},
|
|
12
|
-
"author": {
|
|
13
|
-
"name": "Sitecore Corporation",
|
|
14
|
-
"url": "https://doc.sitecore.com/xmc/en/developers/content-sdk/index.html"
|
|
15
|
-
},
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/sitecore/content-sdk.git"
|
|
19
|
-
},
|
|
20
|
-
"bugs": {
|
|
21
|
-
"url": "https://github.com/sitecore/content-sdk/issues"
|
|
22
|
-
},
|
|
23
|
-
"license": "Apache-2.0",
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"@sitecore-content-sdk/nextjs": "<%- version %>",
|
|
26
|
-
"@sitecore-content-sdk/analytics-core": "<%- version %>",
|
|
27
|
-
"@sitecore-content-sdk/events": "<%- version %>",
|
|
28
|
-
"@sitecore-feaas/clientside": "^0.6.0",
|
|
29
|
-
"@sitecore/components": "~2.1.0",
|
|
30
|
-
"next": "^16.
|
|
31
|
-
"next-localization": "^0.12.0",
|
|
32
|
-
"react": "^19.2.1",
|
|
33
|
-
"react-dom": "^19.2.1"
|
|
34
|
-
},
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"@sitecore-content-sdk/cli": "<%- version %>",
|
|
37
|
-
"@types/node": "^24.10.4",
|
|
38
|
-
"@types/react": "^19.2.7",
|
|
39
|
-
"@types/react-dom": "^19.2.3",
|
|
40
|
-
"@stylistic/eslint-plugin": "^5.2.2",
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "8.39.0",
|
|
42
|
-
"@typescript-eslint/parser": "8.39.0",
|
|
43
|
-
"cross-env": "~7.0.3",
|
|
44
|
-
"eslint": "^9.32.0",
|
|
45
|
-
"eslint-config-next": "
|
|
46
|
-
"eslint-config-prettier": "^10.1.8",
|
|
47
|
-
"eslint-plugin-import": "2.32.0",
|
|
48
|
-
"eslint-plugin-jsdoc": "52.0.3",
|
|
49
|
-
"eslint-plugin-prettier": "^5.5.3",
|
|
50
|
-
"eslint-plugin-react": "7.37.5",
|
|
51
|
-
"eslint-plugin-react-hooks": "5.2.0",
|
|
52
|
-
"npm-run-all2": "~8.0.1",
|
|
53
|
-
"prettier": "^3.6.2",
|
|
54
|
-
"typescript": "~5.8.3"
|
|
55
|
-
},
|
|
56
|
-
"scripts": {
|
|
57
|
-
"build": "cross-env NODE_ENV=production npm-run-all --serial sitecore-tools:generate-map sitecore-tools:build next:build",
|
|
58
|
-
"lint": "eslint ./src/**/*.tsx ./src/**/*.ts",
|
|
59
|
-
"next:build": "next build",
|
|
60
|
-
"next:dev": "cross-env NODE_OPTIONS='--inspect' next dev",
|
|
61
|
-
"next:start": "next start",
|
|
62
|
-
"sitecore-tools:generate-map": "sitecore-tools project component generate-map",
|
|
63
|
-
"sitecore-tools:generate-map:watch": "sitecore-tools project component generate-map --watch",
|
|
64
|
-
"sitecore-tools:build": "sitecore-tools project build",
|
|
65
|
-
"dev": "cross-env NODE_ENV=development npm-run-all --serial sitecore-tools:generate-map sitecore-tools:build --parallel next:dev sitecore-tools:generate-map:watch",
|
|
66
|
-
"start": "cross-env-shell NODE_ENV=production npm-run-all --serial build next:start"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "content-sdk-nextjs",
|
|
3
|
+
"description": "Application utilizing Content SDK and Next.js",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"private": true,
|
|
6
|
+
"config": {
|
|
7
|
+
"appName": "content-sdk-nextjs",
|
|
8
|
+
"graphQLEndpointPath": "/sitecore/api/graph/edge",
|
|
9
|
+
"language": "en",
|
|
10
|
+
"template": "nextjs"
|
|
11
|
+
},
|
|
12
|
+
"author": {
|
|
13
|
+
"name": "Sitecore Corporation",
|
|
14
|
+
"url": "https://doc.sitecore.com/xmc/en/developers/content-sdk/index.html"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/sitecore/content-sdk.git"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/sitecore/content-sdk/issues"
|
|
22
|
+
},
|
|
23
|
+
"license": "Apache-2.0",
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@sitecore-content-sdk/nextjs": "<%- version %>",
|
|
26
|
+
"@sitecore-content-sdk/analytics-core": "<%- version %>",
|
|
27
|
+
"@sitecore-content-sdk/events": "<%- version %>",
|
|
28
|
+
"@sitecore-feaas/clientside": "^0.6.0",
|
|
29
|
+
"@sitecore/components": "~2.1.0",
|
|
30
|
+
"next": "^16.2.0",
|
|
31
|
+
"next-localization": "^0.12.0",
|
|
32
|
+
"react": "^19.2.1",
|
|
33
|
+
"react-dom": "^19.2.1"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@sitecore-content-sdk/cli": "<%- version %>",
|
|
37
|
+
"@types/node": "^24.10.4",
|
|
38
|
+
"@types/react": "^19.2.7",
|
|
39
|
+
"@types/react-dom": "^19.2.3",
|
|
40
|
+
"@stylistic/eslint-plugin": "^5.2.2",
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "8.39.0",
|
|
42
|
+
"@typescript-eslint/parser": "8.39.0",
|
|
43
|
+
"cross-env": "~7.0.3",
|
|
44
|
+
"eslint": "^9.32.0",
|
|
45
|
+
"eslint-config-next": "16.2.2",
|
|
46
|
+
"eslint-config-prettier": "^10.1.8",
|
|
47
|
+
"eslint-plugin-import": "2.32.0",
|
|
48
|
+
"eslint-plugin-jsdoc": "52.0.3",
|
|
49
|
+
"eslint-plugin-prettier": "^5.5.3",
|
|
50
|
+
"eslint-plugin-react": "7.37.5",
|
|
51
|
+
"eslint-plugin-react-hooks": "5.2.0",
|
|
52
|
+
"npm-run-all2": "~8.0.1",
|
|
53
|
+
"prettier": "^3.6.2",
|
|
54
|
+
"typescript": "~5.8.3"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "cross-env NODE_ENV=production npm-run-all --serial sitecore-tools:generate-map sitecore-tools:build next:build",
|
|
58
|
+
"lint": "eslint ./src/**/*.tsx ./src/**/*.ts",
|
|
59
|
+
"next:build": "next build",
|
|
60
|
+
"next:dev": "cross-env NODE_OPTIONS='--inspect' next dev",
|
|
61
|
+
"next:start": "next start",
|
|
62
|
+
"sitecore-tools:generate-map": "sitecore-tools project component generate-map",
|
|
63
|
+
"sitecore-tools:generate-map:watch": "sitecore-tools project component generate-map --watch",
|
|
64
|
+
"sitecore-tools:build": "sitecore-tools project build",
|
|
65
|
+
"dev": "cross-env NODE_ENV=development npm-run-all --serial sitecore-tools:generate-map sitecore-tools:build --parallel next:dev sitecore-tools:generate-map:watch",
|
|
66
|
+
"start": "cross-env-shell NODE_ENV=production npm-run-all --serial build next:start"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { defineConfig } from '@sitecore-content-sdk/nextjs/config';
|
|
2
|
-
/**
|
|
3
|
-
* @type {import('@sitecore-content-sdk/nextjs/config').SitecoreConfig}
|
|
4
|
-
* See the documentation for `defineConfig`:
|
|
5
|
-
* https://doc.sitecore.com/xmc/en/developers/content-sdk/the-sitecore-configuration-file.html
|
|
6
|
-
*/
|
|
7
|
-
export default defineConfig({
|
|
8
|
-
api: {
|
|
9
|
-
edge: {
|
|
10
|
-
contextId:
|
|
11
|
-
process.env.SITECORE_EDGE_CONTEXT_ID ||
|
|
12
|
-
process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID ||
|
|
13
|
-
'',
|
|
14
|
-
clientContextId: process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID,
|
|
15
|
-
edgeUrl:
|
|
16
|
-
process.env.NEXT_PUBLIC_SITECORE_EDGE_PLATFORM_HOSTNAME ||
|
|
17
|
-
process.env.SITECORE_EDGE_PLATFORM_HOSTNAME,
|
|
18
|
-
},
|
|
19
|
-
local: {
|
|
20
|
-
apiKey: process.env.NEXT_PUBLIC_SITECORE_API_KEY || '',
|
|
21
|
-
apiHost: process.env.NEXT_PUBLIC_SITECORE_API_HOST || '',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
defaultSite: process.env.NEXT_PUBLIC_DEFAULT_SITE_NAME,
|
|
25
|
-
defaultLanguage: process.env.NEXT_PUBLIC_DEFAULT_LANGUAGE || 'en',
|
|
26
|
-
editingSecret: process.env.SITECORE_EDITING_SECRET,
|
|
27
|
-
redirects: {
|
|
28
|
-
enabled: true,
|
|
29
|
-
locales: ['en'],
|
|
30
|
-
},
|
|
31
|
-
multisite: {
|
|
32
|
-
enabled: true,
|
|
33
|
-
useCookieResolution: () => process.env.VERCEL_ENV === 'preview',
|
|
34
|
-
},
|
|
35
|
-
personalize: {
|
|
36
|
-
scope: process.env.NEXT_PUBLIC_PERSONALIZE_SCOPE,
|
|
37
|
-
edgeTimeout: parseInt(process.env.PERSONALIZE_PROXY_EDGE_TIMEOUT!, 10),
|
|
38
|
-
cdpTimeout: parseInt(process.env.PERSONALIZE_PROXY_EDGE_TIMEOUT!, 10),
|
|
39
|
-
},
|
|
40
|
-
});
|
|
1
|
+
import { defineConfig } from '@sitecore-content-sdk/nextjs/config';
|
|
2
|
+
/**
|
|
3
|
+
* @type {import('@sitecore-content-sdk/nextjs/config').SitecoreConfig}
|
|
4
|
+
* See the documentation for `defineConfig`:
|
|
5
|
+
* https://doc.sitecore.com/xmc/en/developers/content-sdk/the-sitecore-configuration-file.html
|
|
6
|
+
*/
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
api: {
|
|
9
|
+
edge: {
|
|
10
|
+
contextId:
|
|
11
|
+
process.env.SITECORE_EDGE_CONTEXT_ID ||
|
|
12
|
+
process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID ||
|
|
13
|
+
'',
|
|
14
|
+
clientContextId: process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID,
|
|
15
|
+
edgeUrl:
|
|
16
|
+
process.env.NEXT_PUBLIC_SITECORE_EDGE_PLATFORM_HOSTNAME ||
|
|
17
|
+
process.env.SITECORE_EDGE_PLATFORM_HOSTNAME,
|
|
18
|
+
},
|
|
19
|
+
local: {
|
|
20
|
+
apiKey: process.env.NEXT_PUBLIC_SITECORE_API_KEY || '',
|
|
21
|
+
apiHost: process.env.NEXT_PUBLIC_SITECORE_API_HOST || '',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
defaultSite: process.env.NEXT_PUBLIC_DEFAULT_SITE_NAME,
|
|
25
|
+
defaultLanguage: process.env.NEXT_PUBLIC_DEFAULT_LANGUAGE || 'en',
|
|
26
|
+
editingSecret: process.env.SITECORE_EDITING_SECRET,
|
|
27
|
+
redirects: {
|
|
28
|
+
enabled: true,
|
|
29
|
+
locales: ['en'],
|
|
30
|
+
},
|
|
31
|
+
multisite: {
|
|
32
|
+
enabled: true,
|
|
33
|
+
useCookieResolution: () => process.env.VERCEL_ENV === 'preview',
|
|
34
|
+
},
|
|
35
|
+
personalize: {
|
|
36
|
+
scope: process.env.NEXT_PUBLIC_PERSONALIZE_SCOPE,
|
|
37
|
+
edgeTimeout: parseInt(process.env.PERSONALIZE_PROXY_EDGE_TIMEOUT!, 10),
|
|
38
|
+
cdpTimeout: parseInt(process.env.PERSONALIZE_PROXY_EDGE_TIMEOUT!, 10),
|
|
39
|
+
},
|
|
40
|
+
});
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import { type NextRequest } from 'next/server';
|
|
1
|
+
import { NextFetchEvent, type NextRequest } from 'next/server';
|
|
2
2
|
import {
|
|
3
3
|
defineProxy,
|
|
4
4
|
MultisiteProxy,
|
|
5
5
|
PersonalizeProxy,
|
|
6
6
|
RedirectsProxy,
|
|
7
|
+
BotTrackingProxy,
|
|
7
8
|
} from '@sitecore-content-sdk/nextjs/proxy';
|
|
8
9
|
import sites from '.sitecore/sites.json';
|
|
9
10
|
import scConfig from 'sitecore.config';
|
|
10
11
|
|
|
11
|
-
export default function proxy(req: NextRequest) {
|
|
12
|
+
export default function proxy(req: NextRequest, event: NextFetchEvent) {
|
|
13
|
+
// BotTrackingProxy will detect and track bots before any other proxies run
|
|
14
|
+
const botTracking = new BotTrackingProxy({
|
|
15
|
+
...scConfig.api.edge,
|
|
16
|
+
sites,
|
|
17
|
+
fetchEvent: event,
|
|
18
|
+
});
|
|
19
|
+
|
|
12
20
|
// Instantiate proxies - they will use Edge config if available, otherwise fall back to local config
|
|
13
21
|
// Each proxy will skip processing if required API configuration is not available
|
|
14
22
|
const multisite = new MultisiteProxy({
|
|
@@ -62,7 +70,7 @@ export default function proxy(req: NextRequest) {
|
|
|
62
70
|
// },
|
|
63
71
|
});
|
|
64
72
|
|
|
65
|
-
return defineProxy(multisite, redirects, personalize).exec(req);
|
|
73
|
+
return defineProxy(botTracking, multisite, redirects, personalize).exec(req);
|
|
66
74
|
}
|
|
67
75
|
|
|
68
76
|
export const config = {
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"baseUrl": ".",
|
|
4
|
-
"paths": {
|
|
5
|
-
"components/*": ["src/components/*"],
|
|
6
|
-
"lib/*": ["src/lib/*"],
|
|
7
|
-
"temp/*": ["src/temp/*"],
|
|
8
|
-
"assets/*": ["src/assets/*"],
|
|
9
|
-
<%_ if (helper.isDev) { _%>
|
|
10
|
-
"react": ["node_modules/react"],
|
|
11
|
-
"next/*": ["node_modules/next/*"],
|
|
12
|
-
<%_ } _%>
|
|
13
|
-
},
|
|
14
|
-
"target": "es5",
|
|
15
|
-
"types": ["node"],
|
|
16
|
-
"lib": ["dom", "dom.iterable", "esnext"],
|
|
17
|
-
"allowJs": true,
|
|
18
|
-
"skipLibCheck": true,
|
|
19
|
-
"strict": true,
|
|
20
|
-
"strictFunctionTypes": false,
|
|
21
|
-
"downlevelIteration": true,
|
|
22
|
-
"noEmit": true,
|
|
23
|
-
"esModuleInterop": true,
|
|
24
|
-
"module": "esnext",
|
|
25
|
-
"moduleResolution": "node",
|
|
26
|
-
"resolveJsonModule": true,
|
|
27
|
-
"isolatedModules": true,
|
|
28
|
-
"jsx": "preserve",
|
|
29
|
-
"allowSyntheticDefaultImports": true,
|
|
30
|
-
"noImplicitReturns": true,
|
|
31
|
-
"noImplicitAny": true,
|
|
32
|
-
"noImplicitThis": true,
|
|
33
|
-
"noUnusedLocals": true,
|
|
34
|
-
"noUnusedParameters": true,
|
|
35
|
-
"incremental": true,
|
|
36
|
-
"forceConsistentCasingInFileNames": false
|
|
37
|
-
},
|
|
38
|
-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
|
39
|
-
"exclude": ["node_modules"]
|
|
40
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".",
|
|
4
|
+
"paths": {
|
|
5
|
+
"components/*": ["src/components/*"],
|
|
6
|
+
"lib/*": ["src/lib/*"],
|
|
7
|
+
"temp/*": ["src/temp/*"],
|
|
8
|
+
"assets/*": ["src/assets/*"],
|
|
9
|
+
<%_ if (helper.isDev) { _%>
|
|
10
|
+
"react": ["node_modules/react"],
|
|
11
|
+
"next/*": ["node_modules/next/*"],
|
|
12
|
+
<%_ } _%>
|
|
13
|
+
},
|
|
14
|
+
"target": "es5",
|
|
15
|
+
"types": ["node"],
|
|
16
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
17
|
+
"allowJs": true,
|
|
18
|
+
"skipLibCheck": true,
|
|
19
|
+
"strict": true,
|
|
20
|
+
"strictFunctionTypes": false,
|
|
21
|
+
"downlevelIteration": true,
|
|
22
|
+
"noEmit": true,
|
|
23
|
+
"esModuleInterop": true,
|
|
24
|
+
"module": "esnext",
|
|
25
|
+
"moduleResolution": "node",
|
|
26
|
+
"resolveJsonModule": true,
|
|
27
|
+
"isolatedModules": true,
|
|
28
|
+
"jsx": "preserve",
|
|
29
|
+
"allowSyntheticDefaultImports": true,
|
|
30
|
+
"noImplicitReturns": true,
|
|
31
|
+
"noImplicitAny": true,
|
|
32
|
+
"noImplicitThis": true,
|
|
33
|
+
"noUnusedLocals": true,
|
|
34
|
+
"noUnusedParameters": true,
|
|
35
|
+
"incremental": true,
|
|
36
|
+
"forceConsistentCasingInFileNames": false
|
|
37
|
+
},
|
|
38
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
|
39
|
+
"exclude": ["node_modules"]
|
|
40
|
+
}
|
|
@@ -1,116 +1,116 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Getting started with your Sitecore Content SDK Next.js App Router project
|
|
3
|
-
alwaysApply: true
|
|
4
|
-
globs: []
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Sitecore Content SDK Next.js App Router Project
|
|
8
|
-
|
|
9
|
-
## Project Overview
|
|
10
|
-
|
|
11
|
-
This is a Sitecore Content SDK application built with Next.js App Router. This project uses the latest Next.js features for improved performance and developer experience.
|
|
12
|
-
|
|
13
|
-
Key Technologies:
|
|
14
|
-
|
|
15
|
-
- Next.js App Router (React Server Components)
|
|
16
|
-
- Sitecore Content SDK
|
|
17
|
-
- TypeScript
|
|
18
|
-
- Sitecore XM Cloud
|
|
19
|
-
- next-intl for internationalization
|
|
20
|
-
|
|
21
|
-
## Getting Started
|
|
22
|
-
|
|
23
|
-
Development Workflow:
|
|
24
|
-
|
|
25
|
-
1. Install dependencies: `npm install`
|
|
26
|
-
2. Configure environment variables (copy `.env.example` to `.env.local`)
|
|
27
|
-
3. Start development server: `npm run dev`
|
|
28
|
-
4. Build for production: `npm run build`
|
|
29
|
-
|
|
30
|
-
App Router Specifics:
|
|
31
|
-
|
|
32
|
-
- Server Components by default
|
|
33
|
-
- Client Components when interactivity needed
|
|
34
|
-
- File-based routing in `src/app/` directory
|
|
35
|
-
- Layout files for shared UI elements
|
|
36
|
-
|
|
37
|
-
## Project Structure
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
src/
|
|
41
|
-
app/ # App Router pages and layouts
|
|
42
|
-
components/ # React-specific SDK
|
|
43
|
-
lib/ # Configuration and utilities
|
|
44
|
-
i18n/ # Internationalization setup
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Component Development:
|
|
48
|
-
|
|
49
|
-
- Server Components for data fetching and static content
|
|
50
|
-
- Client Components for interactivity (use 'use client')
|
|
51
|
-
- Shared components in `src/components/`
|
|
52
|
-
- Follow Sitecore field handling patterns
|
|
53
|
-
|
|
54
|
-
## App Router Best Practices
|
|
55
|
-
|
|
56
|
-
Server vs Client Components:
|
|
57
|
-
|
|
58
|
-
- Use Server Components for Sitecore content rendering
|
|
59
|
-
- Use Client Components for user interactions
|
|
60
|
-
- Minimize client-side JavaScript
|
|
61
|
-
- Leverage server-side data fetching
|
|
62
|
-
|
|
63
|
-
Routing and Layouts:
|
|
64
|
-
|
|
65
|
-
- Use layout.tsx for shared page structure
|
|
66
|
-
- Implement loading.tsx for loading states
|
|
67
|
-
- Create error.tsx for error boundaries
|
|
68
|
-
- Use page.tsx for route content
|
|
69
|
-
|
|
70
|
-
## Sitecore Integration
|
|
71
|
-
|
|
72
|
-
Content Rendering:
|
|
73
|
-
|
|
74
|
-
- Fetch Sitecore data in Server Components
|
|
75
|
-
- Use layout service for page structure
|
|
76
|
-
- Handle content preview scenarios
|
|
77
|
-
- Implement proper error handling
|
|
78
|
-
|
|
79
|
-
Performance:
|
|
80
|
-
|
|
81
|
-
- Leverage Server Components for better performance
|
|
82
|
-
- Use streaming for improved loading experience
|
|
83
|
-
- Implement proper caching strategies
|
|
84
|
-
- Optimize images with Next.js Image component
|
|
85
|
-
|
|
86
|
-
## Development Commands
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
npm run dev # Start development server
|
|
90
|
-
npm run build # Build for production
|
|
91
|
-
npm run start # Start production server
|
|
92
|
-
npm run lint # Run ESLint
|
|
93
|
-
npm run type-check # Run TypeScript compiler
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Environment Configuration
|
|
97
|
-
|
|
98
|
-
- Copy `.env.example` to `.env.local`
|
|
99
|
-
- Add your Sitecore API endpoint and key
|
|
100
|
-
- Configure site name and locale settings
|
|
101
|
-
- Set up internationalization if needed
|
|
102
|
-
|
|
103
|
-
## Next Steps
|
|
104
|
-
|
|
105
|
-
1. Configure your Sitecore connection
|
|
106
|
-
2. Set up internationalization (if needed)
|
|
107
|
-
3. Create your first Server Component
|
|
108
|
-
4. Add content types and templates
|
|
109
|
-
5. Implement your layout structure
|
|
110
|
-
6. Deploy to your hosting platform
|
|
111
|
-
|
|
112
|
-
Referenced:
|
|
113
|
-
@src/app/
|
|
114
|
-
@src/components/
|
|
115
|
-
@sitecore.config.ts
|
|
116
|
-
@src/i18n/
|
|
1
|
+
---
|
|
2
|
+
description: Getting started with your Sitecore Content SDK Next.js App Router project
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
globs: []
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Sitecore Content SDK Next.js App Router Project
|
|
8
|
+
|
|
9
|
+
## Project Overview
|
|
10
|
+
|
|
11
|
+
This is a Sitecore Content SDK application built with Next.js App Router. This project uses the latest Next.js features for improved performance and developer experience.
|
|
12
|
+
|
|
13
|
+
Key Technologies:
|
|
14
|
+
|
|
15
|
+
- Next.js App Router (React Server Components)
|
|
16
|
+
- Sitecore Content SDK
|
|
17
|
+
- TypeScript
|
|
18
|
+
- Sitecore XM Cloud
|
|
19
|
+
- next-intl for internationalization
|
|
20
|
+
|
|
21
|
+
## Getting Started
|
|
22
|
+
|
|
23
|
+
Development Workflow:
|
|
24
|
+
|
|
25
|
+
1. Install dependencies: `npm install`
|
|
26
|
+
2. Configure environment variables (copy `.env.example` to `.env.local`)
|
|
27
|
+
3. Start development server: `npm run dev`
|
|
28
|
+
4. Build for production: `npm run build`
|
|
29
|
+
|
|
30
|
+
App Router Specifics:
|
|
31
|
+
|
|
32
|
+
- Server Components by default
|
|
33
|
+
- Client Components when interactivity needed
|
|
34
|
+
- File-based routing in `src/app/` directory
|
|
35
|
+
- Layout files for shared UI elements
|
|
36
|
+
|
|
37
|
+
## Project Structure
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
src/
|
|
41
|
+
app/ # App Router pages and layouts
|
|
42
|
+
components/ # React-specific SDK
|
|
43
|
+
lib/ # Configuration and utilities
|
|
44
|
+
i18n/ # Internationalization setup
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Component Development:
|
|
48
|
+
|
|
49
|
+
- Server Components for data fetching and static content
|
|
50
|
+
- Client Components for interactivity (use 'use client')
|
|
51
|
+
- Shared components in `src/components/`
|
|
52
|
+
- Follow Sitecore field handling patterns
|
|
53
|
+
|
|
54
|
+
## App Router Best Practices
|
|
55
|
+
|
|
56
|
+
Server vs Client Components:
|
|
57
|
+
|
|
58
|
+
- Use Server Components for Sitecore content rendering
|
|
59
|
+
- Use Client Components for user interactions
|
|
60
|
+
- Minimize client-side JavaScript
|
|
61
|
+
- Leverage server-side data fetching
|
|
62
|
+
|
|
63
|
+
Routing and Layouts:
|
|
64
|
+
|
|
65
|
+
- Use layout.tsx for shared page structure
|
|
66
|
+
- Implement loading.tsx for loading states
|
|
67
|
+
- Create error.tsx for error boundaries
|
|
68
|
+
- Use page.tsx for route content
|
|
69
|
+
|
|
70
|
+
## Sitecore Integration
|
|
71
|
+
|
|
72
|
+
Content Rendering:
|
|
73
|
+
|
|
74
|
+
- Fetch Sitecore data in Server Components
|
|
75
|
+
- Use layout service for page structure
|
|
76
|
+
- Handle content preview scenarios
|
|
77
|
+
- Implement proper error handling
|
|
78
|
+
|
|
79
|
+
Performance:
|
|
80
|
+
|
|
81
|
+
- Leverage Server Components for better performance
|
|
82
|
+
- Use streaming for improved loading experience
|
|
83
|
+
- Implement proper caching strategies
|
|
84
|
+
- Optimize images with Next.js Image component
|
|
85
|
+
|
|
86
|
+
## Development Commands
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm run dev # Start development server
|
|
90
|
+
npm run build # Build for production
|
|
91
|
+
npm run start # Start production server
|
|
92
|
+
npm run lint # Run ESLint
|
|
93
|
+
npm run type-check # Run TypeScript compiler
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Environment Configuration
|
|
97
|
+
|
|
98
|
+
- Copy `.env.example` to `.env.local`
|
|
99
|
+
- Add your Sitecore API endpoint and key
|
|
100
|
+
- Configure site name and locale settings
|
|
101
|
+
- Set up internationalization if needed
|
|
102
|
+
|
|
103
|
+
## Next Steps
|
|
104
|
+
|
|
105
|
+
1. Configure your Sitecore connection
|
|
106
|
+
2. Set up internationalization (if needed)
|
|
107
|
+
3. Create your first Server Component
|
|
108
|
+
4. Add content types and templates
|
|
109
|
+
5. Implement your layout structure
|
|
110
|
+
6. Deploy to your hosting platform
|
|
111
|
+
|
|
112
|
+
Referenced:
|
|
113
|
+
@src/app/
|
|
114
|
+
@src/components/
|
|
115
|
+
@sitecore.config.ts
|
|
116
|
+
@src/i18n/
|