Essential libraries for your Node.js project

Essential libraries for your Node.js project

Like many other developers, every time I start a new project some libraries pop up in my mind. Some of those libraries might not be needed right now, but the experience tells me that I’ll need them in the near future and I’ve learned that it’s better to complete a good enough set up and be prepared for growth instead of wait for the moment and have race against the time.

Today I’ll share of the libraries that are always in my set up.


Concurrently

Concurrently is basically a npm package that will allow you to run several commands in the same terminal. I often use it to start webpack and nodemon in a single command.

For a small project it’s easy to open a couple of new terminals and run the commands separately, but as your project becomes more complex, concurrently is a great addition to your team 😉


Mongoose

When someone talks about MongoDB and Node.js, I think about mongoose. These guys should be the only ones who use the MongoDB driver for Node.js… and that’s a big win for them.

Even if I don’t need a database connection right now, I’m totally convinced that I’ll need it in a short time, so it’s better to set it up.


Morgan

Morgan is a great helper for HTTP requests logging. I’ve got a lot of information out of it and really saves a lot of time for debugging at a glance: Know if a request was successful or not, the status, the time taken to complete, etc.

If you have used Heroku (and many other similar services), the output is similar to what you see in the Heroku logs.

It’s also configurable and can be included easily since it’s just a middleware.


Body-parser

If we talk about POST requests, body parser is the king. There is no much to say about this package, a lot of us use it and a lot of us forget to add it until we notice that req.body is undefined. Instead of that, just include it. Just 2 lines!


Eslint

I usually don’t work alone, but when I do, I still like to use a linter.

Code consistency is the kind of things that we should always care about. It’s not only about running the damn thing, but it’s also about doing it right.

Doesn’t matter the style guide of your preference, just make sure that your code is consistent enough so that other developers can join and help with that without being worried about how “ugly” the code is (at least in a matter of formatting).

In case you are working with a team, a linter also saves a lot of time for code reviews, merge conflicts, etc. But that’s material for another blog post.

I hope these libraries are helpful for you as they are for me. If you include any other library in your bootstrap please feel free to comment about it and share with the world 🙂

Regos Dev Studio is a product development company that builds add-ons for Jira, Confluence and LiveChat, combined with development of custom solutions in a variety of languages.

Don’t forget to check out our website, visit our Atlassian marketplace listing and our apps for LiveChat. You can also follow us on Twitter and stay tuned for updates!

Leave a Reply

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