[ColdBox 3.5.1] Saas application

I should create a Saas app.

I really don’t know where to start from. My idea is to create an app with a different database for every users, each one with his own settings, modules and customizations.

What I have in mind, is to create an app that check all preferences of a user after he’s loggedin, and override application settings to use only his database.

For example:

1 - a user can login with his username and password;
2 - an interceptor check if user has valid credentials
3 - if user has valid credentials interceptor read his ID on database and read his settings stored on related table and overwrite setting on Coldbox.cfc

Is this method good enough or I should try something else?

I’m building one currently but I don’t think separate databases is an effective way to go…the idea of SaaS really stems from what can commonly be used despite uncommon users. The database should be common but the client / account drives what data is accessible. Not to mention, what happens when things go well, you have 150 customers all with their own database and there is an add on function that requires data architecture additions or changes…you have to make 150 changes…or when a bug is found…how fun would that be?

One base code for all
One base database for all
Custom settings in database, custom code in unique directories for clients

At least…thats how I’m setting mine up.

There are several different models for providing SAAS, the shared DB as Mike pointed out, or the one DB per Tenant/Client since some organizations require this setup for certain types of apps, (CRMs for example). It depends on how you go about creating the client’s environment for using your app, if a shared DB than segment the user settings by the account or accounts associated with that client, if separate DBs a build script may be necessary to construct the database or schema, in this case you may need a separate application that allows for the user to configure the environment and it in turns builds and deploys the actual SAAS ColdBox application.

There’s no right or wrong way, it’s all dependent on the architecture, security requirements and functionality you are going to provide your users.

Happy Coding!