contentstack-kickstart
द्वारा contentstack
Contentstack Delivery SDK, live preview, getPage, env overrides, and content model alignment for kickstart-next.
npx skills add https://github.com/contentstack/kickstart-next --skill contentstack-kickstartContentstack kickstart – kickstart-next
When to use
- You are changing how the app talks to Contentstack (delivery, preview, regions, hosts).
- You are extending or fixing assumptions about the
pagecontent type or Live Preview field bindings.
Instructions
Entry points
- All stack configuration and fetching live in lib/contentstack.ts.
stack: created withcontentstack.stack()from@contentstack/delivery-sdk, using API key, delivery token, environment, region, optional customhost, andlive_previewoptions (preview token, preview host, enable flag).initLivePreview(): callsContentstackLivePreview.init()from@contentstack/live-preview-utilswithssr: false,mode: "builder", stack SDK/config, stack details, client URL params, and edit button settings.getPage(url): queries thepagecontent type, filtersurlwithQueryOperation.EQUALS, and returns the first entry typed asPagefrom lib/types.ts. WhenisPreviewis true, adds editable tags viacontentstack.Utils.addEditableTags().
Preview vs production routing
- app/page.tsx: if
isPreview(NEXT_PUBLIC_CONTENTSTACK_PREVIEW === "true"), render the client components/Preview.tsx withpath="/"; otherwise fetch withgetPage("/")on the server and render components/Page.tsx (imported asPage).
Regions and endpoints
- Region resolution uses
getRegionForStringfrom@timbenniks/contentstack-endpoints;getContentstackEndpoints(region, true)supplies default delivery, preview, and application hosts for that region. - If region resolution fails, the stack falls back to
NEXT_PUBLIC_CONTENTSTACK_REGIONas passed through in code (typed loosely for internal flexibility).
Optional environment overrides (advanced)
- Delivery host:
NEXT_PUBLIC_CONTENTSTACK_CONTENT_DELIVERYoverrides the default from endpoints. - Preview host:
NEXT_PUBLIC_CONTENTSTACK_PREVIEW_HOSToverrides preview URL host. - Application (Live Preview UI) host:
NEXT_PUBLIC_CONTENTSTACK_CONTENT_APPLICATIONoverridesclientUrlParams.hostininitLivePreview. - Image hostname for
next/image:NEXT_PUBLIC_CONTENTSTACK_IMAGE_HOSTNAME(seenext.config.mjs).
Types and Live Preview attributes
- Entry and field shapes for CSLP live in lib/types.ts;
$on entries/fields holdsdata-cslp/ parent attributes. Keep these aligned with modular blocks andpagefields expected from the seeded stack.
Seed alignment
- The app assumes a stack seeded from
contentstack/kickstart-stack-seed(“Kickstart Stack”) and tokens/scopes described in README.md. Changing content type UIDs or field UIDs requires matching code and type updates.