N
Neon7mo ago
absent-sapphire

Multi-tenant DB design advice needed

I'm in the planning phase of a B2B SaaS platform (taking inspiration from Linear/Fibery/some generic admin dashboard) and need some advice on the database architecture for multi-tenancy using Neon Postgres. Current planned tech stack (Any feedback is greatly appreciated): * React * Next.js * Vercel for hosting * Node.js (+Hono or Express.js?) * Clerk for auth * Neon postgres * Drizzle ORM and/or GraphQL I'm torn between two approaches: * db with shared schema + RLS * database-per-user Would love to get some input to both approaches. What are the pros/cons? How would the onboarding work for new organizations? Using database-per-user for organizations/companies, can one user be part of multiple organizations? Some more info on the app: Every instance, regardless of company will have a table fit to their needs (in example: for keeping track of orders/projects). I reckon it will mostly be the same for many, but may contain different columns. To begin with there will be a dashboard, project management, and calendar view + resource management. Will also, down the line, probably be a chat function, some collaboration features/note taking, upload files per project, AI functionality etc (I want to plan my db and tech stack for these from the start, so I won't need to do major changes later). Also, I have some knowledge with GraphQL, and limited knowledge of Drizzle, any thoughts on using either? I realized this became quite a few questions, but I appreciate any guidance! Thanks in advance!
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?