Getting live on Netlify

  1. Create a new project in Netlify, and click “Import an existing project” on your newly created copy of the boilerplate. This is probably hosted on Github!

  2. Click “Add environment variables” > “Import from a .env file”. Paste the entire contents of .env.development. You will need to change anywhere it says localhost.

// Change these to the netlify domain
NEXT_PUBLIC_SITE_ROOT="http://localhost:3000"
NEXT_PUBLIC_CMS_PREVIEW_URL="http://localhost:3000/api/preview"
  1. Click deploy!

  2. After you have a new netlify hosted domain, you’ll want to add that to your Sanity settings as the “Custom studio URL”

https://sprout-boilerplate.netlify.app/admin
  1. You’ll need to add a few CORS origins to your API Settings in Sanity. All domains need “Allow Credentials”. If you have a purchased domain connected to your Netlify Deployment, add that too!
https://sprout-boilerplate.netlify.app
https://boilerplate.sprout.store

// Allows for branch deploys in Netlify
https://sprout-boilerplate*.netlify.app
  1. You can add a quick access deploy button in your Sanity admin panel. Click “Deploy” in your dashboard and “Add Project”, you will need the following:
Site Name Production
Site ID Project Configuration > General > Project ID
Build Hook Project Configuration > Build & Deploy > Build Hooks
Branch main
Access Token User settings > Applications > Personal Access Tokens

ISR and Cache Revalidation