Contentstack Kickstarts are the minimum amount of code needed to connect to Contentstack. This kickstart covers the following items:
- SDK initialization
- Live preview and Visual building setup
More details about this codebase can be found on the Contentstack docs.
Before you can run this code, you will need a Contentstack "Stack" to connect to. Follow the following steps to seed a Stack that this codebase understands.
If you installed this Kickstart via the Contentstack Markertplace or the new account onboarding, you can skip this step.
npm install -g @contentstack/cli
It might ask you to set your default region.
You can get all regions and their codes here or run csdx config:get:region
.
Beware, Free Contentstack developer accounts are bound to the EU region. We still use the CDN the API is lightning fast.
Set your region like so:
csdx config:set:region EU
csdx auth:login
In your Contentstack Organization dashboard find Org admin
and copy your Organization ID (Example: blt481c598b0d8352d9
).
Make sure to replace <YOUR_ORG_ID>
with your actual Organization ID and run the below.
csdx cm:stacks:seed --repo "contentstack/kickstart-stack-seed" --org "<YOUR_ORG_ID>" -n "Kickstart Stack"
Go to Settings > Tokens
and create a delivery token. Select the preview
scope and turn on Create preview token
Now that you have a delivery token, you can fill out the .env file in your codebase.
You can find the API key, Delivery Token and Preview Token in Settings > Tokens > Your token.
NUXT_CONTENTSTACK_API_KEY=<YOUR_API_KEY>
NUXT_CONTENTSTACK_DELIVERY_TOKEN=<YOUR_DELIVERY_TOKEN>
NUXT_CONTENTSTACK_PREVIEW_TOKEN=<YOUR_PREVIEW_TOKEN>
NUXT_CONTENTSTACK_REGION=EU
NUXT_CONTENTSTACK_ENVIRONMENT=preview
NUXT_CONTENTSTACK_PREVIEW=true
Go to Settings > Live Preview. Click enable and select the Preview
environment in the drop down. Hit save.
npm install
npm run dev
Go to http://localhost:3000
.
Go to Entries and select the only entry in the list. In the sidebar, click on the live preview icon. Or, see your entry in the visual builder