name: contentstack-kickstart description: Use when changing Contentstack Delivery SDK setup, Live Preview, env-driven config, or entry/composable data loading in kickstart-nuxt-ssr.
Contentstack kickstart – kickstart-nuxt-ssr
When to use
- Modifying how the app talks to Contentstack (stack config, tokens, region, endpoints).
- Debugging Live Preview, Visual Builder, or editable tags.
- Changing how pages or entries are queried (content types, fields, preview query params).
Instructions
Configuration surface
nuxt.config.ts—runtimeConfig.publicexposes API key, tokens, environment, preview flag, region, and optional endpoint overrides (contentDelivery,previewHost,applicationHost). Defaults for endpoints come from@timbenniks/contentstack-endpointsviagetContentstackEndpointsandgetRegionForString(process.env.NUXT_CONTENTSTACK_REGION)..env.example— documentsNUXT_CONTENTSTACK_*variables; real values belong in.env(not committed).
Plugin: stack and Live Preview
app/plugins/contentstack.ts— builds the stack withcontentstack.stack({ apiKey, deliveryToken, environment, region, host: contentDelivery, live_preview: { ... } }). Whenpreviewis true and code runs on the client (import.meta.client), it callsContentstackLivePreview.initwithssr: true,mode: "builder",stackSdk,stackDetails,clientUrlParams.host, andeditButtonoptions. It provides$stack,$preview, andContentstackLivePreviewto the app.
Fetching page data
app/composables/useGetPage.ts— usesuseAsyncDatawith a key likepage-${url}. It readsuseNuxtApp().$previewand$stack, merges route query for Live Preview: if preview is on andlive_previewis in the query, it calls$stack.livePreviewQuery(qs). It queries content typepage, fieldurlequals the passed path (QueryOperation.EQUALS),find<Page>(). On success, if$previewis set, it runscontentstack.Utils.addEditableTags(entry, 'page', true).
UI and Visual Builder
app/app.vue— loads the home page withuseGetPage("/"). ImportsVB_EmptyBlockParentClassfrom@contentstack/live-preview-utilsand applies it to the blocks container when there are no blocks (Visual Builder empty state). Usesv-bindwith$metadata for Live Preview where present; usesv-htmlfor rich text and block copy—treat content as trusted CMS content only in line with your security model.
Types
- Root
types.tsdefines shapes such asPage,Block,Filealigned with the seeded stack model. Keep these in sync if the content model changes.