#How do i architect my nestjs backend ?

9 messages · Page 1 of 1 (latest)

balmy aurora
#

I'm implementing the backend service for my company completely from scratch,
it's a monolith but as we hit the scale we plan to migrate into microservices.
I did not find enough resources in the documentation, that talks about software architecting and practises, specifically given in this context
I would Also like to learn more about design patterns that can be used in this framework

past dome
#

This is a pretty broad request, so I'll speak broadly 🙂

With Nest, think of all of your features as self-contained modules. The idea is that when the feature is "complete" it should be pretty easy to take the folder the feature belongs to and drop it into a new Nest project without having to reconfigure too much. Maybe the way the database works, maybe the imports for the module, but generally it should continue to "just work" in a different nest enviornment.

If you plan to split into microservices eventually, I'd highly suggest using Nx and making every feature you have a library, so that when you do split, you already have your features separated and can just point the imports to the correct spot. I'm already doing this with my side project even though I have no intentions of making it a microservice-like application, because the separation of the domains is that helpful

balmy aurora
past dome
#

What design patterns did you have in mind? Nest is, in the end, another Node framework, so usually looking up things about Node will net you more results, and then you can reframe it to fit the Nest module approach

balmy aurora
#

extensible and modulare design patterns

#

i'll look for node specific

#

now

past dome
final quarry
#

Sorry to hop on this late, but I have some difficulties myself understanding how to properly structure my modules.

Maybe a silly question -- but if I notice that I am beginning to have several services in one module calling services within other modules, is that a good indication that perhaps they should all be consolidated under one module?