Best approach for handling two user types (CMS + App) with Better Auth and Prisma
Hey everyone! I’m currently building a project where I’ll have two separate frontends: A CMS for internal/admin users and A client app (for normal users)
Both will use the same Express backend, and I’m using Better Auth for authentication together with Prisma and MongoDB. I want to keep the users separated.. for example:
model AdminUser { ... }model AppUser { ... }
model AdminUser { ... }model AppUser { ... }
My confusion is around how to best structure authentication for both of these.
app.all('/api/auth/*splat', toNodeHandler(auth));
app.all('/api/auth/*splat', toNodeHandler(auth));
it seems tied to a single auth instance, and I’m not sure how to handle having two different user models or auth flows (one for the CMS, one for the app).
Should I:
1. Use two Better Auth instances, one for each user type?2. Use a single instance with role-based logic inside?3. Or is there a recommended approach for this kind of setup?
1. Use two Better Auth instances, one for each user type?2. Use a single instance with role-based logic inside?3. Or is there a recommended approach for this kind of setup?
I’d really appreciate any suggestions or best practices from those who have done something similar..