I am rewriting an application for better structuring it and I have some doubts.
The application is a football betting management system and has a web app for the manager and a mobile app for the bets to make. So, this application is currently used by three different customers and will certainly use them in the future.
I would like, unlike the current scenario, I did not need to repeat code for each of the applications. I would like to have a domain and identify which user is making use of the application based on the subdomain used. For example: user1.mydomain.com . Then I would know that the user accessing the system is user 1 and would use a token to access data from it in a common bank to all users differentiating the records by tokens.
Would it be risky to mix data?
I also thought about actually doing three separate systems and even got to draft the picture below. The API Bank is an API that will give me data about matches, teams, championships and so on. I imagined the Master Bank as being the bank that has all the data in common among all the different instances of the system, in case it would be all that will come from the API. And the other three banks being the banks of each of the instances. I opened this topic to listen to opinions and share experiences of how I can best implement this architecture.
What can I change?
Thanks to all who can contribute.
Obs : I want to use PHP + CodeIgniter to develop the web system and the mobile app will be written with Apache Cordova and the database used will be MySQL.