Sanity stores your catalog, orders, addresses, newsletter subscribers and contact messages, and powers the Studio at /studio.
1. Create the project
- Go to sanity.io/manage and create a project with a dataset named
production. - Copy the Project ID into
NEXT_PUBLIC_SANITY_PROJECT_ID. - Keep
NEXT_PUBLIC_SANITY_DATASET=production.
2. Create two tokens
In API → Tokens:
| Token | Permission | Variable | Used for |
|---|---|---|---|
| Editor | Editor | SANITY_API_TOKEN |
Creating orders, addresses, ratings and messages |
| Viewer | Viewer | SANITY_API_READ_TOKEN |
Live content updates and draft previews |
Warning
Both tokens are server-only. Never put them in a NEXT_PUBLIC_ variable.
3. Add CORS origins
In API → CORS origins, add http://localhost:3000 and your live domain, with Allow credentials ticked. The Studio and live updates need it.
4. Load the sample data
pnpm exec sanity login
pnpm seed
See Seed data for details.