© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•9mo ago
bluepuma

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?
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Can Drizzle be used for a multi-tenant app?
Drizzle TeamDTDrizzle Team / help
2mo ago
Best Practice Approach For Connecting Nest.js With Drizzle ORM?
Drizzle TeamDTDrizzle Team / help
2y ago
Best practices for handling planetscale DatabaseErrors with Drizzle?
Drizzle TeamDTDrizzle Team / help
3y ago
Drizzle and multi-tenancy
Drizzle TeamDTDrizzle Team / help
3y ago