Home
Support Forums

Deploy monorepo to subdomain or sub folder

Hi there, first post here.

I’m building a Next.js site with Sanity.io as a CMS for a client. I’ve got the project in a monorepo with client and studio subfolders for the Next site and the Sanity front end, respectively. I’ve got the client directory deployed to https://diversified-beauty.netlify.app/ (adding the final domain once the site is complete) and I’d like to deploy the studio folder to either a subdomain or a subdirectory on the site. I can’t find documentation for this specific case so I figured I’d ask. Also, would there be a best practice in this case (subdomain vs subdirectory)?

Thanks in advance for any help that can be offered!

Brian

You can create another site with a different base directory and publish it as a subdomain - the process is same as deploying a new website. Then you can have 2 independent websites to manage. But, you’d have to make sure you don’t trigger a build for both websites on a push to repo especially if the content in both the websites doesn’t change. So, you’d have to add a build ignore script to skip such builds.

You could use subfolders, but the workflow for that would be like: