5 npm modules you can't live without?
Discussion started by someone anonymous
What are some of the most common node modules that you use in every single project of yours? Name the top 5!
Let's make it fun, add some descriptions and leave links to the npm modules. :)
Learn Something New Everyday,
Connect With The Best Developers!
Nice question! Here are my favorite ones:
- pm2 : To deploy every Node.js project.
- node_redis: Every project of mine deals with sessions and I store my session data in Redis.
- body-parser: Super useful. Helps me parse JSON, form data and so on easily
- Mongoose: Most of my projects use MongoDB. So, mongoose is the library that I go with.
- async: Super handy!
I don't really have "favorites" but here are 5 I frequently use for different projects:
create-react-app: This allows you to set up a modern React app by running one command and installing one dependency, it then under the hood installs Webpack, Babel, ESLint, and other amazing projects to power your app thereby letting you focus on code, not build tools.
nodemon: Helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected.
Pingmydyno: With Heroku free dynos, your app will fall asleep if it doesn't receive any web traffic within a 30-minute window. Pingmydyno pings your server periodically so it never falls asleep.
Axios: A Promise based HTTP client for the browser and node.js that allows you to make XMLHttpRequests from the browser, make http requests from node.js, transform request and lots more
HandleBars: An extension to the Mustache templating language that provides the power necessary to let you build semantic templates effectively with no frustration.
While these are more than 5 libraries, I don't really have any "favorites" globally. I have libraries I use for certain problems, and inside these fields, I have preferences. Nothing too surprising, though, I guess.
- All the TypeScript libraries (typescript, tslib, ts-loaders, type-files, etc.) and ts-node (for quickly running without transpiling)! I stopped writing libs and apps in JS entirely, because I love types, and I love declaring and consuming water-proof contracts. The first thing I do when I set up a new NodeJS or browser project is add TypeScript support.
- A bundler. I tested out WebPack, Rollup, Parcel and WebPack, and that's where I went back to in the end. Sure, it's a lot of work to set up, however it is far easier to handle complex needs and requirements later in the project than what the others offer. Ever tried to write web-components with support for handlebars, scss and typescript with Parcel? It's a nightmare. JAMStack? Don't even...
- What would be code without test? Mocha, and by extension ESLint for static code checks, Chai for assertions and Istanbul for coverage, are my favorites for this tedious task. They also work very well with my IDE, so I can even get in-line coverage and test info and tooling.
- From my Rust-development, I cannot but feel the need for monads sometimes. So, I usually also pull in an appropriate package.
- This might be more of a NodeJS thing, however when not in the browser, I usually require advanced file-system tools, which I can cover with fs-extra and glob.
- Since I did one for NodeJS, let me also add pug, handlebars and sass for the browser. No, I don't regularly React and I don't even Angular - though I really should give them more love, probably.
I work on React Native mostly so here are my most used npm modules.
- ESLint: Makes code pretty
- react-native-vector-icons: Makes app pretty
- react-navigation: Navigation solution
- redux/mobx: State management, I prefer mobx for side projects.
- lodash: Sometimes needed.
For me the basic bundlers are the core requirement of every day work; rest is with WebComponents, and by design, this should not need too much support from other packages. Here are my all time needed packages
These would be used almost all the time, no matter what changes for the project.
webpack : with this entry I mean to have a bundler, I liked parcel a lot as well, though never used in a mainstream project. Someday I will make a full use of parcel and give webpack some rest ;)
babel : well it is pretty clear about why any JS project will use this and supporting packages. Though it is not the only player. with very few changes, TypeScript is a good replacement; maybe someday, not today.
eslint : nothing to add here, and no intentions to replace this. There might be alternatives; I would prefer to just know one tool to do this job and bother less about linting.
jest : a good test environment; very few people will disagree but that is a use case based opinion, my opinion as well. Let's see if I would need to change it.
postcss : This is to preprocess the css; and in my efforts to move away from LESS and SCSS, this is the best available tool. Nothing against LESS or SASS/SCSS, I would just get rid of system bindings for CSS preprocessing .