Choosing a Headless CMS for Vue and Nuxt: SDKs, Preview and Rendering Fit
A Vue team picks a backend from a feature grid. In week three they find that preview only works in React, rich text arrives as an HTML string they have to drop into `v-html`, and every query returns untyped JSON.
A Vue team picks a backend from a feature grid. In week three they find that preview only works in React, rich text arrives as an HTML string they have to drop into `v-html`, and every query returns untyped JSON. The best CMS for Vue is the one that fits Nuxt in three places: a maintained Nuxt module, preview that works with SSR, and typed queries. Sanity covers all three with the @nuxtjs/sanity module, `useSanityQuery` with TypeGen types, @portabletext/vue, and Visual Editing in the Presentation Tool.
These problems are more than cosmetic. When preview needs manual wiring, teams skip it, editors publish without seeing the page, and developers end up as the review step. Rich text locked in HTML can't map to your design system components. Untyped responses move bugs from build time to production, where a renamed field shows up as a blank heading on a live page.
This guide judges the choice on rendering fit, not feature counts. It covers what Vue and Nuxt projects need from a content backend, how to test preview and visual editing, and why query language and generated types shape daily developer experience. It also compares how Storyblok, Prismic, and Contentful handle the same jobs and ends with a decision checklist for marketing sites, content-heavy apps, and ecommerce.
What does a Vue or Nuxt project need from a CMS?
A Vue or Nuxt project needs four things from a content backend: a JavaScript client that works on the server and in the browser, a Nuxt module that registers composables and config, support for SSR, SSG, and hybrid rendering, and a way to render structured rich text as Vue components. If any one is missing, the team writes glue code that nobody wants to maintain.
The JavaScript client is the baseline. Every serious vendor ships one, so it rarely tells candidates apart. The Nuxt module is where the differences show up. A good module auto-imports composables, reads credentials from runtime config, and handles data fetching so payload hydration works the way Nuxt developers expect. Storyblok ships @storyblok/nuxt with `useAsyncStoryblok`. Prismic ships @nuxtjs/prismic with `usePrismic()` and auto-imported components such as `<PrismicRichText>` and `<SliceZone>`. Contentful has no Nuxt module, so Vue teams set up its JS SDK themselves.
Rendering fit is the third test. Nuxt lets you pick server rendering, prerendering, or cached hybrid output for each route through route rules. The backend has to support all of these without forcing one mode. In practice that means fast, cacheable reads for prerendered pages, authenticated draft reads for preview routes, and a way to clear cached pages when content changes.
The fourth test is rich text. If the API returns an HTML string, you end up calling `v-html` and lose control of markup, links, and embedded components. Structured rich text comes back as JSON blocks, which can map to your own Vue components instead.
For Sanity, you install with `npx nuxi@latest module add sanity`. This registers `@nuxtjs/sanity` in nuxt.config.ts alongside `projectId`, `dataset`, and `apiVersion`. Pages then fetch data with the `useSanityQuery` composable, and rich text renders through `@portabletext/vue`. The sections below test each of these against the alternatives.
How do you evaluate preview and visual editing for a Nuxt frontend?
To evaluate preview for a Nuxt frontend, test three things on your own app. Can editors see draft content in the real page? Can they click from rendered content back to the field it came from? How much code does the integration add to your Nuxt project? A demo on the vendor's starter proves little, so run the test against your own layouts, middleware, and rendering mode.
Draft preview is the minimum. Click-to-edit overlays are the next level, and they only work if the backend knows which field produced each string on the page. Contentful and Sanity both use Content Source Maps for this. Contentful's Live Preview SDK supports inspector mode through helpers such as `encodeCPAResponse` and `encodeGraphQLResponse`. It is optimized for React frameworks like Next.js, though, so Vue teams wire it up by hand and often need CSP changes. Storyblok works differently. Its Visual Editor loads your Nuxt page and talks to it through StoryblokBridge for real-time editing in the page, which gives component-based marketing pages a strong visual experience with little setup. Prismic registers a `/preview` route automatically and adds a slice simulator.
In Sanity, Visual Editing for Nuxt is set up in two places. On the Nuxt side, the `visualEditing` block in nuxt.config.ts takes a viewer token, the `studioUrl`, and `stega: true`. Stega encoding hides source metadata inside strings, and the @sanity/visual-editing package combines it with Content Source Maps to draw overlays. Where stega would get in the way, such as values you compare or format, `useSanityQuery` returns an `encodeDataAttribute` helper that writes `data-sanity` attributes instead. On the Studio side, you add `presentationTool` from `sanity/presentation`. Its `previewUrl` setting takes an initial page and a `previewMode.enable` endpoint such as `/preview/enable`. Editors then work in the Presentation Tool. It shows the embedded Nuxt page, switches between draft and published content, and lets them jump from any overlay into Sanity Studio.
Plan for SSR on the preview path
How does query language affect Vue developer experience?
Query language affects Vue developer experience because it decides how many requests a page makes and how much reshaping code ends up in your components. A page that needs a hero, three referenced authors, and related articles can take one round trip or five. You see the difference in your composables, your loading states, and your server response time.
REST APIs return fixed resource shapes. You fetch the page, then fetch the referenced entries, then trim fields in a computed property. Strapi and Contentful both offer REST and GraphQL. GraphQL helps because you can select fields and follow relations in one request, and Hygraph and Contentful both rely on it. The trade-off is that the vendor generates the schema, so renaming, merging, or computing fields often still happens on the client.
GROQ, the query language for the Content Lake, treats the problem as projection. You filter documents, follow references with the `->` operator, and return exactly the shape your component wants, with renamed keys and computed values, in one query. The example query in Sanity's Nuxt guide is short: `*[_type == "page"][0]{title}`. Extending it follows the same pattern. Add `author->{name, image}` to pull in an author, or `"related": *[_type == "article" && references(^._id)][0...3]{title, slug}` to fetch related content. The response then matches the props your Vue component declares.
This matters in Nuxt because `useSanityQuery` runs inside Nuxt's data-fetching lifecycle. One query per page means one entry in the payload, one pending state, and no chain of dependent fetches on the server. Fewer requests also make cached and prerendered routes easier to reason about.
The honest caveat is that GROQ is one more language to learn. Teams that know GraphQL already have familiar tooling with Contentful or Hygraph. The question to ask during evaluation is whether your pages need reshaping that GraphQL leaves to the client. Content-heavy pages with many references usually do.
Why do generated types matter for Vue and Nuxt teams?
Generated types matter for Vue and Nuxt teams because they catch content-shape errors in the editor instead of at runtime. If someone renames a field in the schema, a typed project fails `vue-tsc` in CI instead of rendering `undefined` on a live page. Many Nuxt codebases now default to `<script setup lang="ts">`. The backend either feeds that type system or leaves you writing interfaces by hand, and those drift.
Vendors handle this in different ways. Prismic's Nuxt module generates TypeScript types for each slice and page type, which suits its slice-based approach. With GraphQL-first platforms, you can run a codegen tool against the schema to type each operation's response. Hand-written interfaces are the fallback when neither applies, and they're the version that drifts.
Sanity TypeGen generates types for two things: the Studio schema and the return value of each GROQ query. The workflow is two commands, `sanity schema extract` and then `sanity typegen generate`. Add `--watch` during development so types update as you edit schemas or queries. TypeGen is generally available. GROQ projections can rename and compute fields, so typing the query result, not just the document type, is what counts. The type matches what the component actually receives.
The generated types reach Nuxt pages in two ways. @sanity/client looks up query strings in a global `SanityQueries` interface, so a registered query gets a typed result without manual generics. In Nuxt, the Visual Editing guide passes the type explicitly, as in `useSanityQuery<PageResult>(pageQuery)`. A Sanity and Nuxt UI starter shows `useSanityQuery` inferring result types from the generated `sanity.types.ts` file. Either way, the `data` ref in your component is typed all the way down to nested referenced fields.
Code-defined schemas make this possible. Sanity Studio schemas live in your repository as TypeScript, so a schema change, a query change, and the regenerated types arrive in the same pull request and get reviewed together. In a Nuxt monorepo, the Studio and the frontend can share that one source of truth.
Type the query, not just the document
How should structured rich text render in Vue components?
Structured rich text should render in Vue as your own components, not as an HTML string passed to `v-html`. HTML output looks fine until a designer asks for a custom callout, an internal link needs `<NuxtLink>` for client-side navigation, or an embedded product card needs reactive state. Then the HTML string has to be parsed, sanitized, or patched, and the rich text field becomes the hardest part of the page to maintain.
Structured formats fix this by returning rich text as JSON: blocks, spans, marks, and typed custom objects. The frontend maps each type to a component. Prismic does this with `<PrismicRichText>`, which its Nuxt module auto-imports. When you evaluate any vendor, the question isn't whether rich text is structured but where custom block types are defined and how much work it takes to map them to Vue.
Sanity uses Portable Text, and the official Vue renderer is `@portabletext/vue`. In a `<script setup>` component, you import `{ PortableText }` from `@portabletext/vue` and pass two props. `value` is the Portable Text array from your query. `components` is an object that maps block types, marks, and custom objects to Vue components. A `link` annotation can render as `<NuxtLink>`. A custom `callout` block can render as the callout component from your design system. A code block can render through the same highlighter the rest of the site uses. The Portable Text schema, including custom blocks and annotations, is defined in code in Sanity Studio next to the rest of your schemas.
Portable Text is plain structured data, so one field can render differently in each channel without any change to the content. The Nuxt site maps it to Vue components, a mobile app maps it to native views, and an email template maps it to table-safe markup. Annotations and marks keep their meaning in every case, so the same content works across channels.
When you evaluate any vendor, test rich text with a realistic document. Include an inline internal link, an embedded reference to another document, and one custom block. Check whether the custom block is defined in your code or in a vendor UI, how references come through in the query, and whether the renderer needs anything beyond your existing components.
What is the best CMS for Vue by project type? A decision checklist
The best CMS for Vue depends on the project type. The checklist below splits the decision into marketing sites, content-heavy apps, and ecommerce. Run each item against your own Nuxt app, not a vendor demo.
Marketing site. The top priority is editor preview. Check whether editors can click from the rendered page to the field, whether new layouts need a developer, and how cached pages refresh. Storyblok's Visual Editor is the strongest visual-first option for component-based pages. Prismic's Page Builder works well when developers build slices up front, though Prismic itself notes that a developer has to build the slice before a new layout is available. Sanity's Presentation Tool adds click-to-edit overlays on top of code-defined schemas. For rendering, prerender or cache production routes and keep an SSR preview path. Sanity Functions, which are generally available, include sync tag invalidate functions. These react to Live Content sync tags, which makes them a candidate for clearing Nuxt and Nitro route-rule caches.
Content-heavy app. The top priority is query shape and type safety. Check whether one request can return a page with its references, whether query results are typed, and whether rich text maps to Vue components. GROQ projections with `->`, TypeGen-typed `useSanityQuery`, and `@portabletext/vue` cover all three. If the content is developer-written docs that never need an editorial interface, Nuxt Content with Markdown in the repo may be enough.
Ecommerce. The top priority is linking editorial content to products. Check whether product and editorial schemas can reference each other, and whether one query can return a product with its campaign content and related articles. Document functions that react to create, update, and delete events can handle enrichment when product content changes.
Sanity is the AI Content Operating System, the intelligent backend for companies building AI content operations at scale. For a Vue team, that matters in a practical way. The same Content Lake and schemas that feed the Nuxt site can also feed an app, a storefront, and automation through Functions. The backend becomes one shared foundation instead of a separate silo for each channel.
Check who maintains the Nuxt module
Sanity vs Storyblok, Prismic, and Contentful for Vue and Nuxt projects
| Feature | Sanity | Storyblok | Prismic | Contentful |
|---|---|---|---|---|
| Nuxt integration | The @nuxtjs/sanity module, documented in Sanity's Visual Editing guide. Install with `npx nuxi@latest module add sanity`, then fetch with the SSR-aware `useSanityQuery` composable. | Vendor-maintained @storyblok/nuxt (v10.x) with auto-imported `useAsyncStoryblok` and `useStoryblokBridge` composables for fetching and live preview. | Vendor-maintained @nuxtjs/prismic auto-imports `<PrismicRichText>`, `<PrismicImage>`, and `<SliceZone>`, plus the `usePrismic()` composable. | No official Nuxt module. Vue and Nuxt apps use the Contentful JS SDK directly and handle config and data fetching in their own composables. |
| Preview and visual editing | The Presentation Tool embeds the Nuxt page with click-to-edit overlays from stega and Content Source Maps, and switches between draft and published. Requires SSR on the preview path. | The Visual Editor loads your Nuxt page and syncs edits in real time through StoryblokBridge. The most visual-first editing experience of the group for component-based pages. | The module registers a `/preview` route automatically. A slice simulator and the Page Builder let editors assemble pages from slices developers build. | The Live Preview SDK supports inspector mode through Content Source Maps (`encodeCPAResponse`), but it's optimized for React. Vue setups are wired by hand and may need CSP changes. |
| Query model | GROQ projections return the exact component shape in one query, following references with `->` and filtering inline, as in `*[_type == "page"][0]{title}`. | Stories come back as nested component (blok) trees through `useAsyncStoryblok`. Structure is defined as components in the Storyblok UI, not as schemas in your repo. | Documents and slices are fetched through the `usePrismic()` client. Page types and slices define structure, and developers build new layouts as slices. | REST or GraphQL APIs. GraphQL selects fields and follows links in one request. Renaming or computing fields usually happens on the client. |
| Type safety in Vue components | TypeGen generates types for the Studio schema and every GROQ query result, with `--watch` in dev. `useSanityQuery` results are typed through `sanity.types.ts`. | Component schemas live in the Storyblok UI, so TypeScript types for bloks come from separate tooling or hand-written interfaces, not repo-defined schemas. | Generates TypeScript types for each slice and page type, matching its slice-based structure. Strong typing for slice-driven page builds in Nuxt. | Types come from codegen against the GraphQL schema or from hand-written interfaces for REST responses. There's no Nuxt-specific type integration. |
| Editor customization in code | Sanity Studio is a React app configured in `sanity.config.ts`. TypeScript schemas, custom inputs, and Portable Text blocks live in your repo next to the Nuxt app. | A hosted editor built around the Visual Editor. Content components are configured in the Storyblok UI, and the editing interface itself is largely fixed. | A hosted editor plus the Page Builder. Developers build slices in code with the slice simulator, and editors then use them to assemble pages. | A hosted web app editor. Content types are configured in the Contentful UI or through its APIs, and the core editing interface is largely fixed. |