r/node•
razvanzz

Abstraction framework for microservice architecture

Currently working on a large project with the backend as a big Nodejs monolith, I'm examining evolving into a service architecture, following the principles of microservice architecture. It was planned that the application will scale by running multiple server instances, but complexity is driving towards this distributed design.

As I see it now, the inter-service communication will need to be handled over a message queue.

I played around with senecajs, but it's documentation is disappointing, maintenance is slow, and the overall quality seems questionable after diving into the source code.

Do you have any experiences with it? Should I use it or there is a better module I haven't heard of?

Posted Aug 1, 2015, 6:29 PM UTC

06
inxilpro•

Seneca seems like it's based on a great idea, but I agree that the documentation is not so great and it feels a little bloated (why does a microservices framework have an ORM built in?). That said, I haven't found a Node.js SOA framework that I like, so I'm in the same boat as you…

1
hlfshell•

The ORM bit makes sense, as it allows you to give each microservice the ability to pick the DB it needs to best run (or whatever the building/mainteance team feels like using) but simultaneously provides a standardized way to access the data. I can understand where it can be frustrating to use, but I think this is the rationale behind it.

1
hlfshell•

I ended up rolling my own microservice gateway at work, but we have unique needs that most people won't have, AND I took it as a learning project. It seems that senecajs is developers' go-to microservice framework, but I haven't used it heavily enough to comment.

What I built for our needs was an express microservice (called the API microservice) which exposed an accept-all-routes express service. Other than administration routes, hitting the API would first authenticate via json web tokens in the request header and, assuming it authenticated, would stream the request through to the actual http microservice. This way we could build a singular endpoint that would provide controllable public access to all the other microservices.

1
razvanzzOP•

That sounds a lot like a proxy server. I assume your services perform the complete operation for the routes they expose. In my case, the operation is expensive, therefore I want to split the logic over multiple microservices. Do you use HTTP for inter-service communication?

1
hlfshell•

I do, but again, use case specific. We don't have many if any time or cpu intensive operations - just a lot of small, random things we need to incorporate across hundreds of projects. Therefore a collection of pre-done HTTP micro services really help us out.

Yeah, the api microservice is very much an authenticated standardized automatic proxy server.

1
kostarelo•

Currently, our micro services infrastructure consists of 6 micro services projects (Express.js APIs with only one talking to a DB). Each service knows about every other service's urls so they are able to talk to them.

It goes really well for our team, so I would suggest you not worrying so much about the intercommunication.

I've haven't used seneca either.

1