Five  conductive - and five innovative npm packages by Tobias Quante

Five conductive - and five innovative npm packages

Tobias Quante

Tobias Quante

The Node Package Manager (NPM), offers a variety of open source modules to extend your digital products. This article aims to present you a mixture of good - old utility modules, as well as some libraries which have rather exotic use cases.

Table of contents

You probably know those npm package mentioned in every other article, such as express, axios and nodemon . Each of them provides great ease of usage through their docs and offers a great developer experience. But so do others. The collection I'd like to share with you includes five useful packages for everyday development that just work, as well as five innovative ones that show a lot of promise and enhance your application with modern features.

1) Conductive and reliable

1.1) Formidable - a form-data parser

formidable
A node.js module for parsing form data, especially file uploads.

Node.js backends don't come with builtin form - or body parsers. If you'd like to implement a feature such as file uploading, you're either bound to write that code yourself or use a library that does the heavy lifting for you. And while multer provides a similar functionality at a smaller size, formidable, not being a middleware, can be used more dynamically in bigger backend applications.

1.2) Knex - an SQL query builder

knex
A batteries-included SQL query & schema builder for Postgres, MySQL and SQLite3 and the Browser

Writing SQL queries in Javascript can be puzzling, especially if you're used to document-oriented databases most of the time. Knex won't save you the effort to understand SQL syntax, but it will surely make your life easier by composing a query string out of several chained Javascript methods. It's  The package has a solid documentation, is easy to pick up and compatible with all major Node SQL drivers.

Consider this sample code to get an idea of how it works:

const customer_id = 101;

knex('customers')
  .where({ customer_id: id })
  .select('customer_name')

// -> Resolves to 
// SELECT customer_name FROM customers WHERE customer_id = 101;

1.3) Sharp - a performant image converter

sharp
High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images

Sharp uses libvips under the hood, an image library written in C that embraces async processing. If you have ever looked for a package that does image conversion in a nice and accurate manner, this package might be right for you.

A simple use case would be to put it before a module that handles an image database and automatically create several image sizes. Or just make sure your user's avatar remains at a reasonable size, in case they upload a 4k*4k behemoth.

1.4) Puppeteer - a headless Chromium browser

puppeteer
A high-level API to control headless Chrome over the DevTools Protocol

The package's function in a nutshell:

Most things that you can do manually in the browser can be done using Puppeteer!

It can be used only for automated form submission or taking screenshots, and just as well for automated tasks. If you're looking for an all-in-one solution, you might be after Puppeteer. It aids you with:

  • Automated form submission, to simulate end-to-end data transfer (or to cheat on your mobile office time report)
  • Taking screenshots from an article you enjoyed and would like to savekeep
  • Web scraping, if you're a data scientist or work in a data driven team*,
  • Performance tests, if you're after a good lighthouse score.

* Be sure to not cross legal borders. Read on here to learn about scraping the www

1.5) GSAP - a powerful animation toolkit

gsap
GSAP is a robust JavaScript toolset that turns developers into animation superheroes. Build high-performance animations that work in **every** major browser. Animate CSS, SVG, canvas, React, Vue, WebGL, colors, strings, motion paths, generic objects...any

I stumbled across this gem while studying to improve my Vue.js frontend skills. As somebody who's generally having a hard time to properly design UIs, I was flabbergasted what difference a few lines of GSAP powered code can do. It's performant and well documented. What really won me over is their cheatsheet and its backlinks though.

Note that you might have to buy a license to use this package for subscription based products

2) Innovative and shiny

2.1) Bent - a next-gen http - client

bent
Functional HTTP client for Node.js w/ async/await.

NPM's request and axios are still the most common and mature top-dog clients, but new challengers are emerging - one of which is the bent package. It consists out of less than 15% of the above packages' size, and embraces modern Javascript practices. As it's fully asynchronous, it only works in an async context.

(async function () {
  const bent = require("bent")
  const getJson = bent('json')
  const res = await getJson('https://jsonplaceholder.typicode.com/todos')
  console.log(res)
})()

2.2) Tessaract.js - an Optical Character Recognition Library

tesseract.js
Pure Javascript Multilingual OCR

While OCR is not the big deal it was a few years ago, the fact that it can be done from inside your browser still looks rather futuristic. If you're worried about synchronous code execution: The main library spawns a worker for each recognition process, making use of the non-blocking event loop magic. Possible appliances could be:

  • Fulltext search for one or more uploaded document files.
  • Text extraction for natural language processing.
  • A combination with navigator.mediaDevices - & a device's camera to extract words straight from notes on paper.

2.3) Storybook - a platform for your project components

Storybook: UI component explorer for frontend developers
Storybook is an open source tool for developing UI components in isolation for React, Vue, and Angular. It makes building stunning UIs organized and efficient.

If you're a React frontend engineer, it's likely you've at least heard of Storybook. It's less of a single npm package, but more of a tool to develop components in an isolated environment and thereby make them reusable. The Brave Browser Storybook illustrates the usefulness of this tool very well

2.4) Prisma - a toolkit for rapid ORM database development

prisma
Prisma is an open-source database toolkit. It includes a JavaScript/TypeScript ORM for Node.js, migrations and a modern GUI to view and edit the data in your database. You can use Prisma in new projects or add it to an existing one.

If you've seen Knex in the upper section and thought: No way I'll give up my NoSQL or GraphQL way or writing queries - this module means good news. Prisma uses its own .prisma filetype to declare its schemata. The way these can be used to query data looks a lot like the MongoDB's Mongoose. While being relatively big in size, it offers a bunch of useful interfaces and tools for fast prototyping, migration and development.

2.5) GramJS - a telegram client for you and your bots

telegram
NodeJS MTProto API Telegram client library,

Like OCR, chatbots are far away from being futuristic features restricted to a few tech geeks. Quite the opposite - messaging services such as telegram embrace them and even expose whole interfaces for you to work with. This library is not required to do so, but using it requires less boilerplace than writing all API methods from scratch.

The use cases here also are endless. One which I've liked was How I got a Nintendo Switch using NodeJS, where the author automatically got notified when the price of the console dropped on amazon.

What else?

There's plenty of other gems out there (like I stumbled across Vibrant the other day). And while you should be picky with what your projects depend on, including rather new and innovative packages could end up being that feature to peak out from the mass.

Share this article