Multitenancy in NestJS + Mongoose

preview_player
Показать описание
Learn how to handle multitenancy in NestJS with Mongoose in this easy-to-follow tutorial.
Where we learn how to connect to the correct dedicated tenant database based on the tenant making the request.

Timestamps:
---------------------
0:00- Single-Tenant vs Multi-Tenant
2:13- Our Multi-Tenant Application
4:45- Explaining the boilerplate code
7:11- Which database is NestJs using?
10:18- Identify the correct Tenant
11:33- Creating the Tenants Middleware
14:15- Accessing the correct database (Approach 1)
19:05- The issue with this approach
19:53- Creating the TENANT_CONNECTION Provider
26:25- Understanding the Request Scope
31:00- Creating the Product Model Provider
32:45 - Accessing the correct database (Approach 2)
38:45- Summary
Рекомендации по теме
Комментарии
Автор

This is really a great video. Can you try to implement a authentication module as you said in the video

rvbyqcl
Автор

Amazing tutorial, and great content !! looking forward for more 😄

RishiDeorukhkar
Автор

Thank you very much for this highly valuable content!!! Second approach is awesome.

sergeyplotnikov
Автор

this is the most impressive video i have seen on the topic of multitenency with nestjs and mongodb . thank you so much

Viraj-jhpk
Автор

Very useful video! Thank you for the knowledge

ycoda
Автор

Amazing!, wonderful video I really enjoyed it
keep this good work bro

hassanmhassan
Автор

In this case to improve is good to work with redis

mariusdanyelbuzatu
Автор

I find this lesson a bit beyond my understanding (from 26:30) . I hope there will be another lesson in the future that is a little easier to understand.
Thank so much

juhandvan
Автор

Thank you bro, Your content and method of explanation are more than perfect❤

I also wish if you could share this project with us it would be a great gift for me 🙏

omarps
Автор

Hi, thanks for the video. I think it would be useful to make it a durable provider and create dependency tree once per tenant. Did you look at NestJS-CLS (Continuation Local Storage, based on Async Hooks)? I think it's a good altrnative approach, which also works with CQRS module (request scope doesn't).

burnsnewman
Автор

great tutorial, I really liked it. please can you implement authentication.

shadcnuisnipset
Автор

Excellent tutorials!! Could you please help us to have lookup query on multiple databases? I need to join tenant DB with master and get the result

pramodpatil
Автор

Thank you so much for this great content. I have one question: what if we have more then one model, should we create a provider for each model?

empowerurjourney
Автор

Thank you for this tutorial, I have a project where I have to use prismaORM to implement multitenancy, can you make another video using prismaORM or provide me with a possible solution. Thanks

recitdafrique
Автор

Thank you so much for this great video. I have
one question: what if we have more then one
model, should we create a provider for each
model or is there any way to make the provider generic and accepte any model ?

abdulrahmanarmashi
Автор

Thank you. Why didnt you use nest durable providers?

mohsensareminia
Автор

Hello,

Your videos have been incredibly helpful to me. I was wondering if we could eventually have the instructional video you mentioned on unified identity verification. I really need it. Thank you, but unfortunately, I can't sponsor you from my region. I apologize.

JoyceWen-pypb
Автор

Amazing tutorial, it helped me a lot, but I have a question, you did it multi-tenant in multiple databases, can it also be done but for different collections? Like products_tenant_id in the same data base, or do you know where I can find information about it?

btw new sub

thehaughton
Автор

thank you for the video! Question, u said that the tenantId comes from the header, but shouldnt it be stored at the users table DB level? does it depend on requirements or it always comes from header of the front end? Thanks in advance

HamoudyMulti
Автор

Most underrated channel on dev youtube. Keep it up!

als