Is it a good idea to keep separate projects in the same repository if they are intimately related?

The general rule of thumb is, "things that change at the same time should be versioned together."

If the backend needs to support multiple clients and will change independently of your frontend, as it would if you were going after a services-based architecture, then it's worth thinking about separating these things into separate projects.

However, since it sounds like these two projects will be fairly tightly coupled, and your web application only makes sense with both in place, I'd suggest that you start by keeping them in the same repository. It's a lower-friction development experience, and you can always split them up later if it gets to be painful or if separate teams need to work on them.


From my point of view i would split client and server in two main folders under root. There are several reasons for this:

  1. Client and Server releases will relate(physically) to each other. As they do anyway beacause your client will heavily related to the api provided by your server software. So if you tag the repository as release you will be sure that both artifacts work together smoothly.

  2. You will have less pain to implement heavy integration testing as well as rolling out a continous integration infrastructure. With the other options it is also possible to bring this in in place but you will have to provide more overhead.

General branch usage:

  • the master is usually used as a consistent stable "snapshot" of your application (including client, server)
  • a branch may be used to represent a new feature development. Usually they are used this way. So you may end up having 1..n branches containing additions to your software. Which will be merged back to your master if you feel happy with it.

Branches are for making parallel versions of a common code base (see "When should you branch").
So it is not a good fit for keeping track of two different, but closely related, modules.

Simple directories within your Git repo will be enough, and will ensure that any tag you will set on that repo will reference both modules.