Any good example projects that I can use to compare my own flask site?
Best Way to manage a SaaS flask application on github
-
Using 1 db per customer is not a good design choice. It's not a big deal when you only have 3 customers, but when you start to scale and have hundreds or thousands of them, I can guarantee you will not have much fun running all of these db server instances, performing migrations, backups etc. Apart from that it will likely affect your bills. Unless it's the customer's explicit requirement that their data must be stored in their own self-hosted db server, I would redesign the app to store client IDs in db.
-
Your config files should be excluded from the repo. Even if it's a private repo, anything that has passwords and other sensitive information, should not be the part of your commits. It's for security reasons, but if you follow this practice, you don't need a separate branch for each client (which also would be a nightmare if you start scaling).
Proper and standard Flask project structure
What are the best practices and standard conventions for routes?
Looking for a relatively big flask project that follows all of the flask best practices and or a guide with best practices and tips for my own flask site.
My team and i built a SaaS flask application that allows pharmacies to organize and track drugs. The application is going to be used by 3 different clients(pharmacies). These three different companies are not related to each other.
We created client IDs for each of the pharmacies. We plan to put the ids into the configuration file of the application. The application makes requests to an API that we built. That API need to identify the client ID and perform some specific actions and updates related to the pharmacies.
My question is how do I manage this on GitHub. Should we create repositories with the base code for each client and host it differently, or create branches from the main branch and host the branches with different domains? How do i also manage update?
The application uses mongodb. The plan is to provide each pharmacy a separate db. That mean the dB name will also have to be modified in the configurations.
-
Using 1 db per customer is not a good design choice. It's not a big deal when you only have 3 customers, but when you start to scale and have hundreds or thousands of them, I can guarantee you will not have much fun running all of these db server instances, performing migrations, backups etc. Apart from that it will likely affect your bills. Unless it's the customer's explicit requirement that their data must be stored in their own self-hosted db server, I would redesign the app to store client IDs in db.
-
Your config files should be excluded from the repo. Even if it's a private repo, anything that has passwords and other sensitive information, should not be the part of your commits. It's for security reasons, but if you follow this practice, you don't need a separate branch for each client (which also would be a nightmare if you start scaling).
You don't manage the "service" aspect of SaaS on Github, only the code. I would push only changes that will be consistent across all three API sets, and gitignore the configuration (i.e. a config.py file?). Then, when you go to spin up all three servers, insert each config file and they should behave the same way as intended.
Side note, technically you don't have to spin up three different mongodb servers; you could add a field to your models that identifies which pharmacy they came from, using the id you gave them. It just depends on how you want to organize the data.
Many years I work as a java developer. I used to live with clear structure of project, with standard naming on my classes and so on. I would like to write some pet (web) project on python just to try something new. Is there any example of proper standard structure for a flask based web project? I tried to find it on my own but most samples are just 4 files project with basic crud and template