Skip to content

Sanity CMS

The CMS panel in the left rail connects your site to a Sanity project. Once connected, Sanity Studio runs inside your dev server so you can author structured content — blog posts, product pages, settings, anything with a schema — while building the site visually.

You need a free Sanity account and at least one Sanity project before starting. If you don’t have one yet, click Create a project on sanity.io in the panel to open Sanity’s dashboard.

  1. Open the CMS panel in the left rail.
  2. Find your project ID at sanity.io/manage: click your project, and copy the ID shown near the top (e.g. 3do82whm). You can also paste the full manage URL — Plyy extracts the ID for you.
  3. Enter the Project ID and, if needed, the Dataset (defaults to production).
  4. Click Connect Sanity.

Plyy installs Sanity Studio’s dependencies into your project (this can take a minute), saves the project ID and dataset to your project’s .env, and restarts the dev server with a Studio route at /admin.

When the setup finishes the button label changes to Save — use it any time you want to point the project at a different Sanity project or dataset.

Click Open Studio ↗ to open Sanity Studio in your browser. Studio is served by the running dev server, so the button is disabled when the dev server is stopped — start it first from the toolbar.

Inside Studio you can create and edit documents, upload media, and manage anything your schemas define. Changes are saved to Sanity and immediately available to your site via GROQ queries.

Sanity only accepts sign-ins from browser addresses (origins) that are on your project’s allowlist. Plyy serves projects on its own ports (localhost:55515559, plus 5599 for a standalone Studio) so it never collides with other tools on your machine — but a fresh Sanity project doesn’t know those ports yet.

Plyy registers them for you when you click Connect Sanity, using your Sanity sign-in. If you weren’t signed in at that moment, the panel tells you and starts the sign-in in the terminal — finish it and press Save to retry. You can also allow the ports manually: open sanity.io/manage, pick your project, go to API → CORS origins, and add http://localhost:5551 through http://localhost:5559 and http://localhost:5599, each with Allow credentials checked.

Deploy schema pushes your local schema definitions to Sanity so Studio’s content tooling knows your document types.

Click Deploy schema. If you’re not already signed in to Sanity, the sign-in flow runs in the terminal panel below the editor:

  1. The terminal shows a provider list — pick one (GitHub, Google, etc.).
  2. Finish the sign-in flow in the browser that opens.
  3. Come back to Plyy and click Deploy schema again.

Once signed in, the schema deploys and the panel shows how many types were pushed.

Your project ships with src/lib/sanity.ts — a pre-configured Sanity client that connects to your project using the credentials in .env. Fetch content with GROQ in any Astro page or component:

import { sanity } from "../lib/sanity";
const pages = await sanity.fetch(`*[_type == "page"]{title, slug}`);

You can copy this snippet from the CMS panel with the Copy button next to the “Use content in a page” preview.

The AI chat has a cms mode that can write GROQ queries, scaffold schema types, and wire content into your pages — see AI editing for how to use it.

Click Disconnect at the bottom of the panel. Plyy removes the Sanity keys from .env and restarts the dev server. The scaffolded files — schemas, sanity.config.ts, and src/lib/sanity.ts — are kept in your project for reference.