Once the setup of the project and repo is done, clone the repo locally.
In your DatoCMS' project, go to the Settings menu at the top and click API tokens.
Then click Read-only API token and copy the token.
Next, copy the .env.example
file in this directory to .env
(which will be ignored by Git):
cp .env.example .env
Then set each variable on .env
:
NEXT_EXAMPLE_CMS_DATOCMS_API_TOKEN
should be the API token you just copied.NEXT_EXAMPLE_CMS_DATOCMS_PREVIEW_SECRET
can be any random string (but avoid spaces), likeMY_SECRET
- this is used for the Preview Mode.
Your .env
file should look like this:
NEXT_EXAMPLE_CMS_DATOCMS_API_TOKEN=...
NEXT_EXAMPLE_CMS_DATOCMS_PREVIEW_SECRET=...
npm install
npm run dev
Your blog should be up and running on http://localhost:3000!