Database help with multi tenant app
Unanswered
Ovenbird posted this in #help-forum
OvenbirdOP
Heyo all, I am planning to build a multi tenant app and was wondering some things about the database..
I was considering using different schemas for each tenant (PostgreSQL schemas)
Here's my thought process:
An api request comes to my next js app
I extract the domain from the req
Query an api with the domain that gives me the tenant id / the schema id
Initiate my prisma db with the schema id to the one I got from my api
However, I'm just wondering is this very long winded / is there a better way to do it?
I was considering using different schemas for each tenant (PostgreSQL schemas)
Here's my thought process:
An api request comes to my next js app
I extract the domain from the req
Query an api with the domain that gives me the tenant id / the schema id
Initiate my prisma db with the schema id to the one I got from my api
However, I'm just wondering is this very long winded / is there a better way to do it?