Need advice to design architecture

I have an application “App1” which is running under the URL “app1.com
and planned to run new application under the domain “app2.com” which is
very similar to “App1” but UI (complete) and some logic (30-40% of
changes) will be changed (SAME DATABASE). The app count will be ‘n’. I
don’t want to duplicate the repository and don’t like to create ‘n’
number of new environments for that.

So, I thought to redesign my first app to make compatible/support for
new apps. My design is like,

Unplug the model section from “App1” and create as separate app and UI
and controller will be placed as another app. Here the problem is to
switch over the UI part for the request from the different domain. So, I
thought to use Rails Engine for UI (App1 UI Engine, App2 UI Engine,
etc). Controller will be act as main in top of this hierarchy. I don’t
know whether this approach is good or not.

Please post your thoughts about this approach or I welcome any new
approach for this design.