Integrating Sanity and Next.js - Which Library is Best?

3 replies
Last updated: Jul 14, 2021
hi all!I'm just starting to integrate Sanity with my Next.js app and am a bit confused which library I am supposed to use. I've seen examples using
and also all three libraries together. The last one confuses me as I get an impression that
should wrap the others. Am I right to think that
is the way to go?
Jul 14, 2021, 11:18 AM
Agreed, it's a bit confusing. I think the
-library is a kind of collection of useful libraries, including a client and image-url functions. We are using it for everything, and it works nicely for us:

One caveat I know of is that the client that's included has reduced functionality to reduce bundle-size . It's still fine for fetching data, but if you want to do writes to sanity from your frontend you have to use the
That might be the reason why you've seen people using both packages in the same project.

Seems like the client bundled in
is now the default
so it has full support for writes as well.
Jul 14, 2021, 1:00 PM
is your best place to start as it contains all the utilities you’ll need.
Jul 14, 2021, 1:22 PM
user Q
user T
, that's helpful!
Jul 14, 2021, 1:23 PM – build remarkable experiences at scale

Sanity is a customizable solution that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Categorized in