We’ll dive into setting up multitenancy in a NestJS application using Drizzle ORM and Async Local Storage. This powerful combination allows you to efficiently manage multiple tenants in your application with minimal hassle. 🚀
Length 1:14:08
Captions English (Generated), Spanish (Auto-translated), French (Auto-translated), Korean (Auto-translated), Portuguese (Auto-translated), Vietnamese (Auto-translated) #nestjs #drizzle-orm #multi-tenancy #postgresql #docker #async-local-storage #backend-development #typescript #database-migration
0:00 Hey everyone. Today, I'm bringing you a preview of a member 0:04 exclusive lecture from my membership website on a very 0:08 heavily requested topic, which is gonna be multi-tenancy in a 0:12 NestJS application, which we're gonna use Drizzle ORM to 0:16 implement in a very clean and scalable way. 0:19 We're gonna use Async Local Storage and be able to actually create 0:23 new tenant connections inside of our application 0:27 dynamically at runtime simply by providing a tenant's 0:31 JSON configuration file, which is gonna allow us to provide 0:35 tenants with separate database connections and our application 0:39 will connect to all of these tenants at startup, execute any 0:43 migrations as needed, and then we'll actually have the ability 0:46 to 0:46 provide a tenant ID header to our application 0:50 to retrieve tenant specific data which is completely 0:54 isolated inside of separate databases thanks to this 0:57 multi-tenant architecture using Drizzle ORM. 1:01 So simply by swapping out our tenant ID header, we can 1:05 retrieve separate tenant data. Finally, we're gonna be using Async 1:09 Local Storage from Node.js to implement our multi-tenancy 1:13 in a scalable way, which is gonna allow us to implement a form of 1:16 thread 1:17 safe local storage in our NestJS application. 1:20 So I'm super excited to get started with this lecture. 1:23 We're gonna cover so much and by the end of it, 1:25 you'll be able to implement 1:26 multi-tenancy in your web applications. 1:30 Thanks so much for watching and let's jump right in. 1:32 All right, so to go ahead and get started, let's initialize our application by 1:36 using the NestJS CLI. If you don't have the Nest CLI, you 1:40 can of course make sure you install it with 1:43 NPM Install -g for global 1:46 @NestJS/CLI@latest version. 1:51 So with the Nest CLI installed, let's go ahead and create our new 1:54 application. 1:55 So we'll run nest new 1:57 and I'll call this NestJS multi-tenancy
The rest of the transcript is for members.
Sign in