The all-in-one Sanity toolkit for production-grade content-editable Next.js applications.
next-sanity overview: Explore everything the next-sanity package has to offer.defineLive, and the <VisualEditing /> component.next-sanity API reference for detailed type signatures and configuration options.Quicklinks: Sanity docs | Next.js docs | Clean starter template | Fully-featured starter template
Instantly create a new free Sanity project – or link to an existing one – from the command line and connect it to your Next.js application by the following terminal command in your Next.js project folder:
npx sanity@latest init
If you do not yet have a Sanity account you will be prompted to create one. This command will create the basic utilities required to query content from Sanity, and optionally embed Sanity Studio — a configurable content management system — at a route in your Next.js application. See the Embedded Sanity Studio guide.
If you do not yet have a Next.js application, you can create one with the following command:
npx create-next-app@latest
This README assumes you have chosen all of the default options, but should be fairly similar for most bootstrapped Next.js projects.
next-sanityInside your Next.js application, run the following command in the package manager of your choice to install the next-sanity toolkit:
npm install next-sanity @sanity/image-url
yarn add next-sanity @sanity/image-url
pnpm install next-sanity @sanity/image-url
bun install next-sanity @sanity/image-url
This also installs @sanity/image-url for [On-Demand Image Transformations][image-url] to render images from Sanity's CDN.
When using npm newer than v7, or pnpm newer than v8, you should end up with needed dependencies like sanity and styled-components when you installed next-sanity. In yarn v1 you can use install-peerdeps:
npx install-peerdeps --yarn next-sanity
You're looking at the README for v12, the README for v11 is available here as well as a migration guide.
v11 to v12v10 to v11v9 to v10v8 to v9v7 to v8v6 to v7v5 to v6v4 to v5
<0.4 to v4MIT-licensed. See LICENSE.