# One code base, two Netlify sites

**URL:** <https://answers.netlify.com/t/one-code-base-two-netlify-sites/28630>\
**Category:** Support\
**Tags:** monorepo, gatsby, deployment\
**Created:** [December 18, 2020, 3:41pm UTC](https://answers.netlify.com/t/one-code-base-two-netlify-sites/28630 "2020-12-18T15:41:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![wild](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/wild/32/19864_2.png) [@wild](https://answers.netlify.com/u/wild)\
**Post date:** [December 18, 2020, 3:41pm UTC](https://answers.netlify.com/t/one-code-base-two-netlify-sites/28630/1 "2020-12-18T15:41:44Z")

</div>

Hi,  
We’re trying to deploy our website twice, in two separate Netlify sites. It’s a Gatsby build pulling content from a headless CMS, and we will use env vars to specify the different settings (along with some other bits like redirects, which are currently in netlify.toml).

However, this doesn’t seem possible:

- the monorepo functionality centres on different base folders, which we don’t have, and setting it changes the published directories as well
- We can’t specify a different name for the config file

Is there any guidance on how we can achieve this?

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [December 18, 2020, 4:29pm UTC](https://answers.netlify.com/t/one-code-base-two-netlify-sites/28630/2 "2020-12-18T16:29:39Z")

</div>

I think you can create 2 difference branches that are in sync with each other and create a different Netlify website at both the branches.

---

<div class="post-metadata">

**Author:** ![gregraven](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/gregraven/32/23821_2.png) [@gregraven](https://answers.netlify.com/u/gregraven)\
**Post date:** [December 18, 2020, 5:20pm UTC](https://answers.netlify.com/t/one-code-base-two-netlify-sites/28630/3 "2020-12-18T17:20:54Z")

</div>

@wild I’ve been able to create multiple sites from the same code base on Github, but I wasn’t using Gatsby.

---

<div class="post-metadata">

**Author:** ![wild](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/wild/32/19864_2.png) [@wild](https://answers.netlify.com/u/wild)\
**Post date:** [December 18, 2020, 6:00pm UTC](https://answers.netlify.com/t/one-code-base-two-netlify-sites/28630/4 "2020-12-18T18:00:53Z")

</div>

Interesting, thanks @gregraven - would you mind sharing how you’re dealing with the config? Do they both use the same netlify.toml?

I mentioned Gatsby for completeness but don’t think it’s the root of the problem, any similar setup would run into the same issue.

---

<div class="post-metadata">

**Author:** ![wild](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/wild/32/19864_2.png) [@wild](https://answers.netlify.com/u/wild)\
**Post date:** [December 18, 2020, 6:06pm UTC](https://answers.netlify.com/t/one-code-base-two-netlify-sites/28630/5 "2020-12-18T18:06:13Z")

</div>

Thanks for the suggestion, I’ve done that as a workaround but different branches can’t have completely different domains, I think?

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [December 18, 2020, 6:07pm UTC](https://answers.netlify.com/t/one-code-base-two-netlify-sites/28630/6 "2020-12-18T18:07:08Z")

</div>

While creating a new website you can select which branch to publish. It will be used as your production branch and since it’s a new Netlify website, you would get different domains.

---

<div class="post-metadata">

**Author:** ![gregraven](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/gregraven/32/23821_2.png) [@gregraven](https://answers.netlify.com/u/gregraven)\
**Post date:** [December 18, 2020, 6:19pm UTC](https://answers.netlify.com/t/one-code-base-two-netlify-sites/28630/7 "2020-12-18T18:19:40Z")

</div>

@wild I build static sites locally and upload them via drag-n-drop, so I almost never have a netlify.toml file. Sorry.
