Deploying Next.js + Sanity to Production: A Checklist
A Next.js + Sanity site that runs on your laptop is not the same thing as one ready for real traffic. The gap between the two is a specific, boring, important checklist. Here’s the version we’d hand a team shipping their first one.
Environment and secrets
Sort out which values are public and which are server-only. Anything prefixed NEXT_PUBLIC_ ends up in the browser bundle — the project ID and dataset are fine there. Your SANITY_API_TOKEN is not: it stays server-side, in your host’s environment settings, never in the repo and never in the client bundle.
Content revalidation
Decide how published content reaches the site. ISR with a revalidation window is the baseline; a Sanity webhook that triggers on-demand revalidation makes publishing feel instant. Without one of these, editors publish and then wonder why the site hasn’t changed.
Image handling
Serve Sanity images through next/image with real width and height so layout doesn’t shift, and let the Sanity image pipeline handle sizing and format. Getting dimensions from the asset reference avoids both blurry images and cumulative layout shift.
Studio hosting and access
Decide where the Studio lives and who can reach it. Set the CORS origins for the domains that will query your dataset, lock down who can edit, and choose between Sanity’s hosted Studio and self-hosting it next to your app.
Build and deploy safety
Make sure a failed build can’t ship. Traffic should only switch to a new build after it compiles and passes checks, and you should have a one-step path back to the last working version. A broken deploy should be a non-event, not an outage.
Where SrvBot fits
SrvBot runs the Node front end and static assets on one platform, deploys on push, switches traffic only when the build succeeds, and hosts in the EU. It’s the same setup this site runs. More at /sanity.
The bottom line
Most production incidents on Sanity sites trace back to one of these six items being skipped. Work down the list before launch. When you’re ready to host it, /sanity and /get-started are the next steps.