CakePHP App-Structure: one DB & App vs. multiple DBs & Apps

341 views Asked by At

I have a brief conceptional question:

Recently, I started to develop an app in which I can (on the fly) create clients who, in turn, can create projects that have lots of other stuff (own logins, etc).

The URL-structure is "example.com/client1/project1" for users to get to their project. So far so good, I managed it all with the DB-Model and routing etc.

Example structure:

-> Client -> Project -> User
                     -> Forum -> Topic -> Post
                     -> Message
                     -> Setting
                     -> [...] (you get the gist)

However, there will only be a handful of clients (< 15), so I was wondering if it were better to use a SEPARATE app-folder and DB for EACH client. Because this way, I will also be able to roll-out upgrades for each client separately.


Here my initial thoughts on the matter (going for separate installations):

Pro: Separate Apps

  • Ability to roll-out updates and new features separately for each client (it may well be that some new features are unwelcome by some clients)
  • An error in one DB will only affect one client

Contra: Separate Apps

  • More maintenance work in terms of monitoring all apps & applying updates globally (but given the number of clients this is not really a problem)
  • May become really confusing with different versions etc.
  • No ability to implement a superadmin that can access all apps (needs to be done on app-level)
  • Harder to create shared functionality and data (e.g. billing for clients)
  • Bad practice?

Should I ever wish to merge all installations, then this will not be a problem really, because everything is based on UUIDs. Furthermore, I will still implement the Client-Model, with all the rest being dependent on it: this way, it will simply be a matter of combining the databases and clients' files into one app-installation (given everyone wants the same functionality).

Note: The CakePHP core-library will be shared in any case: so this is not the issue here.

What would you think in this instance? The only problem I can see is with billing:

But it's not a problem to call a central DB from within each client to let it know "Hey, I just created something that needs to be billed".

If I do it in a single app - how do I exclude certain clients from some updates? Or should I simply force everyone to get used to any new features?

1

There are 1 answers

3
bpgergo On BEST ANSWER

Because of the overheads you also mention, I'd only go for the 'Separate apps' if there was a requirement which made it absolutely necessary.

EDIT: you do not need to have different db schemas to finetune available features per clients