Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Best approach to structuring a repo for a studio and using separate repos for front end and studio.

5 replies
Last updated: Oct 5, 2021
hey everyone, i wanted to know what’s your best approach to structuring your repo for a studioI am redoing my portfolio site and i currently have the webView and the studio in the same repo but i feel like that’ll be an issue if i decide to redo my site
I would really like to know what approach you normally use when structuring monorepo or multiple
Oct 4, 2021, 7:19 AM
Hi Obi. My sense is a lot of people use monorepos. For myself, up to this point, I just keep a separate repo for my studio and a separate repo for my front end. I know there are many advantages to monorepos that I may not be taking advantage of, but for my brain, I just like to keep everything separate. I have a vsc window open for each repo, with two terminal panes at the bottom (one where I do git and file operations and another running the local dev). It works for me, but I'm also curious to learn more about the advantages of a monorepo approach.
Oct 4, 2021, 11:21 AM
I'll add that I have two informal conventions that help. I keep both repos in a plain, non-version controlled directory, and I use a naming convention
my-project
  my-project-studio
  my-project-app
Oct 4, 2021, 11:22 AM
hey
user U
i was trying to mirror the gatsby template so i started with a monorepo but midway through the project creation i remembered the whole reason i’m on sanity is because i want to be able to switch to another frontend framework later on so i think i will switch to your seperate repo approachi think if i use your same folder suggestion i can still use lerna for both repos

Thank you
Oct 4, 2021, 11:30 AM
Hi Obi. If you haven’t seen it already, be sure to check out this post . It’s a few years old but still applies completely.
I like to structure my projects how Knut outlines in that post. The top-level folder is git-controlled, with separate subfolders for my front end and my studio. Each gets committed to git but when I build (to Netlify, Vercel, etc.) it considers only the front end folder. My studio gets deployed to Sanity with the
sanity deploy
command. If I were to change out my front end framework, adding another folder would be no problem. Say I’m using Next.js. So in
project/
I have
next/
and
studio/
. Now I want to switch my site to use SvelteKit, so I add another folder,
svelte/
. I can work in
svelte/
and source from Sanity, all while maintaining the code in
next/
. When I’m ready to switch over, I just tell Netlify to build from
svelte/
instead of
next/
.
Oct 5, 2021, 4:00 AM
user A
thanksi thought i might have issues with the whole framework change but i guess the only issue is coming from the repo size which shouldn’t really be a problem
i think this is the approach i will be using in my next sanity project (i already converted and deployed with the split structure)
thanks a lot for the advice
Oct 5, 2021, 6:43 AM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?