phpdatabase-designcakephpmulti-userapplication-structure

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


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

Contra: Separate Apps


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?


Solution

  • 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