Multi Domain Next Js Prisma Next-Auth #3228
Unanswered
laurent512
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
Techno stack : next js, prisma, postgresql, next-auth
My project uses one single database containing all info ( user, session, project specific data).
Ideally I would like to have the following website structure :
admin.mysite.com : admin portal , only admin can loggin , admin specific information should be fetched from db
user.mysite.com : admin portal , only users can loggin , user specific information should be fetched from db
api.mysite.com : public information (project specific data) should be accssible publicly
With next JS, we can not work with different subdomains so each site must be separated( please let me know if I am wrong)
So I am struggling about how to organize my site to avoid prisma code redundancy and ensure security.
I am thinking to put all the prisma logic and set up all needed api's in apy.mysite.com , but is there a way to ensure security easily between two sub domains (e.g. can I check at api.mysite.com that an admin requesting his profile picture is indeed logged as admin) ?
Thank you so much in advance for your help 🤝
Beta Was this translation helpful? Give feedback.
All reactions