
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThe Next.js equivalent to gatsby build && gatsby serve is:
npm run build && npm run startor if you're using pnpm/yarn:
pnpm build && pnpm start
# or
yarn build && yarn startThis works the same way as your Gatsby workflow:
npm run build (runs next build) creates an optimized production buildnpm run start (runs next start) serves that production build locally on http://localhost:3000 by defaultThis lets you test the production build locally to catch any differences between development and production mode before deploying. Common differences you might catch include:
.env.production or .env.local files)generateStaticParams or data fetching problemsIf you're also running Sanity Studio alongside your Next.js app (like in a monorepo), you can test a production build of the Studio locally with npm run build in the Studio directory, as mentioned in the Sanity Studio development docs.
The production build is important to test because Next.js behaves quite differently in development mode (with features like Fast Refresh, more verbose error messages, and unoptimized bundles) compared to the optimized production build that gets deployed.
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store