Nest.js Microservices with NATS, SQL, and Docker

preview_player
Показать описание


Support the Channel:

Connect with me:

0:00 - Introduction
8:20 - Project Setup
22:00 Docker Compose
35:44 Users HTTP API
52:00 Send message to User Microservice
1:15:20 - Communicating between Microservices
1:23:38 - Connect Microservices to Database
1:53:00 - Handling Relational Data
Рекомендации по теме
Комментарии
Автор

00:02 Microservices divide work into multiple processes.
02:28 Microservice architecture can vary based on business needs and scalability.
07:21 Sharing a single database for all microservices to simplify
10:02 Install NestJS microservices and NATS packages for setting up microservices and delivering messages
14:47 Setting up Docker and Docker ignore file for a Node.js project
17:05 Setting up other microservices in development mode
21:27 Setting up Nats protocol and Docker compose for microservices.
23:31 Exposing ports and setting up volume for hot reload
27:44 Configuring microservices to connect to Nats server and update via Docker
29:38 Services can connect to the NATS server using the service name as the host name in Docker.
34:05 Setting up communication between API Gateway and user microservice
36:11 Setting up user module and controller in Nest.js for microservice architecture
40:54 Fixing dependency resolution issue in Nest.js application
43:16 Creating a data transfer object (DTO) for user payload
48:03 Setting validation rules for request body in Nest.js
50:10 Sending validated request body to users microservice using NATS
54:24 Using the @Controller decorator and subscribing to events in Nest.js Microservices
56:41 Using Nest.js microservices with NATS and SQL
1:01:05 Understanding how to subscribe to an observable and return values in Nest.js
1:03:04 Creating a new payments module and controller in the API Gateway project.
1:07:02 Comparing event-based approach with request-response message style.
1:09:07 Setting up a payments module and controller for the microservice
1:13:18 Annotations and validations in microservices
1:15:16 Communicating between microservices using NATS and TCP connection
1:19:22 Setting up NATS for emitting and receiving events
1:21:18 Demonstration of microservices communication and event handling
1:25:10 Configuring SQL Server and connecting to database
1:27:26 Installing RM and database driver for SQL interaction
1:31:46 Setting up TypeORM entities for creating database tables
1:33:48 Setting up user entity with decorators and TypeORM module
1:38:44 Registering user service and entity in Nest.js module
1:40:59 Creating and saving user data to the database
1:45:15 Create and share entities as npm packages for reusability
1:47:24 Creating a payments service and interacting with payments table
1:51:35 Nest.js allows creating asynchronous microservices that don't depend on each other.
1:53:38 Establishing one-to-many relationship between users and payments entities in Nest.js Microservices
1:57:27 Registering user and payment entities in Nest.js app module and microservice project
1:59:52 Adding user ID as a requirement for creating payments
2:03:56 Destructuring and handling fields from the create payment DTO and interacting with the users microservice.
2:06:12 Using Nest.js to grab user data from the database and send messages to user microservice.
2:10:21 Logging and creating payment in sequential order
2:12:24 Logging and handling of user events in microservices
2:16:34 Using relations to grab all payments of a user from a shared database.
2:18:39 Implementing microservice architecture with Nest.js, NATS, SQL, and Docker.
Crafted by Merlin AI.

somerandomchannel
Автор

It's very nice to see a dedicated Nest.js youtube channel even for a frontend developer like me =) thank you Anson for these precious videos about Nest.js! <3

bugraotken
Автор

thanks for this tutorial man, I really appreciate it

notabotlul
Автор

Anson this is awesome! Really enjoying this one!

xVantwoutMaarten
Автор

Very nice explanation. The schema at the beginning was very helpful. Before watching this video, I had also created a similar architecture, but I wasn't aware of microservices in NestJS, so I used sockets for asynchronous communication.

mykolatokariev
Автор

Hello Anson! Thank you for such an amazing lesson, I really appreciate your work!

jagajaga
Автор

Thank you so much for this insightful video.

overrevvv
Автор

nice2 🤓 super easy to understand. Thank you.🤗.

AmarjargalB
Автор

I love sqlzzz too 🔥💯 thank you so very much Anson for cool tutorial…🎉 very excited. We are waiting for cool project 🔥🔥🔥💯

andrejkling
Автор

I think for the mysql probably the best thing would be to create a docker network instead of exposing ports

PatalJunior
Автор

I'm curious how scaling works with micro-services, how do you keep the data synced if you are horizontally scaling ?
MySQL replication with K8s, would that be it ? (If not all of them are connecting to the same database, sure this is probably really overkill, I'm just curious)

PatalJunior
Автор

what the difference between RabbitMQ & NATS ? when do you recommend pick NUTS or RabbitMQ ? thank you

oleksiishkulipa
Автор

Thanks for the nice tutorial. Your editor's font looks awesome. Would you mind to share the font name :)

kegxldx
Автор

Very useful tutorial and excellent explanation, I did same with postgres, everything work fine, but nestjs_db doesn't appear on pgAdmin, is it normal?

mvpovnv
Автор

Awesome tutorial! Quick question...do the DTO's have to be classes or will the validation annotations still work even if they are represented as a TypeScript interface instead?

mkopoku
Автор

nestjs microservice "exception filters" code structure ??

ObulRakhim
Автор

Hey, Anson, how do I send some data to the API gateway from microservice correctly? It seams that NATS is not the best way to send the data.

mykolatokariev
Автор

Thank you very much for this video. I have a small question. I'm new in microservice world. Suppose i want to setup authentication or authorization through this way of Nats, will i have to do it on the http api gateway or to something else like other microservice? Best regards 🙏

lfqnipt
Автор

Nice video. Btw. do you know how to avoid a duplication of the DTOs in the http-api-gateway and in the microservices?

mykolatokariev
Автор

You forgot to specify how to install Exception filters in miceoservice. please give me a manual too

ObulRakhim