Starter kit for a nice JAM stack experience
pnpm
if you haven't alreadynpm install -g @sanity/cli
if you haven't alreadygit clone https://github.com/n00pper/turbo-svelte-sanity.git
cd turbo-svelte-sanity
pnpm install
apps/cms/sanity.json
file and replace the projectId
with the ID of your newly created project - the placeholder is <YOUR PROJECT ID>
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
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*
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:
API
tabCORS origins
and click Add CORS origin
http://localhost:3000
in the Origin fieldSave
Don't forget to add all URLs that your app can be accessed from