Sanity + Nuxt: @sanity/client vs nuxt-sanity module - which to use?

40 replies
Last updated: Jan 27, 2026
Hi๐Ÿ‘‹, I'm on a project with Sanity + Nuxt. I configured it with
import sanityClient from '@sanity/client'
in
sanity.js
and it works.Now I see this doc
https://nuxt-sanity.netlify.app/#what-is-sanity and I'm wondering if it's the same or I rather

npm install nuxt-sanity
And in that case: will it overwrite, live with it, or create a conflict with the previous config? I may just try... however if someone already has experience with it ...
๐Ÿ™‚Thank you for any tip!
AI Update

Great question! You're actually looking at two different approaches to integrating Sanity with Nuxt, and understanding the difference will help you decide which path is best for your project.

What you have now (@sanity/client): You're using the core Sanity JavaScript client directly. This works perfectly fine and gives you full control over how you set up and use the client.

What nuxt-sanity offers: The nuxt-sanity module is a Nuxt-specific wrapper that provides:

  • Auto-configuration through nuxt.config.ts
  • Nuxt composables like useSanityQuery() for fetching data
  • Better integration with Nuxt's SSR/SSG features
  • Image URL helper integration
  • Simpler setup for visual editing features

Will they conflict? They won't necessarily conflict, but you'd be running two separate clients which is redundant. Here's what I'd recommend:

If your current setup with @sanity/client is working and you're comfortable with it, there's no urgent need to switch. However, if you want the benefits of Nuxt-native composables and cleaner integration, switching to nuxt-sanity would be worthwhile.

Migration approach: Instead of having both, I'd suggest replacing your current setup:

  1. Install: npx nuxi@latest module add sanity
  2. Configure in nuxt.config.ts:
export default defineNuxtConfig({
  modules: ["@nuxtjs/sanity"],
  sanity: {
    projectId: 'your-project-id',
    dataset: 'production',
  },
})
  1. Replace your manual sanityClient imports with the useSanityQuery() composable in your components
  2. Remove your old sanity.js file and @sanity/client dependency once everything's migrated

The nuxt-sanity module is essentially a convenience layer over the same @sanity/client you're already using, so you're not losing any functionalityโ€”just gaining some Nuxt-specific ergonomics. The Nuxt.js quickstart guide has detailed examples of using the module if you decide to make the switch!

Show original thread
40 replies

Sanity โ€“ Build the way you think, not the way your CMS thinks

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.

Was this answer helpful?