turbo-svelte-sanity Svelte Themes

Turbo Svelte Sanity

Starter kit for a nice JAM stack experience

Turbo-Svelte-Sanity

Starter kit for a nice JAM stack experience

How to get started

  1. Install pnpm if you haven't already
  2. Install the Sanity CLI with npm install -g @sanity/cli if you haven't already
  3. Create a blank new Sanity project
  4. git clone https://github.com/n00pper/turbo-svelte-sanity.git
  5. cd turbo-svelte-sanity
  6. pnpm install
  7. Find the apps/cms/sanity.json file and replace the projectId with the ID of your newly created project - the placeholder is <YOUR PROJECT ID>
  8. pnpm dev

An example of the modified sanity.json file would look like this:

"api": {
  "projectId": "abcd1234",
  "dataset": "production"
},

You'll see that it is a blank Sanity project so you'll need to create a Sanity schema

If you are new to SvelteKit, you can start learning about it here

Installation troubleshoot

Sanity can misbehave sometimes and will throw an error regarding missing packages

In the error message it will recommend to run the sanity install *package* script, but you should not because it uses another package manager internally

Instead you should add the missing package with pnpm like so:

pnpm add --filter @tss/cms *package*

Accessing data troubleshoot

To allow your client app to fetch data from your CMS, you must add the URL of the site to CORS origins at sanity.io

Follow these steps to resolve CORS errors:

  1. Select your project in the Sanity Manager
  2. Select the API tab
  3. Scroll to CORS origins and click Add CORS origin
  4. Paste in http://localhost:3000 in the Origin field
  5. Click Save

Don't forget to add all URLs that your app can be accessed from

Top categories

Loading Svelte Themes