Two versions of an application using modules

We have an application that has been split into two different versions and is hosted on two separate servers with two separate databases. The code between the two is 60% the same. It’s a booger to have to maintain all that similar code in two places and I’d rather have one set of common code with modules to add on the differences between the two systems.

We currently have two separate Git repositories, one for each version of the application.

I’m trying to think through the process of combining the shared code into one repository and where to maintain the modules for version A and version B code. I’m guessing they would all have to be in the same Git repository? Or at least exist as working code on the same server so they can be pulled in as modules into the main set of code?

I haven’t worked with Coldbox Modules yet so I don’t have a frame of reference for this or know where to start. Please make your suggestions and responses with this in mind. I know basic Coldbox, but not modules.

It’s worth noting that ColdBox has “external” locations for handlers, models, layouts, and views which can allow for a “common” folder of code that’s shared. However, modules are probably a a much better starting point since they let you abstract out entire functional chunks of your site. I would start by no longer thinking of your codebase as one giant ball. Build a module map diagram of all the high level pieces of your site including what’s shared and what’s different per app. Then move toward actually breaking those chunks of code out into separate repos. You can use CommandBox and your box.json to create a “recipe” for what modules are needed to build a given app. Modules don’t have to be hosted on ForgeBox (though we are making plans for ForgeBox private packages). You can host your own private artifacts repo, or just point your dependencies straight at your private Git repos and CommandBox can install what you need from there. This will even allow you to have each site run on a different version of a module as well which opens the door to rolling out features in a shared module to one app at a time. And don’t worry if one module has a hard dependency on another. That’s not a bad thing.

Anyway. there’s my brain dump, but mostly boils down to:

  1. Plan your modules out
  2. Separate the code
  3. Use a CommandBox-based build process to assemble your app with the pieces you need.



ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

ColdBox Platform:

Thanks Brad, this is the high level starting point I was after. I’ll take it to the team and see how far we get. Maybe we’ll have more questions when we get further.