No video

Multitenancy in NestJS + Mongoose

  Рет қаралды 5,817

Computerix

Computerix

Күн бұрын

Пікірлер: 64
@user-rv8by4qc8l
@user-rv8by4qc8l 4 ай бұрын
This is really a great video. Can you try to implement a authentication module as you said in the video
@Computerix
@Computerix 2 ай бұрын
Here you go : kzfaq.info/get/bejne/bbaDldJ_y5q2pYU.htmlsi=3KUn9tRxLTxJ_x9o
@RishiDeorukhkar
@RishiDeorukhkar 5 ай бұрын
Amazing tutorial, and great content !! looking forward for more 😄
@Computerix
@Computerix 5 ай бұрын
Thank you so much!
@sergeyplotnikov4303
@sergeyplotnikov4303 7 ай бұрын
Thank you very much for this highly valuable content!!! Second approach is awesome.
@Computerix
@Computerix 7 ай бұрын
Thanks for the feedback!
@Viraj-jh6pk
@Viraj-jh6pk 4 ай бұрын
this is the most impressive video i have seen on the topic of multitenency with nestjs and mongodb . thank you so much
@Computerix
@Computerix 4 ай бұрын
Thank you so much!!
@ycoda
@ycoda 7 ай бұрын
Very useful video! Thank you for the knowledge
@Computerix
@Computerix 7 ай бұрын
You're welcome !
@hassanmhassan5500
@hassanmhassan5500 7 ай бұрын
Amazing!, wonderful video I really enjoyed it keep this good work bro
@Computerix
@Computerix 7 ай бұрын
Thank you!
@juhandvan
@juhandvan 3 ай бұрын
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
@Computerix
@Computerix 2 ай бұрын
I'm gonna make a video covering request scope vs the default scope, hopefully it helps you out!
@juhandvan
@juhandvan 2 ай бұрын
@@Computerix That sounds interesting.
@shadcnuisnipset
@shadcnuisnipset 4 ай бұрын
great tutorial, I really liked it. please can you implement authentication.
@Computerix
@Computerix 4 ай бұрын
I'm planning on doing so sometime this year! Just to be clear, authentication handling, specifically in multitenancy, correct?
@shadcnuisnipset
@shadcnuisnipset 4 ай бұрын
@@Computerix yes exactly, registration, login, interaction between the User and Product table for example to know which user created a particular product
@burnsnewman
@burnsnewman Ай бұрын
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).
@Computerix
@Computerix Ай бұрын
@@burnsnewman I haven't looked in to it, but the durable provider suggestion is a good one !
@recitdafrique
@recitdafrique 4 ай бұрын
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
@mariusdanyelbuzatu4075
@mariusdanyelbuzatu4075 3 ай бұрын
In this case to improve is good to work with redis
@mohsensareminia2988
@mohsensareminia2988 4 ай бұрын
Thank you. Why didnt you use nest durable providers?
@recitdafrique
@recitdafrique 4 ай бұрын
Hello, Please, have you implemented such an architecture that connects several models with mongoose or prisma ?
@Computerix
@Computerix Ай бұрын
@@mohsensareminia2988we could have done that! Good point
@abdulrahmanarmashi6954
@abdulrahmanarmashi6954 4 ай бұрын
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 ?
@Computerix
@Computerix 4 ай бұрын
Tokens that are injected that represent a provider are unique, so as a first thought I'd say yes, you need to create a provider for each model. I haven't really thought of workarounds or of ways to make something generic work. If you have done that in the past day, let us know!
@JoyceWen-py1pb
@JoyceWen-py1pb 2 ай бұрын
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.
@Computerix
@Computerix 2 ай бұрын
I'm glad my videos are helpful! I am going to create an authentication video for multitenancy soon, meanwhile feel free to watch this authentication video that I uploaded a week ago : kzfaq.info/get/bejne/npNma9ai3d_Heo0.htmlsi=VeiWno8dL0UA2ike It's going to be similar, except we're gonna be using different secret keys for different tenants (these keys would be stored in the database)
@JoyceWen-py1pb
@JoyceWen-py1pb 2 ай бұрын
@@Computerix Okay, looking forward to your new videos.
@pramodpatil2860
@pramodpatil2860 7 ай бұрын
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
@Computerix
@Computerix 7 ай бұрын
Sadly, as per the mongoDb documentation (www.mongodb.com/docs/manual/reference/operator/aggregation/lookup/), lookup only works on collections within the same database. However, you can create multiple queries (each query could be on a seperate database) and merge the results yourself. To fetch results from the master database : 1- Simply register the model like we normally do using MongooseSchema.forFeature. (This works, since in app module our default connection is pointing to the master DB) 2- Inject the model using the normal @InjectModel(). This model will point to a collection in the master DB. To fetch results from the tenant specific database, inject the custom tenant model provider like in the video :) ..and then manually merge the results
@HamoudyMulti
@HamoudyMulti 4 ай бұрын
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
@Computerix
@Computerix 4 ай бұрын
It depends. If you are trying to fetch some data specific to a tenant (so it exists inside the tenant specific Database) for example a list of products being sold by a tenant, you need the frontend to specify the tenantId in the headers (Also it's a best practise to sign each user token with a tenant-specific secret for security purposes) that way, you know where to connect and what data to fetch. However, if a user is trying to login, they send their credentials only. To tell which tenant they belong to, you can store the tenantId inside the users table. So in summary, it depends on the requirements, but for most cases, the frontend would need to send the tenandId in the headers. Hope this helps :)
@HamoudyMulti
@HamoudyMulti 4 ай бұрын
@@Computerix Thank you so much for the reply! I just had a meeting with my company and we decided to go with the tenantId in the headers approach. u helped me alot and this video will help me through implementing it in nestjs, making my task easier :D (please dont remove this video lol) 1 thing we were not sure about is how we can have 1 front end server deal with 2 different domain urls, my company just started implementing custom solutions so we are trying our best, do u know how its done? Thanks alot!
@Computerix
@Computerix 4 ай бұрын
@HamoudyMulti hmm, can you explain your question more?
@HamoudyMulti
@HamoudyMulti 3 ай бұрын
@@Computerix I have another question after going through ur video. im currently using a RDS with MS SQL and sequelize ORM. I couldnt apply most of the things in the video, as sequelize doesn't allow u to change database within same connection like in mongoose (in ur videos its the useDB method). do u think its a good idea to create all the connections at once when initiliazing the application for all tenants? or initialize the connection on each request for a given tenant? the number of tenants is not that high (3 or 4 max), although im not sure what is the best practice. thanks again for ur great help!
@Computerix
@Computerix 3 ай бұрын
​@@HamoudyMulti I haven't used sequelize before, so i'm not very familiar with it. But what you can do, is check if you have an existing connection to a certain tenant DB, if that's the case, use it. If not, create it and use it for the current and future requests for that tenant. The key, is managing the connections in a clean way. So make sure to reuse existing connections :))
@emirsalihovic6616
@emirsalihovic6616 5 ай бұрын
Well done sir.
@Computerix
@Computerix 5 ай бұрын
Thanks!
@emirsalihovic6616
@emirsalihovic6616 5 ай бұрын
Can you please cover the topic of dockerizing a nest app and the cloud usage suggestions etc, that would be a great video, thank you!@@Computerix
@omarps6622
@omarps6622 6 ай бұрын
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 🙏
@Computerix
@Computerix 6 ай бұрын
I'm glad ! The link is in the description : github.com/charbelh3/NestJs-Multi-Tenancy
@omarps6622
@omarps6622 6 ай бұрын
@@Computerix you are my angel😍
@empowerurjourney
@empowerurjourney 5 ай бұрын
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?
@Computerix
@Computerix 5 ай бұрын
Thanks for your comment! Yes that's correct.
@thehaughton8936
@thehaughton8936 5 ай бұрын
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
@Computerix
@Computerix 5 ай бұрын
Thanks for the feedback! I think it's best if you avoid creating a collection per tenant. Instead go for 1 single database and 1 products collection for all tenants, and create a field named "tenantId" inside the same collection to know which document belongs to which tenant, if you don't want to use the database per tenant approach. (refer to stackoverflow.com/questions/2748825/what-is-the-recommended-approach-towards-multi-tenant-databases-in-mongodb and web.archive.org/web/20140812091703/support.mongohq.com/use-cases/multi-tenant.html)
@maintenance_informatique
@maintenance_informatique 6 ай бұрын
Thank you very much for this excellent video. How can I get in touch with you? by email or discord or linkedin
@Computerix
@Computerix 6 ай бұрын
Thank you! This is my linkedin: www.linkedin.com/in/charbel-el-helou-6523a5200/
@ChetanSharma-jy8om
@ChetanSharma-jy8om 15 күн бұрын
How to solve If i want to read all products from multiple tenants dbs and show them on main website landing page like udemy or other elearning platform.
@Computerix
@Computerix 15 күн бұрын
@@ChetanSharma-jy8om If you have such a use case, it's better to keep a copy of the newly created products in your main database (the default mongooseModule that you register), that way you fetch them all from the same DB
@ChetanSharma-jy8om
@ChetanSharma-jy8om 15 күн бұрын
@@ComputerixOne last thing from your side , As you are creating dynamic dbs in mongo db Is there as such limit for them.Because I am using managed mongodb by digital ocean
@linoypappachan4272
@linoypappachan4272 7 ай бұрын
Amazining tutorial, could u pls share source code. Keep it up.
@Computerix
@Computerix 7 ай бұрын
Thank you for the comment! Here is the code: github.com/charbelh3/NestJs-Multi-Tenancy
@jean8135
@jean8135 3 ай бұрын
The "mustard" database haha
@als5321
@als5321 Ай бұрын
Most underrated channel on dev youtube. Keep it up!
@Computerix
@Computerix Ай бұрын
Thanks 😁
@amrhussien4334
@amrhussien4334 7 ай бұрын
Thank you, engineer. Great work. Hiw can I communicate with you please ❤
@Computerix
@Computerix 7 ай бұрын
Hello! I was thinking of making a discord community server.. but at a later time. In the meantime, feel free to tell me your concerns here :)
@amrhussien4334
@amrhussien4334 7 ай бұрын
I have one project I want to discuss it with you via another channel. Appreciate if you can tell me how to reach you. I added my contact here many times but it's deleted Thank you
@amrhussien4334
@amrhussien4334 7 ай бұрын
​@Computerix I have one project I want to discuss it with you, So please tell how to contact you. I am trying to put my contact here but it always deleted
@KhodeCamp
@KhodeCamp 4 ай бұрын
Thank you for your work hard. Can you help make more videos of multi-tenant with SQL (Postgres) please
NestJs caching with Redis
18:17
Computerix
Рет қаралды 6 М.
NestJs Microservices with RabbitMQ
23:21
Computerix
Рет қаралды 11 М.
Running With Bigger And Bigger Feastables
00:17
MrBeast
Рет қаралды 165 МЛН
Kids' Guide to Fire Safety: Essential Lessons #shorts
00:34
Fabiosa Animated
Рет қаралды 17 МЛН
拉了好大一坨#斗罗大陆#唐三小舞#小丑
00:11
超凡蜘蛛
Рет қаралды 14 МЛН
Violet Beauregarde Doll🫐
00:58
PIRANKA
Рет қаралды 34 МЛН
Multi-tenancy architecture | The Backend Engineering Show
25:29
Hussein Nasser
Рет қаралды 40 М.
NestJs - Best Practices + Implementations
22:26
Computerix
Рет қаралды 5 М.
AI Built My App and It's INSANE! (Galileo, Claude, Cursor)
16:38
AI in practice
Рет қаралды 8 М.
EF Core Multitenancy For Your SaaS Applications
14:41
Milan Jovanović
Рет қаралды 23 М.
What is a Multitenancy Architecture and Why Is it becoming popular?
8:16
I Never Want to Create APIs Any Other Way
17:32
Marius Espejo
Рет қаралды 22 М.
Learnings from our multi-tenant Laravel application
9:58
Sabatino Talks Dev
Рет қаралды 14 М.
Wait... PostgreSQL can do WHAT?
20:33
The Art Of The Terminal
Рет қаралды 193 М.
NestJs - Guards & Authentication & Authorization [08]
33:05
Computerix
Рет қаралды 10 М.
Running With Bigger And Bigger Feastables
00:17
MrBeast
Рет қаралды 165 МЛН