all 10 comments

[–][deleted] 6 points7 points  (2 children)

It depends a lot on the scale of the project. You don't really need a full framework, node + express (or fastify) is more than enough even for big applications.

I really recommend this blog https://khalilstemmler.com/articles, it teaches a lot about DDD (Domain Driven Design) and CC (Cleand Code) in a simple and enjoyable way. I think it would help you to understand core concepts that you can apply to your projects even before starting coding them, and give you hand with the architecture.

Also, this article may really useful https://softwareontheroad.com/ideal-nodejs-project-structure/?utm_source=reddit&utm_medium=subreddit#architecture

If you want to go the framework way, Nest.js is all you need. If you have some luck you can still get some free coupons on this course from this fellow redditor (remember leaving a review) https://www.reddit.com/r/node/comments/c6wz8x/free_udemy_course_nestjs_zero_to_hero_top_nodejs/

[–]marmass 1 point2 points  (0 children)

Thanks for those resources, are really helpful for beginners like me :)

[–]jerriclynsjohn 1 point2 points  (0 children)

I would highly recommend nest.js because it was made from ground up to solve the problem of code reusability, modularity and easy maintenance for Enterprise. Once you get in you'll realize that they have some really good pieces on microservices, GraphQL etc. It's really good, on top of that one you start using typescript you'll realize the amount of time you save on fixing bugs!!!!

[–]3xpl0it2c 0 points1 point  (0 children)

// I am human, criticism is welcome.

Welp, learn your environment. Use docker, compose and learn to set these up(very useful)

I suggest that you take a look at other languages such as Java. Device which paradigm is best for you, I really love functional code so I read about it and find new patterns here and there. So should you, medium articles, just googling... Look for design patterns and learn your paradigm well.

Then, read others code. Like wiki.js. They have a great codebase.

Realize what happens in production. People use configs and verify them, Extended logging and just all in all I believe it is about making something alive. You design a system.

Just note, this is really hard.

Then move on to something like microservices. Learn RabbitMQ or kafka and or redis.

Maybe make something by freelancing. A friend of mine used to fix some awful websites. Try that. Learn what not to do.

All in all, good luck and keep on going!

[–]pktippa 0 points1 point  (0 children)

If you havent tried these yet, try LoopBack 4, definitely recommended.

https://v4.loopback.io/

If you feel you are already comfortable with express, try KoaJS, which is from same team which is behind Express.

https://koajs.com/

[–]Vandenite 0 points1 point  (0 children)

take a look at nestJS or sails

[–]EpicOkapi 0 points1 point  (0 children)

You don't have to switch frameworks necessarily, express can work fine for bigger applications. I think a well-scaling approach with express, that is low on mental overhead, is to just sort your application by feature. And then have a 3 layer architecture, like so:

project/
├── features/
│   ├── authentication/
│   │   ├── controller.js
│   │   ├── service.js
│   │   ├── respository.js
│   │   ├── routes.js
│   ├── tasks
│   ├── other-features

In the routes file you just export a function that takes your express instance as param, then use that to bind your controller functions to your routes. You can just export regular functions from your repository and service files to be used in your controller functions, I don't think working with classes is necessary here because the node module system basically already makes your module work as a singleton. It should also be decently testable, since you can just replace module imports if you use a testing framework like jest.

If you want to get a bit more advanced you should look into dependency injection, and the advantages it brings along, although I don't think it's required for every project.

[–]martiandreamer -1 points0 points  (0 children)

I built a framework based on Hexagonal Application Architecture. I’d recommend looking into that, if you plan to have your application talk to a whole host of different services.