Structure of subdomains in repository/branches

Hi all,

Very excited to be getting my project on the road finally. I have a question I need help with.

I am building a SaaS website and my use case is as follows:

  1. User signs up at website.com (Website.com is intended to be the landing page for my service with articles and etc not the actual service)

  2. The user logs in and is redirected to app.website.com (This is the user using the app now)

How do I structure this in terms of my repository on GitHub?

  1. Do I simply handle everything - the app and the landing site - on my single repository. I would have to implement subdomain routing in my React app (to show the appropriate content for the subdomain site)

  2. Should I create another branch in my GitHub repo, “app”, and deploy that branch to my Netlify as a branch subdomain? Since Netlify can do branch domains. This would mean I can work with the app in isolation and it would be accessible on app.website.com.
    However, it is my understanding that this goes against the concept behind branches - i.e: branches serve as areas to develop in isolation for the purpose of later being integrated into the master branch - not serving as their own independent site - is this true?

  3. Or lastly, should I create a new repository on GitHub and get it to be hosted on Netlify under app.website.com? - This would mean I can’t use the same components between my landing site and my app site and have to duplicate a lot of code. I also need to figure out if that can be done.

I would greatly appreciate any guidance

Thanks in advance

Hi @elijahmontenegro,

I believe you can use option 2. While branches are usually used for testing, no one can stop you from creating 2 different websites. I have such a setup for one of my websites too.

Even if you don’t want branch subdomain, you can always deploy the branch as a totally new website. So the two websites would be connected to the same repo, but a different branch and would exist as two independent websites.