Everything you need to build a SvelteKit project with Contentful. This starter shows you how to:
Clone this repository
git clone https://github.com/contentful/sveltekit-starter.git
Install dependencies.
npm install
Create a Contentful account with an empty space. Go to your Contentful space and
.env.example
at the root of your project to .env
(so it is ignored by Git)..env
file, replace YOUR_SPACE_ID
, YOUR_DELIVERY_TOKEN
and YOUR_MANAGEMENT_ACCESS_TOKEN
with the values from the previous step.The project comes with a Contentful set up command that imports the required content model and adds sample content to your space.
Run the following command to import the content model.
npm run setup
npm run dev
This will start the development server and open the app in a new browser tab.
The page will reload when you make changes.
To create a production version of your app:
npm run build
You can preview the production build with npm run preview
.
To deploy your app, you may need to install an adapter for your target environment.