Тёмный

Clean architecture with nodeJs express : practical example in node.js 

Code with Jay
Подписаться 17 тыс.
Просмотров 18 тыс.
50% 1

How to build Nodejs Microservice with Kafka. It's an advanced course on Microservice development using Nodejs and Kafka. Where we will learn everything about the communication between services and Elastic search integration using typescript.
Diagram:
whimsical.com/...
Clean Architecture Episode Repository:
github.com/cod...
Repository:
github.com/cod...
Discord Channel:
/ discord
What are the key concepts you can learn from this course?
Software Development Estimation process
Clean Architecture
Kafka in Node.js with a practical example
Elastic Search integration
Prisma implementation as ORM
How to cover test cases
#nodejsdevelopment #express #javascriptframework #backenddeveloper

Опубликовано:

 

4 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 75   
@kemalsogut9342
@kemalsogut9342 8 месяцев назад
as I new learner, i learned clean architecture in c#. Actually did not create many projects with c# but i understood the clean architecture thanks to the teacher. I recently started learning node.js and was about to create my own project after tutorials. The think that stopped me was actually clean architecture. As I learned it from the c# courses I felt that somethings were going wrong in the node.js tutorials, then i searched clean architecture in node.js and found your video. It is very helpful and understandable as a beginner/low-intermediate. Thank you very much!
@codewithjay
@codewithjay 8 месяцев назад
Thank you for your kind words. Stay tuned to our channel and join our discord channel for Job offer announcements and updates. Cheers!
@shravan2891
@shravan2891 9 месяцев назад
I was waiting for this after watching first part. Good to see some unique advance stuff on RU-vid. Good work brother ✨
@techpassion5680
@techpassion5680 Месяц назад
I have a legacy nodejs project written 4 years. I recented update to clean articture. Thanks!
@ShaunEk1
@ShaunEk1 3 месяца назад
I’ve been poking around RU-vid and the inter webs for node/typescript specific examples of clean architecture and I gotta say I think your video is the *best* at showing the principles through a legit project, with code!! I do like how you simplified the tutorial, eliminating non essentials like an orm and messaging libs. Calling “use cases” by the name “interactors” is something I have not heard before. The only thing that I felt was truly missing was the interaction with the domain layer… you did create a domain object but then ignored it for the rest of the tutorial. Since it was such a small/simple project maybe it didn’t warrant calling any domain methods though, but would have been nice to mention that. Amazing video. Subscribing now.
@codewithjay
@codewithjay 3 месяца назад
Thank you for your appreciation. Some time it's not easy to cover all the edge cases. But I will take a note on your suggestion. Cheers!
@BarakAlmog
@BarakAlmog 7 месяцев назад
Great video! Thanks so much for your efforts.
@codewithjay
@codewithjay 7 месяцев назад
My pleasure!
@tilter4058
@tilter4058 2 дня назад
While watching, I realized that writing clean architecture and writing TDD at the same time seems extremely laborious. In this way, it will take a really long time to release the actual product. And the payment made by the company in return for the effort is also extremely important.
@codewithjay
@codewithjay День назад
normally most of the companies follow Clean Architecture and later stage cover the test cases with min 80% threshold but TDD is just to understand how things has to handle in learning stage. In real life its a bit time consuming for sure. If you learnt it you are good to go.
@abdullahsevmez42
@abdullahsevmez42 9 месяцев назад
İt's very clear. Thank you Jay!
@codewithjay
@codewithjay 9 месяцев назад
Glad it was helpful!
@zuenirclaudio4941
@zuenirclaudio4941 3 месяца назад
Thanks great tutorial. it helped a lot
@codewithjay
@codewithjay 3 месяца назад
I'm glad the tutorial was helpful for you! Cheers!
@abayomioloyinde
@abayomioloyinde 9 месяцев назад
How are you my friend? Happy new year in advance, I will watch this after my holiday, i know it's a goody as usual
@codewithjay
@codewithjay 9 месяцев назад
Thanks a lot my friend! Wish you Happy new year!
@sebastianlpoliak
@sebastianlpoliak 5 месяцев назад
Amazing video!!
@viralmoney8619
@viralmoney8619 29 дней назад
Hi sir.. if you don't mind.. could you please make one large application or creating apid for it by this way.. including authentication dto,types and type orm with mogodb testing?❤😊🎉
@hfmohammad
@hfmohammad 8 месяцев назад
Hi, Thank you for this tutorial. How we can avoid dependency injection? Example: AService.ts const AA = () => { BService.BB(); } const CC = () => { // some code } BService.ts const BB = () => { AService.CC(); } Note: we don't want use methods together Only services import to together
@marcelee124
@marcelee124 5 месяцев назад
Hey thank you so much.
@aabhishakemishra
@aabhishakemishra 9 месяцев назад
Great content ❤
@_NguyenTuanAnh-nr4ee
@_NguyenTuanAnh-nr4ee 8 месяцев назад
Great Video
@mohamadyousef2129
@mohamadyousef2129 7 месяцев назад
Thanks a lot man
@Riflijones01
@Riflijones01 8 месяцев назад
HI Jay. Are you still going to be creating the frontend for the microservices masterclass series? would be great to see even a basic design on the frontend to see how it all goes together
@codewithjay
@codewithjay 8 месяцев назад
Hey Thank you for writing! Certainly I will cover that in part 2. As soon as we covered this series Elastic Search Functionality.
@technoinfoworldwide2329
@technoinfoworldwide2329 9 месяцев назад
Also make another video by following functional based not classed based and used orm prisma
@sharaths2294
@sharaths2294 2 месяца назад
clean architecture is all great but why the need of dependency injection. I have never used so confused why used here ?
@devPloy
@devPloy 5 месяцев назад
Hi Jay, first of all thank you so much for share this proffessional knowledge, your channel is amazing. Sincerely the best and precise course of node that I ever had. I have a question my friend, in what layer should the repository be? I see that the product repository uses the external library "pg" and also it comunicates with Product entity. I am a little confuse about this, can you explain me? please.
@thebeginner613
@thebeginner613 3 месяца назад
Thanks bro ....
@VerdijtHanati
@VerdijtHanati 9 месяцев назад
Great work
@codewithjay
@codewithjay 9 месяцев назад
Thank you so much 😀
@akashdanva
@akashdanva 8 месяцев назад
Great Video. Can you please explain what was the need of .bind, why the constructor was not being called properly?
@codewithjay
@codewithjay 8 месяцев назад
Thank you for writing. In javascript and typescript bind returns a new function with the bound "this". Example: in our case router.post("/products", controller.onCreateProduct.bind(controller)); Here bind method is used to ensure that the onCreateProduct function is called with a specific this context, which is the controller object in this case. The bind method creates a new function that, when called, has its this value set to the provided argument. In this example, controller.onCreateProduct.bind(controller) creates a new function where the this value inside onCreateProduct will refer to the controller object.This is commonly done in the context of setting up routes in web frameworks, where you want to ensure that the controller methods are called with the correct context. Hope it will help! Cheers!
@sharaths2294
@sharaths2294 2 месяца назад
database is not working. i created clean_architecture database and defined table but cant create or find ?
@codingroom1230
@codingroom1230 7 месяцев назад
There are many ways to achieve clean architecture. In my opinion, it is good to use a framework.
@codewithjay
@codewithjay 7 месяцев назад
Yes you can. But you need to understand how it works at least while we are facing coding interviews the framework will not help to convince interviewers :)
@tilter4058
@tilter4058 2 дня назад
Hey Jay, We have a system that works and looks much cleaner at 42:04. I don't quite understand the reasoning behind implementing inversify here. After all, isn't the current form of Dependency Injection? Thank you.
@codewithjay
@codewithjay День назад
Hi Thanks, All the knowledge you have gain so far till 42:00 is the manual dependency injection process with transparency where we can understand how the mechanism works and you have full control on it. Now the big overheads are it's manual and you need to write lot of boiler plate codes to get the job done. So Inversify is a Dependency framework that is helping us to reduce all manual work and make sure instances are used efficiently for optimal memory usages. Here is why and which one to use: Inversify: Use it when working on larger projects, where dependency management could get complicated. It also fits well with TypeScript-heavy codebases, where decorators and metadata provide clear advantages in terms of type safety and cleaner code. Manual DI: It works well for smaller or simpler projects, where adding an entire framework for dependency injection may be overkill. It's also useful for learning or when the project does not need the complexity that a DI framework brings. Cheers!
@tilter4058
@tilter4058 День назад
@@codewithjay Thanks Jay. You are the best! I watch your videos and will renew my membership again soon.
@ericsiddiq7634
@ericsiddiq7634 9 месяцев назад
Thanks ❤
@mohit84604
@mohit84604 9 месяцев назад
Will there be any videos releated to Hexagonal architecture and Onion architecture because i have some doubts releated to them. Are they same except their name.
@codewithjay
@codewithjay 8 месяцев назад
They are not same. It is sharing common principles like separation of concerns in layers, and clean dependency pattern, Inversion of controls etc. Each architecture has it's own emphases and implementations based on use cases. Overall if you at least know one of them you are good to go. I will release some videos in future based on these concepts.
@kranthikumarvitta
@kranthikumarvitta 9 месяцев назад
Great work Jay! What should be the industry practice using orm models like sequelize,prisma erc. or raw queries as per tutorial? And what are your thoughts about using nestjs which has already using singleton or repository pattern
@abayomioloyinde
@abayomioloyinde 9 месяцев назад
@Jay you response on this will be appreciated
@codewithjay
@codewithjay 9 месяцев назад
Hey thanks a lot for writing! TBH there are no such silver bullet points as Industry best practices. But it's depends on your project requirements and how your team decide what to follow. I would recommend to use some ORM to save your time and complexity. Behind the scene all ORM is used raw sql only and it gives flexibility to deal with Database queries and execution using high level abstractions. You can use TypeORM or Prisma that is widely used in NodeJS ecosystem. You can use NestJS that's an wonderful framework! But not recommended for simple requirements and specially when we are not dealing with Microservice or big project requirements. But if you really want to structure project without put your hands to create structure like in our current video. You can go with NestJS. Note: We have not implemented any ORM on this Episode just for shake of time but we have already implemented ORM (Prisma) for our this series you will see very soon in coming videos. Cheers!
@codewithjay
@codewithjay 9 месяцев назад
please follow the answer!
@shravanology
@shravanology 9 месяцев назад
Love it
@bollo_omar
@bollo_omar 9 месяцев назад
I like the way you explained Clean architecture well but if I may ask, aren't just adding more abstractions and spreading code across multiple folders/files?
@codewithjay
@codewithjay 9 месяцев назад
Hi thanks a lot for your opinion! It's up to you how you organize your codes but in this project we tried to decoupled by keeping essential layers only as per the principal. If you understood the concept you can minimize your code accordingly. In this case if we not spreading the codes to layers it belongs to and not injected dependencies properly to perform the operation in the loosely couple way then it will be not meaning full to implement Clean architecture anymore. Cheers!
@adeniyitaofik3832
@adeniyitaofik3832 6 месяцев назад
link to the previous episode
@ishanbhawantha
@ishanbhawantha 3 месяца назад
How do you write the entity validator ? In that case how to avoid the couple between node packages for validation.
@codewithjay
@codewithjay 3 месяца назад
To write an entity validator in TypeScript while avoiding direct coupling to specific node packages, you can adopt an abstraction approach. This involves defining your own validation interfaces and using a strategy pattern to apply various validation implementations. In our case we are using AJV and typeBox with generic to disconnecting the coupling.
@ishanbhawantha
@ishanbhawantha 3 месяца назад
@@codewithjay Thank you !
@erickweil4580
@erickweil4580 3 месяца назад
I'm trying to implement this architecture to one of my projects but using nodejs without the typescript thing, and the dependency injection thing of having a instace of the interactor seems not necessary, If I want to test with a mock I can override the static class instance of the methods in the interactor itself.
@codewithjay
@codewithjay 3 месяца назад
Hi, Thank you for writing. Here we just want to give an overview of how clean architecture works by keeping loose coupling of the layers and dependencies. It's up to you to follow the pattern or maybe you can shape it as per your application needs by revoking extra layers. You do not necessarily need to use interactors in the case of Javascript it is out of the question. In functional programming, you can get rid of it and hook up with your dedicated function to replace the functionality. You can watch our latest episodes for references. Cheers!
@chess4964
@chess4964 4 месяца назад
If you are going to implement this on Nodejs why not use Nestjs instead?
@codewithjay
@codewithjay 4 месяца назад
Thank you for writing and your opinion. We are focusing on to understand the mechanism only not the a framework. You can use NestJS if you know how it works behind the scene. Note: This tutorial series made based on viewers request how to build such system using NodeJs not NestJS.
@coder_one
@coder_one 8 месяцев назад
Does every refactoring on "clean architecture" have to end up writing OOP? Why didn't you stay with the functional approach?
@codewithjay
@codewithjay 8 месяцев назад
It's not about ended with Object Oriented Programming! It's about the removing dependencies and utilize of layered architecture that Domain and Application business logic not to tightly dependent on framework and drivers etc. If you understand the concept correctly you can utilize it on functional programming as well. We following Class pattern just to make people understand easy way. If you are following this series you will see the functional usages with clean architecture in future lactures. Cheers!
@eR1cK92
@eR1cK92 4 месяца назад
If I want to add any middleware for example I have jwt and the request needs the token, where can I add the middle ware for each requesg and how ??
@codewithjay
@codewithjay 4 месяца назад
You can add it in the route file example: // Authentication middleware (example) const authMiddleware = (req: Request, res: Response, next: NextFunction) => { // Placeholder for actual authentication logic with jwt const isAuthenticated = true; // Replace with real authentication check if (!isAuthenticated) { return res.status(401).json({ message: "Unauthorized" }); } next(); }; // Apply middleware to all routes router.use(loggerMiddleware); or if specific endpoint needs authentication you can use like below: router.post( "/products", authMiddleware, async (req: Request, res: Response, next: NextFunction) => { try { const { errors, input } = await RequestValidator( CreateProductRequest, req.body ); if (errors) return res.status(400).json(errors); const data = await catalogService.createProduct(input); return res.status(201).json(data); } catch (error) { next(error); } } ); Hope it will help you :) Cheers!
@NathanielBabalola
@NathanielBabalola 9 месяцев назад
Don't you think every Entity having it's own folder is better..... then they have their own files inside their folder.... controller, service, repository, interface e.t.c
@codewithjay
@codewithjay 9 месяцев назад
It's up to you how you organize your files. Only matters to follow the principal and Enterprise and Application business rules should not affect when we change UI and framework along with Data Access Layer.
@vyteniskuciauskas
@vyteniskuciauskas 6 месяцев назад
For those many files needed for just one entity you need to introduce a generator :)
@codewithjay
@codewithjay 6 месяцев назад
You can use one as per your convenient. Cheers!
@tilter4058
@tilter4058 2 дня назад
What do you mean by saying "generator", could you explain it?
@vyteniskuciauskas
@vyteniskuciauskas День назад
Something like plopjs
@pranav7478
@pranav7478 9 месяцев назад
Jay , what is your opinion about nestjs
@codewithjay
@codewithjay 9 месяцев назад
Yes, You can use NestJS that's an wonderful framework! But not recommended for all the use cases. Example some times its overkill when we have simple requirements and specially when we are not dealing with Microservice or big project requirements. But if you really want to structure project without put your hands to create structure like in our current video. You can go with NestJS. Cheers!
@aabhishakemishra
@aabhishakemishra 9 месяцев назад
Sir will u apply Kafka in this project?
@codewithjay
@codewithjay 9 месяцев назад
Yes this series is based on Kafka & Elastic Search, Prisma and Clean Architecture!
@awesomeguy6427
@awesomeguy6427 9 месяцев назад
what's ur vs code font I love it
@codewithjay
@codewithjay 9 месяцев назад
JetBrains Mono
@ArnabDas-q9f
@ArnabDas-q9f 17 дней назад
nest js
@khaledmansour59
@khaledmansour59 Месяц назад
"Right?" *100000
Далее
When to use ORM in nodejs ?
7:59
Просмотров 2,2 тыс.
Clean Architecture in TypeScript
58:19
Просмотров 23 тыс.
skibidi toilet multiverse 042 Trailer
01:57
Просмотров 1,9 млн
Microservices with Databases can be challenging...
20:52
Node.js Doesn’t Suck Anymore
16:59
Просмотров 116 тыс.
Node.js is a serious thing now… (2023)
8:18
Просмотров 651 тыс.
skibidi toilet multiverse 042 Trailer
01:57
Просмотров 1,9 млн