# Two separate (but related websites) one codebase

**URL:** <https://www.ruby-forum.com/t/two-separate-but-related-websites-one-codebase/132764>\
**Category:** Rails\
**Created:** [March 24, 2008, 3:16pm UTC](https://www.ruby-forum.com/t/two-separate-but-related-websites-one-codebase/132764 "2008-03-24T15:16:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ressister](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/258eb7/32.png) [@ressister](https://www.ruby-forum.com/u/ressister)\
**Post date:** [March 24, 2008, 3:16pm UTC](https://www.ruby-forum.com/t/two-separate-but-related-websites-one-codebase/132764/1 "2008-03-24T15:16:28Z")

</div>

Is it possible two run two separate websites in Rails on the same  
codebase? Does it make sense to do so? I currently have a website  
that I want to branch into another market. The underlying structure  
of the two sites will be nearly the same. Here are the major  
differences:

- Templates will be different between the two sites
- Domains will also therefore be different
- Navigation will be similar (but different)
- Database could go either way but could certainly be the same

I could simply tweak the code from one site and re-deploy, but then  
I’m maintaining two different codebases for essentially the same  
site. Are there any good resources on how to set this up? Does  
anyone in this community have direct experience of running two  
different .coms on one codebase in Rails?

I’d love some guidance on how to get this setup and started.

Thanks,  
-Alex

---

<div class="post-metadata">

**Author:** ![ressister](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/258eb7/32.png) [@ressister](https://www.ruby-forum.com/u/ressister)\
**Post date:** [March 24, 2008, 3:41pm UTC](https://www.ruby-forum.com/t/two-separate-but-related-websites-one-codebase/132764/2 "2008-03-24T15:41:00Z")

</div>

ressister wrote:

> I could simply tweak the code from one site and re-deploy, but then  
> I’m maintaining two different codebases for essentially the same  
> site. Are there any good resources on how to set this up? Does  
> anyone in this community have direct experience of running two  
> different .coms on one codebase in Rails?

You could factor out the underlying functionality into a gem or a  
plugin. This is how Rails was born.

---

<div class="post-metadata">

**Author:** ![ressister](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/258eb7/32.png) [@ressister](https://www.ruby-forum.com/u/ressister)\
**Post date:** [March 24, 2008, 8:05pm UTC](https://www.ruby-forum.com/t/two-separate-but-related-websites-one-codebase/132764/3 "2008-03-24T20:05:31Z")

</div>

Great idea Mark, thanks for the suggestion. If there are any specific  
reference materials that you know of on the web that you think I  
should check out for this, let me know. Thanks for you response.

-Alex

On Mar 24, 10:41 am, Mark B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![ressister](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/258eb7/32.png) [@ressister](https://www.ruby-forum.com/u/ressister)\
**Post date:** [March 25, 2008, 1:06am UTC](https://www.ruby-forum.com/t/two-separate-but-related-websites-one-codebase/132764/4 "2008-03-25T01:06:21Z")

</div>

ressister wrote:

> Great idea Mark, thanks for the suggestion. If there are any specific  
> reference materials that you know of on the web that you think I  
> should check out for this, let me know. Thanks for you response.

This looks like a good place to start:

> **[\#33 Making a Plugin - RailsCasts](http://railscasts.com/episodes/33-making-a-plugin)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.
