Best Essential Packages for Nodejs Application Development

Jessica Williams
2 min readAug 2, 2017

--

We have been developing many nodejs web applications and thought to share packages we found to be part of most of nodejs applications.

Express framework

Express is framework for nodejs which is allowed to set up middlewares and define routing to handle HTTP request. It has great support and a bunch of helpful features.

$ npm install express --save

Express-session

This package is useful for managing session in nodejs. By default session data store in RAM but we can store in database like radis, MongoDB etc.

$ npm install express-session --save

Connect- redis

If session data store in ram in production, it will give an error like “Warning: connection.session() MemoryStore is not designed for a production environment, as it will leak memory, and will not scale past a single process.

In order to save session data into the database, we need to use packages. We recommend to store session data into radis DB and for that, you need to use Connect-redis package to connect redis db with express session.

$ npm install connect-redis --save

Path

The path module is essential for working with file and directory paths. You can do path manipulation easily using helper functions. Eg: To find file path exist or not, join path, file basename etc. with this package.

$ npm install path --save

Body-parser

Body-parser is an express middleware that extracts incoming request stream and stores it as a javascript object and exposes it on `req.body`.

$ npm install body-parser --save

Express-validator

Express-validation helps to validate rules in body, params, cookies, header and query for requests and give a response with errors in case of validation failure.

$ npm install express-validator --save

Nodemailer

We recommend using nodemailer for sending emails in nodejs application. It works with SMTP and Sendmail as well as it’s Unicode friendly.

$ npm install nodemailer --save

Mongo-morgan

It is useful to add activity logs like request URL, request method, request parameters, request IP in MongoDB.

$ npm install mongo-morgan --save

Winston

It is useful for adding debug and uncatch exceptional error logs into a file. It supports multiple transports.

$ npm install winston--save

Winston-MongoDB

This module helps to add log error or other types of activity in MongoDB.

$ npm install winston-mongodb --save

source by

--

--

Jessica Williams

Jessica Williams lives in California, USA. She is a software engineer| Freelancer| Remote Worker | Technical Content Writer