Multi-app codebase git structure recommendations


#1

To start, let me say that I’ve seen the comments in Multiple apps from 1 codebase? already. Apart from any template-app type concerns, I’m wondering about more structural best practices.

We’re converting our native Android/iOS app codebase to be Ionic-based. Our business mostly white-labels the same codebase for each of our customers, sometimes with occasional specific tweaks/changes.

Our old native codebases are organized such that there are development, testing, and production branches. These exist to isolate bug fixes and feature development work away from customer builds.

Each customer build exists in the same repo as the above 3 branches - as it’s own uniquely named branch. So, branches in the repo:

development
↳ feature branch 1
↳ bugfix branch 2

testing

production
↳ customer-123
↳ customer-456
↳ customer-789
...

We rebase any changes from dev -> testing -> production -> each customer branch and then release new builds.

As we’re trying to use Ionic Pro to ease deployment, this structure needs to change so we don’t auto deploy changes that we want our customers to test before pushing live to their users, so I’m thinking something like this:

development
↳ feature branch 1
↳ bugfix branch 2

testing

production
↳ customer-123-testing
↳ customer-123-production
↳ customer-456-testing
↳ customer-456-production
↳ customer-789-testing
↳ customer-789-production
...

Each customer-relative testing and production branches would map to Ionic Pro ‘channels’ that are used to auto-deploy code changes. Sounds great in theory… but:

We use Github as our canonical source control (ie. the origin repo). Each Ionic Pro ‘App’ (project) has its own git repo (hosted by Ionic). So, in order to push to those ionic git repos, I need to add their repo locally as a remote. Every developer would need to do this. Pushing branches to the wrong repo is entirely possible (unless I haven’t figured out remote branch tracking properly…?)

I have other concerns which I haven’t fully examined yet, but I’m starting to get a bad feeling about this approach.

Does this make sense to you? It might be more work to maintain each customer in the their own git repo, instead of just branches in the one repo - but perhaps less error prone?

If anyone has a system that they’ve figured out that works for them, I’d appreciate the feedback!


#2

See:

Or you could “try to introduce a configuration system such that these differences can be removed”. Something analogous to language translation: https://softwareengineering.stackexchange.com/questions/302147/maintain-hundreds-of-customized-branches-over-master-branch


#3

Great response - makes for some solid reading.

I’m familiar with git-flow. Much of what I describe has roots in it. However, it doesn’t actually ease the pain very much of managing multiple customers in a single repo. Like my approach, there is still room for error when dealing with Ionic Pro’s multiple repos (a repo per Ionic ‘app’).

Still, I’ll read those links a time or two more to glean possible improvements. At first glance, it feels like they followed a similar line of thinking overall.