NodeJs + Microservices = ImaUp

Every company has, usually, a single service to handle images that allows people to get easy access to them. Microservices aren’t a new thing, but now it’s an hot topic (although I won’t discuss about the advantages of using microservices in this post, I think this is a must read.) – and that’s why I have decided to create a microservice to store images into the file system, and called it ImaUp.

This service is a simple API that supports image upload and detects duplicated images by calculating the image hash, and saves them into the file system.

You can create microservices in any language, and use the most efficient one to deal with the problem. I have chosen Javascript because I’m familiarized with it and it’s a good choice when dealing with I/O operations.

Here’s a set of tools that I have used to make my job easier:

Gulp for running my tasks, it’s my favourite one and I won’t argue the pro/cons against grunt or other.

Babel because it’s the most mature transpiler and supports almost 100% of ES6.

Standard it’s very useful because forces all team members to use the same code style. Some people think that code style is personal but I disagree: standardize it turns the code more readable and makes life easier for the next guy who will work on it.

Frameworks

For me, HapiJs is the best framework to create Api’s in node. Why? Because is easy to learn, separates the logic from the framework, it’s easy to test using Lab and it’s plugable! There are a lot of plugins that can make our life easier: swagger, authentication, logging, etc…

I chose Mongoose to manage the operations to MongoDb, because it’s easy, stable and supports native promises.

You can check the code on my GitHub

Check other posts about nodejs.

I'm a Software Engineer that believes software must be simple, intuitive and reliable. My main interests are api’s design, best software practices, distributed systems and continuous integration.

Your email address will not be published. Required fields are marked *

2 thoughts on “NodeJs + Microservices = ImaUp”

    How is this a microservice and not just a service?

    Marco Talento says:

    That is a good and tricky question!

    The main concept of “Microservice architecture” is to have multiple microservices to decouple the complexity of the applications.

    In this scenario I have considered ImaUp a microservice because has all the requirements to be part of an Microservice architecture. Why? Because it only has a single responsibility and you can reuse it in every application, it’s not bounded.

    Thanks for your comment, I hope you’ve liked.