Skip to content

docs(skill): recommend standalone Studio over embedded for Next.js#52

Merged
joneidejohnsen merged 2 commits into
mainfrom
docs/recommend-standalone-studio-nextjs
Jun 10, 2026
Merged

docs(skill): recommend standalone Studio over embedded for Next.js#52
joneidejohnsen merged 2 commits into
mainfrom
docs/recommend-standalone-studio-nextjs

Conversation

@joneidejohnsen

@joneidejohnsen joneidejohnsen commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Flips the Next.js architecture recommendation from embedded Studio to a standalone Studio in a simple monorepo layout (studio/ + web/), aligning the skill with the new onboarding flow.
  • Documents why standalone wins: sanity dev/sanity build run on Vite (10-30x faster than compiling the Studio through next dev/next build), Studio auto-updates only work standalone (Next.js does not support ESM with import maps), TypeGen watch mode only works with sanity dev, and a separate Studio keeps the content model from becoming website-centric.
  • nextjs.md: standalone Studio is now Option A with rationale and CORS setup; the embedded Studio setup section is replaced with standalone setup plus migration steps for existing embedded Studios.
  • project-structure.md: monorepo (no workspace tooling required) is now the recommended structure with a frontend; embedded Studio demoted to a legacy note.
  • get-started.md: Studio creation now uses --output-path studio from the repo root with an explicit warning not to run the CLI inside a Next.js app (it switches to the embedded flow); the Next.js scaffold lands in web/ alongside it.
  • typegen.md, visual-editing.md, SKILL.md: monorepo TypeGen config is the primary example, the Presentation previewUrl snippet gains the origin required for standalone Studios, and quick-reference descriptions drop embedded Studio.

Test plan

  • Review rendered markdown for the six touched files
  • Sanity-check the standalone Studio CLI command (npm create sanity@latest -- ... --output-path studio) against the current CLI behavior
  • Confirm the onboarding agent prompt ("getting-started reference") now produces a standalone studio/ + web/ layout when followed end-to-end

Made with Cursor

joneidejohnsen and others added 2 commits June 9, 2026 18:20
Embedding the Studio in the Next.js app slows dev/builds (Studio compiles
through next build instead of Vite), rules out Studio auto-updates (Next.js
lacks ESM import map support) and TypeGen watch mode, and nudges content
models toward being website-centric. Flip the recommendation to a standalone
Studio in a simple monorepo layout (studio/ + web/) and add migration steps
for existing embedded Studios.

Co-authored-by: Cursor <cursoragent@cursor.com>
Onboarding flows start the agent from a parent folder containing the
Studio (studio/ or studio-*) next to the app folder. Teach the
get-started reference to find the Studio config across the workspace,
locate the app folder before detecting the framework (asking the user
when ambiguous), and run the smoke test from the app folder.

Co-authored-by: Cursor <cursoragent@cursor.com>

@jwoods02 jwoods02 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, definitely improvement but still doesn't give good instructions for what to do if an agent runs inside an existing nextjs app instead of in a parent folder to be able to do the side by side setup.

EDIT: I've taken another look at this in the context of the getting started guide also. I think this can be merged as is, but I would think about following with an escape hatch for users running this in an existing app folder, either tell the skill to return and tell the user to run again in a different folder or propose a different solution, right now the agent might guess

@mwritter mwritter left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good - it should be enough to steer the agent in the right direction

@joneidejohnsen
joneidejohnsen merged commit 2d7b7c0 into main Jun 10, 2026
3 checks passed

**RESUME TRIGGER:** If the user says "Continue Sanity setup", check what's already configured:
- Does `sanity.config.ts` exist? → Studio is set up
- Does `sanity.config.ts` exist (typically in a `studio/` folder)? → Studio is set up

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sanity.config.ts, unless I'm wrong, has to be top-level next to package.json. It should only be in a studio/ folder, if that folder has studio/package.json

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggesting a /studio subfolder isn't a clean or equivalent alternative to embeddable studios. The subfolder approach is a bit of untested territory and the safest approach is to co-locate and use the same package.json, but not create any /app/studio/[...splat]/page.tsx routes.
We can and should have a convention where studio code like schemas live in a subfolder, if we use sanity/studio for it then it becomes a natural fit for functions, where you may have sanity/functions/sync-tag-invalidate too. The /app might also setup sanity live in sanity/live.ts.

In any case sanity.config.ts, sanity.cli.ts etc etc must be in the same folder as the package.json installing them. And we shouldn't direct the agent to suddenly create a second package.json as that is the poor mans monorepo, and often won't work with vercel deployments (while the colocated approach can work by changing the build command to for example next build && sanity build --out /studio and have a vercel.json that sets up url rewrites for /studio to the static build).

DevZonayed pushed a commit to DevZonayed/nexalance-skill-sanity-io-agent-toolkit that referenced this pull request Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants