Im developing a web application. I have Django for my backend and using PostgreSQL for my database. I am not sure if this is the best approach or not but:
I want to create a database for each company and in that database schema for each project within that company.
recommendations?
I want to create a database for each company and in that database schema for each project within that company.
2
Answers
It is possible but complicated to create distinct databases for each company, with schemas for each project within those databases. Although it provides excellent data isolation and security, managing it can be time- and resource-consuming. Depending on your particular needs, take into account alternatives like employing a shared database with row-level security or multi-tenancy frameworks for a more simplified approach.
Something that we do to prevent some difficulties regardig security is having a completely separate environment for each customer.
Customer A:
https://a.your-company.com
Customer B:
https://b.your-company.com
Every customer then has a separate and fully dedicated environment in the cloud. Based on the URL, the specific backend service is targetted.
I would advise you to look into a way of making things as generic as possible. At my previous company, they made parts client-specific, and after some years of development they threw everything away and started from scratch, with one rule graved on the wall: "No client-specific implementations allowed".