E-Commerce Microservice with NodeJS and RabbitMQ | NodeJS Microservice | Microservice Architecture

Sdílet
Vložit
  • čas přidán 26. 07. 2024
  • In this video, we'll build a complete e-commerce microservice application using NodeJS and RabbitMQ.
    Github Code Link: github.com/manosriram-youtube...
    Don't forget to Subscribe!
    Share your ideas for my next video: request.manosriram.com
    Find pair-programming partners: mydevfriend.com
    Timestamps:
    Intro: 00:00 - 01:00
    Setting up project and installing libraries: 1:00 - 5:26
    Creating User Schema: 5:26 - 7:27
    Register Route: 7:27 - 8:56
    Login Route: 8:56 - 11:59
    Testing Register and Login route: 11:59 - 13:25
    isAuthenticated middleware: 13:25 - 16:54
    Setting up product-service: 16:54 - 21:43
    Creating Product Schema: 21:43 - 22:49
    Create Product route: 22:49 - 26:44
    Buy Product route: 26:44 - 30:12
    Create Order Schema: 30:12 - 31:12
    Order and Product service queue handling: 31:12 - 45:55
    Outro: 45:55 - 46:03
    FOLLOW ME HERE:
    Website: manosriram.com
    Github: github.com/manosriram
    LinkedIn: / manosriram
    My Blog: blog.manosriram.com
    Twitter: / _manosriram
    📻 Join the Discord Server: / discord

Komentáře • 102

  • @DarknessDescend
    @DarknessDescend Před 2 lety

    I loved this tutorial! Thank's for sharing, man!

  • @naveenkumarhr3864
    @naveenkumarhr3864 Před měsícem

    simple and straight forward approach i ever seen for micro-services tutorial and more helpful than others. Thank you🖤

  • @svnesh2558
    @svnesh2558 Před 7 měsíci

    Excellent tutorial, clearly explained with code & errors also, very much appreciated. Thanks a lot

  • @chandanchhajervlogs1051

    Awesome tutorial video! I just loved it.

  • @ramiworkstation
    @ramiworkstation Před 2 měsíci

    Thank you very much for sharing such a great tutorial. 👍

  • @selvabalajis3924
    @selvabalajis3924 Před 3 lety

    I understood how It works clearly. Thanks for your nice explanation

  • @sitcomrave
    @sitcomrave Před 2 lety +2

    Came here for message queue ,impressed by vim skills.

  • @webhook4729
    @webhook4729 Před 5 měsíci

    Gratitude for the incredible Node.js microservices architecture integrated with RabbitMQ for CZcams! This innovative approach has revolutionized the way we handle our platform's complexity, enabling seamless communication and scalability. With Node.js' agility and RabbitMQ's reliability, we've been empowered to deliver a top-notch user experience while efficiently managing our growing audience. Huge thanks to the brilliant minds behind this architecture for providing us with the tools to thrive in the dynamic world of online content creation. 🚀🙏 #Grateful #NodeJS #RabbitMQ #CZcams"

  • @kk-kw7yx
    @kk-kw7yx Před 3 lety

    You are a life saver.

  • @alshojamikbal8510
    @alshojamikbal8510 Před 3 lety

    Good Info Man Keep going

  • @vasurangpariya8492
    @vasurangpariya8492 Před 2 lety +2

    Very informative video but if you create big project and explain pros and cons of rabbitmq about scalability and how to use it in production and about security things it will be great

  • @Viralstuffzworld
    @Viralstuffzworld Před 2 lety

    you make easier microservice understanding using node js

  • @amacodes7347
    @amacodes7347 Před 2 lety

    Thanks very informative

  • @nitindhiman2607
    @nitindhiman2607 Před 3 lety

    This was very informative. Thanks

  • @AwakeningofAI
    @AwakeningofAI Před 3 lety

    great stuff mate.

  • @sina-qh8wm
    @sina-qh8wm Před rokem

    just Perfect...

  • @thisissharief7651
    @thisissharief7651 Před 2 lety

    wounderfull
    and very very thanks for the github link

  • @fyargat
    @fyargat Před 2 lety

    Thank you!

  •  Před 3 lety

    I got the concepts, thks bro

  • @pramodkharade5373
    @pramodkharade5373 Před 3 lety +2

    @ManoSriram : worth to watching video and simple way to understand the Microservice with Rabbitmq. Could you please create application with Kafka as well

    • @manosriram
      @manosriram  Před 3 lety

      Thank you Pramod, there is already a video on Kafka on my channel. You can check that out.

  • @codedestiny6955
    @codedestiny6955 Před 3 lety +1

    Thanks for your time, I will use this project to develop logging system using elk stack

    • @manosriram
      @manosriram  Před 3 lety

      Thank you, glad this video is useful for you :)

    • @codedestiny6955
      @codedestiny6955 Před 3 lety

      @@manosriram what if our queue goes down ?? How do we ensure our service availability

    • @manosriram
      @manosriram  Před 3 lety

      @@codedestiny6955 Usually, the messages in the queue will be persisted and when the queue is up, will be consumed which I have demonstrated at the end of the video.

  • @prabinlamsal74
    @prabinlamsal74 Před 11 měsíci

    I love seeing you use vim while doing these tutorials. hahaha. great.

  • @ADITYAKUMARking
    @ADITYAKUMARking Před 3 lety

    this channel is underrated.

  • @kumar_sanjeevdutta1069

    Great

  • @mariomp4973
    @mariomp4973 Před 2 lety

    Hello :) how are you, a query ... if in the case I want to add another function called UpdateOrder in the order service then I add it but how did you call it from Auth for example? because I see that the example is when you have a single createOrder function and you call it by the "ORDER", as it would be when you want to call a new UpdateOrder function with Income Parameters.

  • @mjjuneja
    @mjjuneja Před 3 lety +7

    Hello, @ManoSriram eventually what you did was right apart from creating another queue for response in the same route. The major purpose of using queues is to get asynchronous nature. Apparently, you destroyed that purpose by defining the response queue at the same spot.
    Even if your queue would have worked fine in a sync manner, if we look for a rather scaled and bigger architecture you will start receiving wrong responses because of ill order acknowledgments.

    • @manosriram
      @manosriram  Před 3 lety

      I agree with you, this is just a sample or demo application, so I think those problems are negligible.

    • @mjjuneja
      @mjjuneja Před 3 lety +1

      @@manosriram no doubt, rather easy and straightforward explanation! Good work mate.

  • @riteshthakur9250
    @riteshthakur9250 Před 3 lety

    Let's say we are deploying this whole application in aws so how we will configure nginx for order service because this service is not getting any api request or response it's just getting data from message broker and using it to make orders but it's running on a port to do all these tasks so when we will deploy it to aws how we will configure it for nginx proxy pass or location for api we can upstream it for server ip which we will get from aws instance and port of the server but what about location and proxy pass please give a suggestion

  • @hoseinmirian
    @hoseinmirian Před 2 lety

    big thanks. great video. one question';' in a actual prod ver I saw ur github code, so how each service which have separated repo can have auth service or isAuthenticated service shared among them without repeating the code? tnx

  • @techtravis5610
    @techtravis5610 Před 3 lety

    Sir, i have to add frontend to this, what will entry point from browser and all can u explain . Thank you

  • @lancerdonnie
    @lancerdonnie Před 3 lety

    Awesome content 👍. Just when I was looking for how to connect services with message brokers.

  • @amanullahghouri1149
    @amanullahghouri1149 Před 2 lety

    thaks subscribed too

  • @blitzkreig4887
    @blitzkreig4887 Před rokem

    How does RabbitMQ compare to Kafka , when you consider a Ecommerce application ?

  • @023PrashantSharma
    @023PrashantSharma Před 2 lety

    you should show folder structure, it will help

  • @guruprabakaran5168
    @guruprabakaran5168 Před 2 lety

    It's really helpful. Could you please help me to achieve this approach in Python or Flask python?

  • @mikejames6452
    @mikejames6452 Před rokem

    Hi anyone can explain why /product/buy we need to hit api twice for correct answer .Also if i shift res.json in consume method than error occurs

  • @AnthonyFinix
    @AnthonyFinix Před 3 lety +3

    Your video is very informative and thank you very much. But it does introduces further problem of dependency among services. And response is essentially waiting for the whole saga to be completed. Can you please publish a video about how to mitigate these problems

    • @manosriram
      @manosriram  Před 3 lety

      Yes, thank you. Will make a video on this.

  • @RahulAhire
    @RahulAhire Před 3 lety

    At what scale using message queue make sense? I have known that queues can be utmost helpful during really high amount of traffic when managing throughput is essential and also has retry feature. For eg. AWS lambda has a its own throughput limit was can be balanced by SQS, step function, etc. How helpful is it for small scale where I just want to handle basic crud app? What's your view?
    Edit: small suggestion, treat your audio in adobe audition with denoise filter and parametric EQ during editing to remove background noise and it will sound better.

    • @manosriram
      @manosriram  Před 3 lety +1

      Message queues are most useful in microservices. Microservices are used at Scale (Huge codebases).
      For small-scale apps, it can still help you to handle your application if it is scaling steadily.
      Thank you, I have found the audio bug and will fix it from next video :)

  • @mohitsoni8951
    @mohitsoni8951 Před 3 lety +1

    Nice, good info.
    Can you structure all these using typescript and make routes, controller, db connection and db model in different class file.

  • @bushranikhat2326
    @bushranikhat2326 Před 3 lety

    How to write from rabbit mq to mongodb?

  • @zulqadarabbas7567
    @zulqadarabbas7567 Před 2 lety

    I am wondering, cant you make the isAuthenticated function into a separate middleware that isn't in the project dir?

  • @sivaganeshchitti
    @sivaganeshchitti Před 2 lety

    Awesome video.can you please advise. is it possible separate each micro services in different languages like PHP,golang. Each micro services connect to one nodejs api.like grpc

    • @manosriram
      @manosriram  Před 2 lety

      Yes, it is possible to have different microservices in different languages. Only the API matters.

  • @djamaatul
    @djamaatul Před 2 měsíci

    i not understand , its weird, api /product/buy channel consume no have await, but got response with data from consumer, it code syncron and blocking ?

  • @socialcatalyst2608
    @socialcatalyst2608 Před 2 lety

    Thanks.
    Use please rtx voice.

  • @rajatgupta6409
    @rajatgupta6409 Před 3 lety

    Nice Man, thanks. But just one question. Clear and Simple question or you can say it's my doubt only that For Microservices, we do not need docker (compulsory) right? we can only use Rabbit MQ and node js and other stuff right ?

    • @manosriram
      @manosriram  Před 3 lety

      Yes, you can install rabbitmq locally and connect it with the application.

  • @johncarter4091
    @johncarter4091 Před 3 lety

    How we create relationship between 2 microservices like products and order?

    • @codingintelugu8820
      @codingintelugu8820 Před 2 lety

      By raising events! we can use kafka or rabbitmq to consume & emit these events, where products & orders handle that event data accordingly

  • @nagashishsv843
    @nagashishsv843 Před 3 lety +3

    Amazing video bro, but small issue..
    at the first time u hit the route, u got an empty response (at 42:32 )
    again next time u hit the route then a response came, (at 42:34 )
    Is this correct?
    Actually we are getting wrong response for the current hit to that route((I,e we are getting response of the previous hit)
    At very first time, before the queue consumes the message, the call back returns order, where it is undefined still, so u got no output. By this time your queue will consume message and assigns it to order, so that in the next hit to the route, this order value is coming, which was supposed to come in the before hit itself.
    So to get the correct output, we need to hit the route twice…
    So how to solve this issue.???
    Can we write return res.json(order) inside the consume function itself?
    (I did like this, the 1st hit gave me correct output, but while in the 2nd hit, the server is getting crashed, saying Error: Can't set headers after they are sent, )
    Please Correct me if I am wrong..

    • @manosriram
      @manosriram  Před 3 lety +1

      Yeah, you cannot return inside a consume function. So, I tried returning outside the function. I think the problem might be like, it always waits to consume and you cannot return all of a sudden, maybe we can have some callback fn which helps us to return after consuming. Will try to do a video on this if I find a suitable solution.
      Thank you for watching :)

    • @harishkumark9010
      @harishkumark9010 Před 2 lety

      yes sending request twice returns the response back any solution for this

    • @boubaker86
      @boubaker86 Před rokem

      @@manosriram you can simply use await to wait for the consumption first then you can send a response

  • @patrickboahene1449
    @patrickboahene1449 Před 3 lety

    @Mano Sriram I need a little clarification please. Why did you send data back from the order service to the product queue

    • @manosriram
      @manosriram  Před 3 lety +1

      Because the client called the Product API. We have to return a response from that exact api. So after finishing the job in the order service, we return back data to finish and respond to the client.

    • @patrickboahene1449
      @patrickboahene1449 Před 3 lety

      @@manosriram ​ ok...Thank you so much

  • @kk-kw7yx
    @kk-kw7yx Před 3 lety

    Can you make a video on kafkajs in node microservices app soon sir? I am waiting to implement in my project. TQ!

  • @mdazimbabu5001
    @mdazimbabu5001 Před rokem

    we can also use the kafka insted of rebbitmq ?

  • @kalkidan.t
    @kalkidan.t Před rokem

    great tutorial but why do you have to use vim to write the code? I find my self wanting to see the full folder structure a lot in the video.

    • @manosriram
      @manosriram  Před rokem +1

      i usually write code in vim; but i'll try to show the file tree from now on.

  • @developpementdigital1036

    Thank you for this video, it war very clear,
    I want to dockerise this services and use nginx as reverse proxy, can you please tell me how can i handle with middlware isAuthenticate, should i make its own container ?

    • @manosriram
      @manosriram  Před rokem

      I don’t think you need to dockerfile the middleware. You can just use it without separately containerising it

    • @developpementdigital1036
      @developpementdigital1036 Před rokem

      @@manosriram thank you for your response. The solution i found is integrating the middlware in each service. I don't know if it's the best approch or not but i can't use the middlware separately because i'm using docker-compose for managing my containers.

  • @YOitsBA
    @YOitsBA Před 2 lety

    How did rabbitmq know which order to return to which request? I'm imagining a case where hundreds of people are hitting that route and adding items to the order queue, how would the consumer of new order know which order to return with which request?

    • @gilbertokullo63
      @gilbertokullo63 Před 2 lety

      thanks for asking, am stuck right now doing something like this

  • @kk-kw7yx
    @kk-kw7yx Před 3 lety

    Can you make a video on kafkajs in node microservices app?

    • @manosriram
      @manosriram  Před 3 lety +2

      Sure, will do it in the very near future.

    • @piyushmahapatra5402
      @piyushmahapatra5402 Před 3 lety

      @@manosriram Please do this bro,your channel is going to be my new hangout

  • @abhijeetshikharvlog1444

    Can you make video microsevices without rabbit mq like i want api gateway

    • @manosriram
      @manosriram  Před 3 lety +1

      Yes, I am thinking of doing a Gateway for microservices very soon. Do subscribe to stay updated :)

    • @abhijeetshikharvlog1444
      @abhijeetshikharvlog1444 Před 3 lety

      Can u help me create microsevices i will send mail

  • @chandanSINGHIIMS
    @chandanSINGHIIMS Před 3 lety

    please make same program with kafka Pleaseeeeeeeeeee

    • @manosriram
      @manosriram  Před 3 lety

      I already have a video on Kafka, do check that out 😄

  • @windwardhive7363
    @windwardhive7363 Před 3 lety

    github repo link please

  • @riteshthakur9250
    @riteshthakur9250 Před 3 lety +1

    Bro what in this world you are not using visual studio code

  • @MukeshSharma-lo1vv
    @MukeshSharma-lo1vv Před rokem

    Please use vs code with good theme, and also the file structure should be visible

  • @subhampanja4590
    @subhampanja4590 Před rokem +1

    Where is your pain bro?
    You are teaching people in a very complicated manner.
    I know you are a good coder and you are committed to using a vim editor for your learning means remember the Syntex.
    But just think people here are coming to learn something .why you are making it complicated.

  • @Looneytune
    @Looneytune Před 2 lety

    No ESLint, no TS, not real microservices, RabbitMQ doesn't any sense here, why did you go for gRPC, Kafka or something, would be a better fit. I don't wanna be mean, but nobody should take this as an example.

    • @amacodes7347
      @amacodes7347 Před 2 lety

      what have u done? Dumb ass u're already mean. Give ur opinion as in pros and cons and state ur preference pussy

    • @Anshucodes
      @Anshucodes Před 6 měsíci

      the only thing was missing here was api gateway !!