Hi all.
I'm creating a REST application but we have opportunities for many standalone microservices that might exist within our environment.
One such microservice is one that connects to an external system over TCP, listens for messages, and loads data into our database. I have the service itself contained within a NestJS module, which OnModuleInit, initializes its connection to the external system. The external system is not NestJS...just some legacy TCP socket based application, so I'm not using any Nest abstractions here...just Node's net socket.
Right now, the service is just loaded as a module on our main application. But I'd like to decouple the running instance from our main application, both to ensure the stability of our main application and to reduce blocking. If we have bugs in our module, I'd rather not have it kill our main backend. And I'd rather it not contribute to reduced capacity of our main backend as well.
There is a very small bit of shared code...right now it's just a shared DatabaseModule. Maybe the ConfigModule down the road.
So the question is, what is the best way to deploy this. Nest hybrid app (does this start threads for individual microservices)? Completely separate Nest applications? Or is Nest simply not a good fit for this type of architecture and we're better off just creating small bespoke node applications?