Skip to content
CMS and web technologies

Astro and Sanity: An Honest Look at Sanity CMS for Astro Sites

Sanity gives editors one of the best editing screens around, and it works well with Astro. Here is what it costs, where it slows developers down, and who it suits.

Harsh PrajapatiFull stack developer
Published
Reading time
9 min

Astro and Sanity: An Honest Look at Sanity CMS for Astro Sites

Astro and Sanity work well together: Sanity's official @sanity/astro integration lets an Astro site read content from Sanity's hosted Content Lake, embed Sanity Studio as an admin route and show live visual editing. Sanity is the right pick when your marketing team edits a lot and values a polished editor, and when the same content feeds more than one channel. The trade-offs are a per-seat monthly fee, content that lives on Sanity's servers, and, in our projects, a slower and harder developer workflow than the other CMS we have used with Astro.

This article is for business owners, marketing leads and agencies choosing a CMS for an Astro website. It explains how the pieces fit, what Sanity costs as of November 2026, and where we think it earns its price. If you are still comparing options, start with our overview of the best headless CMS for Astro.

How Astro and Sanity fit together

Astro builds the website your visitors see, and Sanity stores and manages the content your team writes. The two talk through Sanity's APIs: at build time, or on each request for on-demand pages, Astro asks Sanity for the content it needs and turns it into HTML.

Sanity has three parts worth knowing about:

  • Sanity Studio, the editing app your team logs into. It is open source under the MIT licence and you configure it in code.
  • The Content Lake, Sanity's hosted store where documents and images live. You do not run a server or database for it.
  • GROQ, Sanity's query language, which Astro uses to ask for exactly the fields a page needs.

Astro has no admin screen of its own, which is why it pairs with a headless CMS in the first place. If headless is new to you, our plain-words guide to what a headless CMS is explains the idea and compares Sanity with Strapi, Contentful and Payload.

The official @sanity/astro integration

The @sanity/astro package is Sanity's own integration for Astro, published under the MIT licence. According to its README on GitHub (opens in a new tab), you add it with one command, plus the React integration if you want to embed the Studio:

Terminal
npx astro add @sanity/astro @astrojs/react

Once it is installed, the integration gives you:

FeatureWhat it does for your site
sanity:clientA ready Sanity client you import anywhere in Astro to fetch content
Embedded StudioMounts Sanity Studio on a route you choose, such as /admin, inside the same project
sanityLoaderLoads Sanity documents into Astro content collections (marked experimental)
Image helpersRenders Sanity images through @sanity/astro/image
Visual editingClick-to-edit overlays that link a page element back to its field in the Studio

Embedding the Studio means editors visit one address on your own domain. It still needs the React integration and CORS settings for your domains.

Querying content with GROQ

Sanity describes GROQ (opens in a new tab) (Graph-Relational Object Queries) as a way to describe exactly what information your application needs. A typical query for a blog list looks like this:

JavaScript
import { sanityClient } from "sanity:client";

const posts = await sanityClient.fetch(
  `*[_type == "post"] | order(publishedAt desc){ title, "slug": slug.current, excerpt }`
);

GROQ is powerful once learned, and it can join related documents in one request. It is also one more language your developer has to know, and it is only used by Sanity. That matters for the lock-in question further down.

Visual editing works best with on-demand pages

Sanity's visual editing lets an editor open the Presentation tool in the Studio, see the real website in a preview pane, and click any heading or image to jump to the field behind it. For a marketing team this can be the deciding feature.

The catch for Astro is rendering. Astro prerenders every page as static HTML by default, and on-demand rendering needs a server adapter, as the Astro docs on on-demand rendering (opens in a new tab) explain. Sanity's visual editing guide for Astro (opens in a new tab) says visual editing requires server-side rendering because draft mode depends on checking a cookie on each request, and that static output mode will not work.

In practice that means one of two set-ups:

  1. A server-rendered site with an adapter (Node, Vercel, Cloudflare or similar), where every page can show drafts in the preview.
  2. A mostly static public site plus a separate preview deployment that runs on demand, so editors get visual editing while visitors still get fast prebuilt pages.

The second option keeps the public site fast, but it is more work to set up. Decide before the build starts, because it affects hosting and cost. If you would rather not wire up draft mode, preview routes and tokens yourself, our Astro development team can set up Sanity visual editing for you.

  1. Editor opens Presentation tool
  2. Studio loads your site in a preview
  3. Draft mode cookie is set
  4. Astro renders drafts on demand
  5. Editor clicks to edit

What Sanity costs per seat

Sanity charges by editor seat, not by site or by page. These figures are from Sanity's pricing page (opens in a new tab), read in November 2026; check it before you budget, because plans change.

FreeGrowthEnterprise
PriceUSD 0USD 15 per seat a monthCustom
SeatsUp to 20Up to 50Custom
RolesAdministrator and ViewerAdministrator, Viewer, Editor, Developer, ContributorCustom
Datasets2, public only2, private or publicCustom
Documents10,00025,000Custom
API CDN requests a month1 million1 millionCustom
API requests a month250,000250,000Custom
Bandwidth a month100 GB100 GBCustom

Viewers do not use a seat on any plan, so people who only need to look at content are free. The Growth plan can buy extra usage, for example bandwidth at USD 0.30 per GB, while the Free plan cannot.

What this means for a business:

  • A small team can start free, but the Free plan has only two roles and public datasets. Sanity's data safety docs (opens in a new tab) say anyone can query a public dataset without logging in, although drafts stay hidden. That is fine for a public website, less so for internal content.
  • A marketing team of six editors on Growth costs 6 x USD 15 = USD 90 a month, or USD 1,080 a year, before any extra usage.
  • Static Astro sites use few API requests, because content is fetched at build time. Server-rendered pages and live previews use more, so caching matters.

For a full picture of build and running costs, see our guide to Astro website development cost.

Hosted content and lock-in

With Sanity your content lives in Sanity's hosted Content Lake, not on a server you own. That means no database to patch, back up or scale, but your editing depends on Sanity's service and pricing.

You are not trapped. Sanity's export documentation (opens in a new tab) shows a single CLI command that downloads every document and asset into a gzipped archive, with documents in an NDJSON file and images and files alongside. So the raw content can always leave.

What does not move easily is everything built around it: the Studio configuration, the GROQ queries in your Astro pages, and Portable Text, Sanity's format for rich text. Moving to another CMS means rewriting those parts. Compare that with a self-hosted option such as Astro with Directus, where the content sits in your own SQL database, or Astro with Keystatic, where content is plain files in your Git repository.

Images through the Sanity CDN

Images uploaded to Sanity are served from cdn.sanity.io, and the Sanity image pipeline (opens in a new tab) can scale, crop and convert them on the fly using URL parameters. Adding auto=format returns the most efficient format the visitor's browser supports, and w and h set the size.

Editors upload one large image and the site asks for the exact sizes each layout needs, which helps page weight and Largest Contentful Paint. Our Core Web Vitals guide explains why image size matters so much for speed scores. Keep in mind that image traffic counts towards your plan's bandwidth.

Our experience with Sanity on Astro

We want to be fair here, because Sanity is a well-made product and our clients enjoy using it. The editor is where Sanity shines: real-time collaboration, a clean interface, and visual editing that lets marketers see what they change.

The developer side asks more of you. Schemas live in code, queries are written in GROQ, the Studio needs its own configuration and CORS settings, and visual editing needs on-demand rendering, tokens and draft-mode routes. None of that is wrong, but each step adds time, and on a fixed budget that time is paid for by the client.

So the trade-off for a business is simple to state: you pay more in build time and a monthly seat fee, and in return your editors get one of the nicest editing experiences available.

When Sanity is the right pick

Sanity is a strong choice when editing quality and content reuse matter more than the lowest build cost.

Choose Sanity whenLook elsewhere when
A marketing team edits often and values a polished editorOne or two people update the site a few times a month
Several people work on content at the same timeYou want content on a server or database you own
The same content feeds a website, an app and other channelsBudget is tight and per-seat fees would add up
Editors want visual, click-to-edit previewsThe site must stay fully static with no server rendering
You prefer not to host or maintain a CMS serverYour developer team prefers SQL or plain files over GROQ

For a small business site with a few editors, a Git-based option such as Keystatic can be cheaper. For a business that wants to own its data and still give editors a good admin, Directus is our favourite for client projects, and Astro with Strapi is another self-hosted route.

Where to start

Write down who will edit the site, how often, and where else the content must appear. Then decide whether visual editing is a must-have, because that decides whether your Astro site needs on-demand rendering.

If the answers point to Sanity, budget for seats and a little extra build time, and you will get an editor your team enjoys using. If you want a second opinion before committing, our headless CMS development team can compare Sanity with the alternatives for your case, and our Astro website development service can build the site on whichever CMS wins.

Frequently asked questions

Does Sanity work with a static Astro site?

Yes. Astro can fetch Sanity content at build time and output fully static pages, which is fast and uses few API requests. The exception is Sanity's visual editing, which needs server-rendered pages, so a static site needs a separate on-demand preview deployment if editors want it.

Is Sanity free to use with Astro?

Sanity's Free plan costs nothing and allows up to 20 seats, but it has only Administrator and Viewer roles and public-only datasets. Teams that need editor roles or private datasets move to the Growth plan at USD 15 per seat a month. The Astro integration itself is free and open source.

Do I need to learn GROQ to use Sanity with Astro?

Your developer does, your editors do not. GROQ is the query language Astro uses to fetch content from Sanity. Editors only work in Sanity Studio and never see queries.

Can we move away from Sanity later?

Yes. Sanity lets you export all documents and assets with one CLI command. The content is portable, but the Studio setup, GROQ queries and rich text handling in your Astro code would need rewriting for a new CMS.

Sources

The facts in this article were checked against these pages, last reviewed 26 November 2026.

  1. sanity-astro: Sanity integration for Astro, GitHubgithub.com/sanity-io/sanity-astro
  2. Visual Editing with Astro, Sanity Docssanity.io/docs/astro/astro-visual-editing
  3. Pricing, Sanitysanity.io/pricing
  4. Keeping your data safe, Sanity Docssanity.io/docs/content-lake/keeping-your-data-safe
  5. GROQ, Sanity Docssanity.io/docs/groq
  6. Export a dataset, Sanity Docssanity.io/docs/content-lake/exporting-data
  7. Image URLs, Sanity Docssanity.io/docs/image-urls
  8. On-demand rendering, Astro Docsdocs.astro.build/en/guides/on-demand-rendering/
Harsh Prajapati, the author

Written by

Harsh Prajapati

Freelance full stack developer, founder of Worklancio

Web developer since 2018, freelancing since 2022. Builds WordPress sites and plugins, web apps and CRMs from Ahmedabad.

You may also like