Nest.js Microservices Tutorial in 20 Minutes

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 พ.ย. 2024

ความคิดเห็น • 119

  • @ChromaDotNova
    @ChromaDotNova ปีที่แล้ว +9

    First time stepping into the realm of microservices - I still had some questions after reading the NestJS documentation so I went to TH-cam, found your video, and after watching I understand the fundamentals a lot better. Thanks so much for taking the time to make this!

  • @rafaelfranco7643
    @rafaelfranco7643 2 ปีที่แล้ว +16

    Finally a good example of microservices using nestjs! Thank you very much.

  • @Jasonjk74
    @Jasonjk74 2 ปีที่แล้ว +11

    Great video and an amazing amount of practical info/learning packed into 18 minutes

  • @lexNwimue
    @lexNwimue ปีที่แล้ว

    Wow! Great video. Really commendable! I mean, in literally 20 minutes I've gotten a detailed, conceptual image of the entire NestJS Microservice technique

  • @ikr0525
    @ikr0525 ปีที่แล้ว +1

    Thank you! Awesome video! In our company, someone was assigned to setup the microservices and I really did not mind to understand because I believed it was too complex for me. As long as the microservices were all set up, i just continued coding as usual.
    This video made it very easy to understand and I can now see why the dev who setup the microservices decided to go with certain approach.
    I'm curious about the authentication across different microservices, though. Can you make a video for that if possible? That would be amazing!

  • @illia_mikhow
    @illia_mikhow 2 ปีที่แล้ว +6

    Loved the pace of a video. Short and filled with information. 10/10

    • @itmax77
      @itmax77 2 ปีที่แล้ว +1

      I think I've seen you somewhere

  • @danielborges8857
    @danielborges8857 2 ปีที่แล้ว +1

    Your examples communicated some key concepts and clarified nest js implementation options. Thanks

  • @satadhi
    @satadhi 2 หลายเดือนก่อน

    On man you are so good. I liteally bought your udemy course. You are a great teacher sir

  • @danmarzo5508
    @danmarzo5508 หลายเดือนก่อน

    Muito obrigado pelo conteudo excelente! O quanto que eu fiquei procurando sobre microservices com api, so o seu video me tirou as duvidas, MUITO OBRIGADO

  • @jeandedieuiradukunda6079
    @jeandedieuiradukunda6079 หลายเดือนก่อน

    this is awesome i now just got an idea of microservices

  • @hakanaki
    @hakanaki ปีที่แล้ว +1

    Please some question.
    - Why did you choose use TCP instead of GRPC and what are the benefits?
    - How do you host something like this 🥲🥲
    - Is it possible to share code between services, like types or DTOs?
    Thank you for this video BTW, I've been struggling with this concept and you just simplified it in one short video. 👏🏽👏🏽

  • @maksymbaranovskyi8362
    @maksymbaranovskyi8362 7 หลายเดือนก่อน

    Thank you so much! Such a simple yet clear example.

  • @eihsan94
    @eihsan94 2 ปีที่แล้ว +4

    Would like seeing this deploy using severless framework and lambda

  • @alexsapon8769
    @alexsapon8769 2 ปีที่แล้ว +3

    Nice example
    I would suggest you to use monorepos feature that Nestjs provides, quite smooth microservices architecture at the end, plus gives you ability to clean your codebase from code duplication such as dto's you're using across the services
    best regards

    • @uchihaashura5021
      @uchihaashura5021 2 ปีที่แล้ว

      Hi but I'm quite struggle to exclude unnecessary dependency for each app, for example we add a new dependency for ervice A, but we don't need it in service B, when building docker image we are include all this dependencies, how we can exclude them to reduce docker image size ?

    • @mcc12000
      @mcc12000 2 ปีที่แล้ว

      @@uchihaashura5021 having a monorepo doesn't mean that you have a single docker image i guess.

    • @sndro1
      @sndro1 2 ปีที่แล้ว

      Does this mean that I can share models across services? Do you have any recommendations for tutorials about this?

    • @theaungmyatmoe
      @theaungmyatmoe ปีที่แล้ว

      @@sndro1 Model should not be shared to the others services. They should be domain specific to their own service. So that you have to attach service related domain object to your service

    • @sndro1
      @sndro1 ปีที่แล้ว

      @@theaungmyatmoe I do understand that but how do I share typescript types for these models/services (so that the consuming service knows what it gets)?

  • @muratasarslan2359
    @muratasarslan2359 ปีที่แล้ว +1

    thanks a lot. very helpful. is there a way to avoid duplicating CreateUserEvent in all microservices?

  • @chrismantonuk
    @chrismantonuk 2 ปีที่แล้ว +5

    Great, thank you - a lot clearer to me now! You covered everything

  • @Olixis
    @Olixis 2 ปีที่แล้ว +5

    How does the "sample-backend" knows that "COMMUNICATION" refers to the "sample-communication" microservice? As far as I saw the "COMMUNICATION" token is only at the "sample-communication" microsservice

    • @muhammadsalikin3886
      @muhammadsalikin3886 2 ปีที่แล้ว +2

      by using ClientProxy, sample-backend which acts as gateway is basically the one who reach out to the other services.

  • @Thikondrius
    @Thikondrius ปีที่แล้ว

    Great tutorial simple, and clear. Good job.
    Btw can I ask what your vscode theme is ?

  • @millerbyte
    @millerbyte 2 ปีที่แล้ว +11

    What's the point in using the event-based communication pattern if we have to declare / inject all the subscriber microservices (sample-analytics, sample-communication) within the publisher microservice (sample-backend)? Isn't one of the primary advantages of event-based communication the fact that the service publishing the event doesn't know / care about any downstream services that may subscribe to it? This seems like there's still tight coupling between services. For example, what happens if I want to add another service that cares about the user_created event -- will I have to modify the sample-backend to allow this? Seems like an antipattern. This isn't a criticism of you or the tutorial -- thank you for sharing! It's more a criticism of NestJS if this is how the expect you to handle event-based communication.

    • @mguay
      @mguay  2 ปีที่แล้ว +6

      This is a great criticism and I wholly agree. I’m making a new Microservices video that uses RabitMQ as the messaging broker which allows us to remedy a lot of these concerns around tight coupling. Thanks for watching!

    • @millerbyte
      @millerbyte 2 ปีที่แล้ว +1

      @@mguay Thanks for the reply, looking forward to the updated video!

    • @abdelhalim731
      @abdelhalim731 2 ปีที่แล้ว +1

      but this is good for communication between servers no?

    • @bv5191
      @bv5191 21 วันที่ผ่านมา

      I'm glad someone already asked this cause it is my concern as well. Having to inject the "microservices" just makes it a distributed monolith instead of a microservice architecture.

  • @vinimaciel
    @vinimaciel 11 หลายเดือนก่อน

    Awesome video, you made it so easy to understand

  • @larswolter669
    @larswolter669 ปีที่แล้ว +1

    How do you effectively test automate these event / message based applications?

  • @avimehenwal
    @avimehenwal ปีที่แล้ว

    Excellent vide Michael, love your content and way of explaining things. Keep it up

    • @mguay
      @mguay  ปีที่แล้ว +1

      Thank you!

  • @henrycodingstack6952
    @henrycodingstack6952 หลายเดือนก่อน

    I am a bit confused here i thought the sample-backend which is acting as the api gateway is supposed to pass the incoming request to a microservice to handle, whatever business logic and then the specific microservice can emit an event so that other services that needs to do anything with be notified.??

  • @PraneetNegi-n3i
    @PraneetNegi-n3i 3 หลายเดือนก่อน +1

    Can we use libs/common for Authorization and some other common utils like we do in monolithic project, using this microservice structure ?
    If Yes then please give me some references.
    Thanks

  • @tesla1772
    @tesla1772 2 ปีที่แล้ว +2

    i didn't understand how microservices get the event. http based api it is understood that port and ip is given but how does microservice listen to event

  • @manorinfinity
    @manorinfinity ปีที่แล้ว +1

    Thanks for the video. Loved it. It would be good if you could do a video on microservices and monorepo in nestjs. I mean how do you create a monorepo microservices project in nestjs where we have one API gateway for http requests and all the other microservices listens to events sent by API gateway without allowing http requests on their own.

    • @mguay
      @mguay  ปีที่แล้ว +1

      My new Ultimate Nest.js Microservices course will cover this! Stay tuned for its release in May.

  • @zackinfos5933
    @zackinfos5933 9 หลายเดือนก่อน

    thank you Michael for everything,
    well how do you compare this approach adopted by you, where you have added multiple nestjs projects to one aorkspace, which i found flexible, VS or compared to the one adopted by nestjs monorepo (apps)?
    well honestly i find this approach more flexible as i have said above for many reasons:
    - Scalability.
    - Teams and colaboration.
    - Multi-lang dev environment.
    - Database per microservice and the hustle of dealing with monorepos setup and configs for shared files and packages like prisma for example.
    - Avoiding limitations by any given framework, which makes you finding yourself dealing with solving problems by the same language often with the help of the same tools which results at the end of the same results, thats what stand agains the microservices principle and patterns.

  • @danilopootaren4512
    @danilopootaren4512 2 ปีที่แล้ว

    I loved it !! Quick question, would this work the same with docker container?

  • @hollynderisse645
    @hollynderisse645 2 ปีที่แล้ว +1

    Thank you very much for sharing this tutorial. It's well explained and very helpful

  • @ayoubguismi4558
    @ayoubguismi4558 2 ปีที่แล้ว +2

    As always simple and clear explanation, thank you michael !

    • @mguay
      @mguay  2 ปีที่แล้ว +1

      Thank you as always, Ayoub!

  • @hariharamoorthis3488
    @hariharamoorthis3488 ปีที่แล้ว

    Hi... Thanks for your tutorial... Can you please clear my doubt?.. can we call api endpoint of communication or analytics microservices?

  • @verrymariyanto8377
    @verrymariyanto8377 2 ปีที่แล้ว

    i learn a lota from this tutorial,, can you give litle bit explanation about how to get some return result about using this method,, if we using try catch in controller,, thx

  • @behradkazemi213
    @behradkazemi213 2 หลายเดือนก่อน

    great video thank you so much!

  • @sg0101010
    @sg0101010 ปีที่แล้ว

    Great video. Question: I'm getting a "no elements in sequence" from the getAnalytics call ? I'm on version 9.x.x

  • @Akim-z8t
    @Akim-z8t ปีที่แล้ว +1

    What is that theme? pllz

  • @jafar1607
    @jafar1607 11 หลายเดือนก่อน

    Brother. Can we have a multi tenant example with nest js ?

  • @thomasbalboa628
    @thomasbalboa628 หลายเดือนก่อน +2

    WTF, the tutorial doesn't work, even when reproducing exactly what the author does, it bugs when sending the POST request in Postman. Even after cloning the repo and running both servers with 'nest start --watch', nothing happens. The request runs infinitely, and there's nothing in the logs.

    • @Xeartoo
      @Xeartoo หลายเดือนก่อน

      Change the listening port on all back-ends. This should solve the problem.

  • @shalandichannel
    @shalandichannel ปีที่แล้ว

    Is there a way to use the TCP transport pattern with external apis that are not written with nestjs? And is it possible to use other TCP ports that are private to the microservices when dealing with TCP communication? Or must the traffic all go through the single "3000" port?

  • @malkasoft
    @malkasoft 2 ปีที่แล้ว

    Amazing tutorial! Thanks for sharing

  • @ninjatikeidu
    @ninjatikeidu ปีที่แล้ว

    At first it didn't work for me, after a while I understood that I needed to establish the host and port when registering the ClientsModule, after that it worked correctly, tks

    • @isaacnwankwo6634
      @isaacnwankwo6634 ปีที่แล้ว

      please How did you do that, I am facing the same challenge here. I

    • @isaacnwankwo6634
      @isaacnwankwo6634 ปีที่แล้ว

      please never mind, I have figured it out.

  • @alvin3171997
    @alvin3171997 2 ปีที่แล้ว +3

    Hi Micheal, have you used any backend framework in the past? Like Fastapi etc.
    Just wondering what’s the pros and cons of using Nestjs.
    Thank you so much for the video!

    • @mguay
      @mguay  2 ปีที่แล้ว

      Good idea for a future video!

  • @ericww32
    @ericww32 2 ปีที่แล้ว

    Is there a way to grab any message pattern and put it into a variable?

  • @okmylifeday
    @okmylifeday ปีที่แล้ว

    Thank you! Very good for me.

  • @jithinjacob2181
    @jithinjacob2181 2 ปีที่แล้ว

    How can it handle parallel processing of requests in the backend, mostly i have seen people use Java /Python to work out the backend

  • @PeterAkaliro
    @PeterAkaliro 2 ปีที่แล้ว

    wow! so simple lol.... You are a life saver bruh

  • @imranabdulmalik3591
    @imranabdulmalik3591 4 หลายเดือนก่อน

    You're the best!

  • @EstebanHelgueroCardiff
    @EstebanHelgueroCardiff ปีที่แล้ว

    Awesome video!

  • @sumitpatil7084
    @sumitpatil7084 2 ปีที่แล้ว

    Hello Michael how can i use typescript in nestjs

  • @maximcoding2667
    @maximcoding2667 ปีที่แล้ว

    How is it different from with gateway api + createProxyMiddleware ?

  • @temidayomichael4646
    @temidayomichael4646 2 ปีที่แล้ว

    Which one would you recommend between this pattern and the monorepo micro services pattern in your latest video and what’s the best practice in deployment and repo management? I think I like the monorepo more cos my team is small but I have no idea on the deployment. Thanks a lot!

    • @mguay
      @mguay  2 ปีที่แล้ว

      Really it depends on the differences between Kafka and RabbitMQ. I would also recommend a monorepo for smaller teams as it is easier to work with, but it is also makes deployment easier.

  • @ИванДрачев-ы3у
    @ИванДрачев-ы3у ปีที่แล้ว +1

    When i run 'sample-communication' app (after 'sample-backend' is running) - i got an error that port 3000 already in use...Could anyone give me an idea?

    • @navinmishra6038
      @navinmishra6038 9 หลายเดือนก่อน

      As the communication microservice by default listens to 3000 port, we need to make backend server listen to another port(eg: 3001). Then we can run both service

  • @homelander973
    @homelander973 ปีที่แล้ว

    thank you a lot bro, it was really helpfull

  • @raneanish21
    @raneanish21 2 ปีที่แล้ว

    How to implement multiple messagepatterns?

  • @xixayyumiko6766
    @xixayyumiko6766 2 ปีที่แล้ว

    how do I do if I made the microservice apart

  • @HarikrishnanM0
    @HarikrishnanM0 2 ปีที่แล้ว

    At what situations we should go for a microservice architecture ? I am basically developing rest apis .So how can we make a decision on building a micro service ?

    • @mguay
      @mguay  2 ปีที่แล้ว +1

      Microservices help you manage complexity as the size of your application + team grows. For simple projects with one developer, they're not as necessary in my opinion.

    • @HarikrishnanM0
      @HarikrishnanM0 2 ปีที่แล้ว

      @@mguay ok got it

  • @diegoalonso2832
    @diegoalonso2832 2 ปีที่แล้ว

    I have a doubt
    Is there another way to consume mi grpc service without an api gateway?

  • @nnu5510
    @nnu5510 ปีที่แล้ว

    Great video, thank you.

  • @nanonkay5669
    @nanonkay5669 2 ปีที่แล้ว

    Next, you show how to do it using a message broker

  • @talhacoder5084
    @talhacoder5084 ปีที่แล้ว

    that was so beautiful 🤯

  • @LasparkOficial
    @LasparkOficial ปีที่แล้ว

    Nice work!!

  • @minhazahmed128
    @minhazahmed128 ปีที่แล้ว

    This is good but this is gonna take a lot spaces, why not using nestjs workspaces?

  • @mahmoudfathy6332
    @mahmoudfathy6332 ปีที่แล้ว

    Amazing man 👌

  • @yousoffatomi
    @yousoffatomi ปีที่แล้ว

    thank you for record this video ♥

  • @yadneshkhode3091
    @yadneshkhode3091 2 ปีที่แล้ว

    How to use request body in services? without passing the body in functions in controllers

    • @mguay
      @mguay  2 ปีที่แล้ว

      I may make a video on it in the future, but check out github.com/nestjs-steroids/async-context

  • @siamak.hatami
    @siamak.hatami 8 หลายเดือนก่อน

    Great, thanks.

  • @miguecast
    @miguecast 2 ปีที่แล้ว

    Do you know that Guay is a very common 80's spanish expresión that means "cool"?

  • @lardosian
    @lardosian 2 ปีที่แล้ว

    Could all these services be split into their own repo?

    • @mguay
      @mguay  2 ปีที่แล้ว

      Sure you could but I’d say that typically doesn’t follow the standard practice of micro services. At the end of the day though do what best fits your needs.

  • @jazzdestructor
    @jazzdestructor 2 ปีที่แล้ว

    Hey guys, What is the difference between emit and send methods?

    • @sarunmrzn
      @sarunmrzn 2 ปีที่แล้ว

      I believe emit actually sends a request to the ms but send just proxies the entire request to ms, correct me if im wrong

  • @lialia3293
    @lialia3293 7 หลายเดือนก่อน

    Great !

  • @romeobetances7964
    @romeobetances7964 2 ปีที่แล้ว

    Great job!

  • @sabinshrestha267
    @sabinshrestha267 ปีที่แล้ว

    amazing

  • @Varshakumari-uz8uo
    @Varshakumari-uz8uo ปีที่แล้ว

    Why I am getting listen EADDRINUSE : address already in use error.

    • @foued619
      @foued619 ปีที่แล้ว

      same problem, that's because both servers are trying to run on the same port (3000)

    • @navinmishra6038
      @navinmishra6038 9 หลายเดือนก่อน

      @@foued619 As the communication microservice by default listens to 3000 port, we need to make backend server listen to another port(eg: 3001). Then we can run both service

  • @cholasimmons
    @cholasimmons ปีที่แล้ว

    Subscribed!

  • @narrajayasri94
    @narrajayasri94 2 ปีที่แล้ว

    I am unable to get the output can u guide me or respond to my comment. Plz

  • @deliomarcosdacostajunior3036
    @deliomarcosdacostajunior3036 2 ปีที่แล้ว

    Thanks from Brasil ! õ/

  • @martinavalos1626
    @martinavalos1626 ปีที่แล้ว

    what do you think about using prisma package for handling databases queries? did you ever use it ?

  • @SRPPixels
    @SRPPixels 2 ปีที่แล้ว

    when starting the communication server after running sample-backend. it is giving error that port 3000 already in use

    • @SRPPixels
      @SRPPixels 2 ปีที่แล้ว

      I also cloned your github project. it is still giving the same error

    • @cess_uyi
      @cess_uyi 2 ปีที่แล้ว

      Me too!
      Please how did you resolve this?

    • @hakeemullahjan
      @hakeemullahjan 2 ปีที่แล้ว

      Still facing the issue after changing the PORTs.

    • @akhil0227
      @akhil0227 2 ปีที่แล้ว +2

      on sample-backend in main.ts file . await app.listen(3001) and on sample-communication main.ts file - Transport.TCP, options:{port:3000} . use postman to send request in localhost:3001

    • @thaingocnguyen1015
      @thaingocnguyen1015 2 ปีที่แล้ว

      me too, i don't know why it can work on his machine @@

  • @saurabhtalele1537
    @saurabhtalele1537 5 หลายเดือนก่อน

    🎉🎉🎉cool

  • @mguay
    @mguay  ปีที่แล้ว

    Get my highly-rated Udemy courses at a discount here: michaelguay.dev/udemy/

  • @umer.on.youtube
    @umer.on.youtube 2 ปีที่แล้ว

    Do not use a stupid max. Get on Windows.

  • @nditahsamweld346
    @nditahsamweld346 2 ปีที่แล้ว

    Hi Michael Guay, what's your twitter handle. Nice job!

    • @mguay
      @mguay  2 ปีที่แล้ว

      Thank you! I don't have a Twitter though.