Subject Web application with Firebird 3 and SaaS

Hi everybody,

    I'm new to web development. A month ago I developed a small web application using Firebird as a database,     PHP to connect to the database and Bootstrap, Jquery and Datatables to show the data.

    Now we are going to start a bigger project in which we need to develop user control, environment configuration, datagrids, CRUD, reports, importing data from Excel ... attachments, statistics ..., it would be a standard application that we think to have hosted on an own server and "sell" to potential customers.

    I am planning the infrastructure and security and I have several doubts. My initial idea would be to have a database where users can save their emails and create a separate database for each client.

When a user is logged in on the web I would consult this database and I would route it to the database where his data would be stored in the application, something like this schema:



       Table Clients

                Company=001                                               Web Log In: User 1 ---->COMPANY001.FDB

                Company=002                                               Web Log In: User 3 ---->COMPANY002.FDB

       Table Users

                User= User 1  (Company 001)

                User= User 2  (Company 001)

                User= User 3  (Company 002)

I think it is best to isolate each database with its own security*.fdb to prevent any client from accessing another database and in this point is what I am not clear about, how to manage users and security by database, permissions...

I would also need to be able to create a database on the fly, when a new client registers, for that I need to stop the Firebird service?

I have many doubts, if someone with experience could help me or tell me where to find detailed information I would appreciate it.

Thank very very much,

Saray PĂ©rez