Best approach for multi-tenant system with Drizzle?
I would like to create a multi-tenant system with svelte-kit using Drizzle ORM. What's the best approach to handle the database connection and always ensure tenant-id of user is used for all select, update, delete, etc?
Would it make sense to create the Drizzle database object in hooks.server.ts (which is executed for each incoming request), validate the user, then create a kind of wrapper around the database object with the user-id and tenant-id, then pass the new object to the router and pages fro processing?
Totally new to drizzle. What's best practice? Any tutorials around for this use-case?
0 Replies