Sveltekit is a full-stack web framework built on top of Svelte that lets you create static sites and server-side-rendered (SSR) apps. It’s designed to be fast with a minimal footprint.
Our Sveltekit starter shows you how to create an example company page with nested routes, dynamic routes, and uses the Contentful GraphQL API to fetch content.
Run the following commands in your terminal to clone our Contentful Sveltekit starter and install dependencies.
Create a Contentful account with an empty space. Go to your Contentful space, then
Find your Space ID
Create an access token for the Content Delivery API
Create an access token for the Content Management API
Rename the .env.example at the root of your project to .env
In the new .env file replace
YOUR_SPACE_ID
YOUR_DELIVERY_TOKEN
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:
This will start the development server and open the app in a new browser tab.
The page will reload when you make changes.
Deploy your project.
For an easy to way to deploy it, use Vercel. Just don't forget to change the repository to your own after you've made changes.