DEV Community

Discussion on: A different approach to frontend architecture

Collapse
 
jackmellis profile image
Jack

👍 really good article. I've been writing FE apps almost identical to this for a few years now and it's a great pattern to use. Bonus points if you use dependency injection to further decouple your layers!

Collapse
 
tuanlc profile image
Lê Công Tuấn

Bonus points if you use dependency injection to further decouple your layers!

How do you use dependency injection on the FE side?

Collapse
 
itswillt profile image
Will T. • Edited

@tuanlc I guess you can check out Jack's article about it: dev.to/jackmellis/dependency-injec....

Collapse
 
itswillt profile image
Will T. • Edited

Hi Jack, thanks for reading the article 😃.

In the example app, I'm already doing some simple manual dependency injections in the Application layer. In the frontend world, we still have to keep in mind code splitting & lazy loading, so dependency injection is a little bit different from what we do in the backend side I think.

Collapse
 
jackmellis profile image
Jack

Yes code splitting is a big issue for DI on the front end. In a node app, for example, you can just grep all of your dependencies when bootstrapping with very little cost. This is actually something I'm trying to work out right now 🤔

Thread Thread
 
itswillt profile image
Will T.

@jackmellis Please write an article about it if you ever figure it out 😍.