### SvelteKit template blog

### A simple blog template built with SvelteKit and DatoCMS

[

**Want to create your own starter project?** Learn how to do that in our documentation!

](https://www.datocms.com/docs/general-concepts/project-starters-and-templates.md#generate-a-project-starter-button)

## SvelteKit + DatoCMS demo

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.

## Demo

Have a look at the end result live:

### [https://sveltekit-demo-eta.vercel.app/](https://sveltekit-demo-eta.vercel.app/)

## How to use

### Quick start

1.  [Create an account on DatoCMS](https://datocms.com/).
    
2.  Make sure that you have set up the [Github integration on Vercel](https://vercel.com/docs/git/vercel-for-github).
    
3.  Let DatoCMS set everything up for you clicking this button:
    

[(Image content)](https://dashboard.datocms.com/deploy?repo=datocms/sveltekit-demo)

### Local setup

Once the setup of the project and repo is done, clone the repo locally.

#### Set up environment variables

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):

```bash
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:

```bash
PUBLIC_DATOCMS_API_TOKEN=...
```

## Developing your project locally

Once you've installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```bash
npm run dev# or start the server and open the app in a new browser tabnpm run dev -- --open
```

## Building

To create a production version of your app:

```bash
npm run build
```

You can preview the production build with `npm run preview`.