DEV Community

Ben Halpern
Ben Halpern

Posted on

What are some useful npm packages I might not know about?

I'm getting back into that JavaScript life and I'd love some suggestions about some libs I might want to check out. If you're an author of something, please feel free to pitch me. 😄

Discussion (59)

Collapse
hemanth profile image
hemanth.hm

Over the years I have been trying to collect such modules which are not in the like light but very useful, check them out -> nmotw.in

P.S: Shameless plug: I run a weekly mailer of the same, feel free to subscribe. 🤗

Collapse
gonzofish profile image
Matt Fehskens

Just wanted to say that that is a pretty cool list you're maintaining!

Collapse
0x64796c616e profile image
dylan

My company recently started using ramda. I don't know much about Haskell, but Ramda basically seems to bring all the functions from Haskell over, and encourages a functional approach to programming. It took me 2 days to really wrap my head around it, but I'm glad I did; it is sooooo cool. It'll beat you down the first few days you use it if you've never programmed functionally, and unfortunately there's not as many examples to follow when you Google stuff for it, but the docs are great and the community looks very helpful.

After I got the hang of it... I'm having so much fun.

Collapse
ben profile image
Ben Halpern Author

Yeah, I've used ramda and I like it.

Collapse
rapasoft profile image
Pavol Rajzak

This might not be the best "back to the JavaScript" package, but it might be interesting for people working with eslint

lint-filter

The best scenario to use this is when you have a large project and you decide to introduce new ESLint rule and you only want to apply it on the new code, not change everything at once.

Collapse
pradeep_io profile image
Pradeep Sharma

If you face "forgot password" problem too often and do not trust online password managers. Use this:

Chaabi: A dead simple CLI tool to encrypt text "locally"

producthunt.com/posts/chaabi
npmjs.com/package/chaabi

P.S.: I am the creator of the package

Collapse
letsbsocial1 profile image
Maria Campbell

webpack. babel (you don't just use one babel package, there are many in tandem).

Collapse
johnpaulada profile image
John Paul Ada

I haven't tried it but npx sounds cool! It can run your npm package binaries on the command-line!
Here are some good resources for npx. :smile:

Collapse
eduplessis profile image
Edouard Duplessis

npx is now ship with the latest version of npm medium.com/@maybekatz/introducing-...

Collapse
nitishdayal profile image
Nitish Dayal

NPX makes me happy. NPX + terminal aliases = Very rare need to globally install a package.

Collapse
michael profile image
Michael Lee 🍕

Emojic! Cause you know...emoji is life.

Collapse
aghost7 profile image
Jonathan Boudreau
  • supertest for writing api tests.
  • power-assert which a major improvement over the builtin assert but without the complexity of a library like chai.
  • lerna for creating monorepo projects.
Collapse
clickclickonsal profile image
Sal Hernandez • Edited

eslint - For your all your JavaScript linting needs
prettier - Code Formatter to enforce coding style consitency in your project
redux - If you're using react
redux-saga - for handling your async operations in redux

yarn > npm because npm 5 has been buggy for me & a lot of other people as well. Yarn never gives me any issues & it's so much faster. :-)

Collapse
krissiegel profile image
Kris Siegel

I heard the msngr.js package is an awesome messaging library that helps with decoupling code. Some amazing person, who I don't know at all what so ever, put it together.

github.com/KrisSiegel/msngr.js

Collapse
ben profile image
Ben Halpern Author

😄

Collapse
skeeveholt profile image
davis davis

+1 for Prettier
Chart.js for simple HTML5 charts when D3 seems like overkill

Also I recently stumbled on javascripting.com - fun resource for geeking out on new libs, packages and tools

Collapse
damcosset profile image
Damien Cosset • Edited

I've been using husky lately. Make things like pre-commit and pre-push pretty easy. Quite nice to automate those things.

Package here

Collapse
ben profile image
Ben Halpern Author

This looks interesting, but I'm not 100% sure I follow follow what it does based on the readme. Can you explain this like I'm five?

Collapse
damcosset profile image
Damien Cosset

It runs commands of your choice at specific times. For example, if you wanted to run your linter right before your commit and your test suite right before you push, you would add in your package.json something like this:


"scripts": {
   "precommit": "npm run lint",
   "prepush": "npm run test",
   "lint": // your linter command,
   "test": // your test command
}

If your linter fails, your commit fails. If your test suite fails, your push fails ( in this example ). You can use any git hooks you wish.

Thread Thread
ben profile image
Ben Halpern Author

And it can run other commands, not just npm environment-related ones?

Thread Thread
damcosset profile image
Damien Cosset

That's a good question. I actually never tried. I suppose whatever you can run inside package.json can be used with husky. Here is a list of hooks supported if you are interested by that

Thread Thread
rhymes profile image
rhymes • Edited

Yeah it does, just did a quick test:


$ git diff package.json
+    "precommit": "rails test"
$ git commit -am "Added precommit hook to run rails tests"                                                             
  husky > npm run -s precommit (node v8.6.0)

Not going to keep rails test before each commit obviously but we now know it works :D

Thread Thread
damcosset profile image
Damien Cosset

Very cool! Thank you!

Thread Thread
niketpathak89 profile image
Niket Pathak

Husky does really facilitate creating git hooks. I prefer linting the code before committing, so for those who want to lint on precommit git hook digitalfortress.tech/tricks/lint-o...

Collapse
nickytonline profile image
Nick Taylor (he/him)

You can run anything. lint-staged compliments this package very well. Here's an example, github.com/nickytonline/generator-...

Thread Thread
nickytonline profile image
Nick Taylor (he/him) • Edited

Only one gotcha. If you've already installed the husky package at least once, you will need to run yarn --force or npm install --no-cache. For some reason the post-install script of husky does not run, when the package is pulled from yarn's or npm's cache.

Collapse
defman profile image
Sergey Kislyakov 🇷🇺 🇺🇸

pnpm. It's like npm but on steroids.
The author of this handy project is on dev.to as well: @zkochan

Collapse
zkochan profile image
Zoltan Kochan

Thanks for mentioning!

Collapse
ahmedtarek_32 profile image
Ahmed Tarek

If you are going to try building a command line application with node here are some packages to consider:

  • download Downloading any file from its link, useful if are fetching data and going to download images or something

  • commander A framework for cli apps, making options and such

  • chalk A library that lets you output colored text on the terminal

  • inquirer Lets you ask the user questions, useful for creating interactive applications

  • shelljs Run any terminal command from your javascript file

Also if you are starting new projects, you might want to check my project, Initior. It will make initializing your new projects really fast and convenient <3

Collapse
danieljsummers profile image
Daniel J. Summers

pm2 for running your Node applications (or anything else) in production. I used to use forever, but pm2 actually persists across reboots, assuming you set it up to start.

I'm still learning with it, but I like what I've learned so far!

Collapse
developius profile image
Finnian Anderson • Edited

PM2 is super awesome, especially the integration with keymetrics.io

Collapse
zeropaper profile image
Valentin Vago

My discoveries in the last months:

  • npm-run-all to run npm scripts in parallel or sequence (and get rid of task runners like grunt or gulp).
  • Webdriver.io for my E2E tests
  • neutrino is some kind of wrapper around Webpack and is really worth having a look at.
Collapse
letsbsocial1 profile image
Maria Campbell

You can also get rid of task runners by using only webpack along with its loaders and plugins. With webpack 2 and beyond, the webpack team's goal has been to do just that. Be the alternative to task runners like Gulp and Grunt. Especially when working with libraries like React for example.

Collapse
coreh profile image
Marco Buono • Edited

patch-package is really helpful if you need to apply a hotfix to a package but don't have time to wait until it's merged upstream (or don't want the hassle of using git repo URLs in package.json to point to your fork)

Collapse
ben profile image
Ben Halpern Author

Looks nice

Collapse
nikhil17_namal profile image
Nikhil N Namal

I wrote this simple npm package called "popular-movie-quotes". A simple NPM package to get popular movie quotes with zero dependencies. Maybe this can help you with a movie-themed side project.

npmjs.com/package/popular-movie-qu...

Collapse
nickytonline profile image
Nick Taylor (he/him)

I haven't tried these yet, but Jason Miller's packages for moving things to web workers look very interesting.

  • workerize: Moves a module into a Web Worker, automatically reflecting exported functions as asynchronous proxies.
  • greenlet: Move an async function into its own thread.
Collapse
bahmutov profile image
Gleb Bahmutov

plus there are more NPM libs I wrote at glebbahmutov.com/

Collapse
bonzzy profile image
Tomislav Fabeta

I was using postman for api documentation for a bit and couldn't find any nice free way to turn its json documentation to nice website api documentation. So i created docmaster. It parses json file from postman export and uses apidoc to turn it into nice web api documentation.

Collapse
vinicius0026 profile image
Vinicius Teixeira

npm check updates is great for keeping your dependencies updated.

Collapse
edm00se profile image
Eric McCormick

A lot of the more interesting node packages I use are apparently cli based. Here are a few I find to be pretty interesting:

Collapse
coreybutler profile image
Corey Butler • Edited

Here's my completely biased list (yes, I wrote them all):

Background Daemons/Services:

porthog identifies which application is using a specified port, providing the process name and PID. Works for Windows, OSX, and most flavors of Unix that support the lsof operation.

shortbus is basically an awesome task runner capable of executing processing queues, running them sequentially or simultaneously, and modifying the queue dynamically. Kinda like promises, but more dynamic.

localenvironment is a simple way to define lots of environment variables using an env.json file.

musthave provides a simple and standard way of checking for object attributes. The inspiration for this project was checking for the existence of environment variables.

And of course, nvm for Windows if you happen to be a Windows user. (I know, not really a module).

Collapse
artak_vardanyan profile image
Artak Vardanyan • Edited

A zeronode - its a minimal block for creating microservices. It's manages reconnecting, message queueing, has request/reply and tick (fire and forget) and lots of other goodness in the box
npmjs.com/package/zeronode

Collapse
nicholaiii profile image
Nicholai Nissen

xo Zero (or low) config eslint wrapper. Enforces good code style instantly.
ava IMHO the best test runner. Runs tests in parallel.

Collapse
adam_baldwin profile image
Adam Baldwin

There are a few Node Security tools that might come in handy.

The first is our lesser known eslint security rules - Useful for finding some security issues in code. Better for spot checks than running all the time like a normal linter due to false positives for many of the rules.

Second is nsp which you can use to check for known vulnerabilities in dependencies. Shameless plug if you want continuous monitoring vs spot checking with a cli tool, sign up at nodesecurity.io (free for open source)

Collapse
ameliadvp profile image
amelia@codacy.com

Hey Adam!

I was wondering if you can also help me with this: ESLint has hundreds (maybe even thousands) of plugins and I wanted to understand for security specifically, can you recommend any (besides the ones in OWASP Top 10, or these below:

What other plugins are there for security? Which are the best/most popular? Thank you so much!

Collapse
maruru profile image
Marco Alka • Edited

Result-js and ROption, which introduce our favorite Rust types to JS :D

Collapse
mordzuber profile image
Mordechai Zuber

npmjs.com/package/npm-watch is a nice little tool I maintain, useful if you invest in scripts in your package.json
there are some bugs, but they are also being worked on

Collapse
aswathm78 profile image
Aswath KNM

a distributed file sharing and web hosting method
datproject.org/
Much better than current p2p technology.
its available as npm package
npmjs.com/package/dat

Collapse
jimschubert profile image
Jim Schubert • Edited

npmjs.com/package/json-server

Creates a pretty full featured REST API from a JSON file of data. Great for spinning up a fake backend quickly.

Not my package. ;)

Collapse
levahim profile image
Lev Himmelfarb

If you are writing a Node.js backend that works with a SQL database, check out x2node collection of modules (see x2node.com).

Collapse
askucher profile image
Andrey • Edited

did you try nixar (askucher.github.io/nixarweb/#/)? :)

Collapse
thebhaskara profile image
Bhaskara Rama Sai Busam

Please try pakkajs, It is a Simple and Small DOM library that I wrote.

Collapse
ycmjason profile image
Jason Yu
Collapse
rbanffy profile image
Ricardo Bánffy • Edited

For naming servers, projects or things, npmjs.com/package/nsaname

(disclaimer - I built it, and no, it's not really useful)

Collapse
nitishdayal profile image
Nitish Dayal

I'm sure most people are familiar with it at this point, but Tiny Care Terminal still makes me happy. github.com/notwaldorf/tiny-care-te...

Collapse
sheershoff profile image
Ilya Sheershoff

pm2 is great, indeed. do you use pmx with pm2?

Collapse
bigshai profile image
bigShai

extendify is a helpful tool to extend jsons in a deep way. simple and powerful.