This is a demo of how to use SvelteKit and DatoCMS together.
The purpose of this repo is to have a quick start reference that can be set up with the "one-click" button below.
Have a look at the end result live:
Make sure that you have set up the Github integration on Vercel.
Let DatoCMS set everything up for you clicking this button:
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 Bundle-safe, read-only 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
:
PUBLIC_DATOCMS_API_TOKEN
should be the API token you just copied.Your .env
file should look like this:
PUBLIC_DATOCMS_API_TOKEN=...
Once you've installed dependencies with npm install
(or pnpm install
or yarn
), start a development server:
npm run dev# or start the server and open the app in a new browser tabnpm run dev -- --open
To create a production version of your app:
npm run build
You can preview the production build with npm run preview
.