Monorepo with Sanity Studio (content CMS) and Next.js frontend (from next-vercel-shadcn).
studio/– Sanity Studio (schema, structure, components). Content for weka.io blog and related types.frontend/– Next.js app (Shadcn, Tailwind). Consumes the same Sanity project/dataset for the blog and optional embedded Studio.
- Node.js 20+ (or 22+)
- Same Sanity project for both apps:
ult5g8gw, datasetproduction(or set in env)
-
Install root dependency (for running both apps together):
npm install
-
Studio (already has its own
node_modulesif you moved it; otherwise):cd studio && npm install && cd ..
-
Frontend (already ran once; if needed):
cd frontend && npm install && cd ..
-
Environment
frontend/.env.localis set withNEXT_PUBLIC_SANITY_PROJECT_ID=ult5g8gwandNEXT_PUBLIC_SANITY_DATASET=production. Adjust if you use another dataset.- Optional:
SANITY_STUDIO_PREVIEW_URL(e.g.http://localhost:3000) so Studio’s Presentation tool points at your local frontend.
From repo root:
-
Studio only (default: http://localhost:3333):
npm run dev:studio
-
Frontend only (default: http://localhost:3000):
npm run dev:frontend
-
Both (Studio + Frontend in parallel):
npm run dev
npm run build– build frontend only (used by Vercel; avoids building Studio)npm run build:frontend– build Next.jsnpm run build:studio– build Studionpm run build:all– build both studio and frontend (for local)
- Studio: from
studio/, runnpm run deploy(or your host’s Sanity deploy). - Frontend (Vercel)
So only the Next.js app is built (Studio is a separate app and not deployed to Vercel):- In the Vercel project: Settings → General → Root Directory → set to
frontendand Save. - Redeploy. Vercel will run
npm installandnpm run buildinsidefrontend/; no Studio build runs. - In Settings → Environment Variables, set
NEXT_PUBLIC_SANITY_PROJECT_ID,NEXT_PUBLIC_SANITY_DATASET, and optionallySANITY_API_READ_TOKEN.
- In the Vercel project: Settings → General → Root Directory → set to
- Frontend (other hosts): build from the
frontend/directory and set the same env vars.