I have a single web server running multiple web applications and websites. For simplicity we'll just say I have App A,B,C and websites D and E. All use a shared database and some tables are used in more than one app/site.
I'm at a point where I'm looking at restructuring a lot of this code, but I'm trying to figure out a pattern that will allow me to keep as much code as possible in one spot and I'm looking for a pattern to do it.
Almost all of the apps are MVC (some legacy ones aren't but regardless). Some App A and App B may have the same model (tied to the same table) but implemented differently with different methods and such.
I had the idea of simply building a common API that all apps/websites would use, so that the API could serve as my "model" of sorts and the apps/websites would run gets/sets through the API.
The downside I see doing that is I'd need security groups in my MVC app to control things there, AND security groups stuff in my API, which seem cumbersome. I've also thought about, using an API for the stuff, but in my MVC applications, making the models be abstractions of the components used for the API.
Right now I have similar functions/methods in different apps which is a headache of course, but I'm trying to make it better. Are there common models for when an app uses it's own API and security is shared between the two?