10 awesome packages for JavaScript/TypeScript projects

Often, early career developers have difficult to find good packages they can use.

Belmiro
5 min readMar 18, 2023

1. Axios

Almost all projects require you to make HTTP requests. This is usually necessary when you need to consume backend endpoints or some other service.

Axios, in my opinion, is the best choice. Making a request is extremely simple and intuitive with this package, check it out:

const response = await axios.get('/your-endpoint');

This simple snippet above, through a single call, returns a Promise with the result of the request.

With this package, it is possible to make requests with all verbs (GET, POST, PUT, DELETE and PATCH) by changing only the name of the method called.

In addition, there are several other features for working with headers, handling errors, params, intercepting requests and other features that you can check in the documentation.

2. Luxon

Working with dates and times in JavaScript is a tough for any developer. The native API provided is not the best.

So, for working with dates and times, Luxon is an essential package that will provide you with a very comprehensive API and nice documentation to handle all the mess you want with dates, times, timezones, etc.

Most developers know moment, but few know that moment is a deprecated package. So keep in mind Luxon for your next project.

Another good one is the date-fns.

3. Lodash

To be honest, Lodash is a package that is hard to explain succinctly what it does.

Lodash is a package that provides you with a series of utility methods to work with arrays, functions, objects, numbers, strings and of other things. Seriously, there is a lot of stuff!

You can check it out better in the documentation. Trust me, you will be amazed at the number of utility features.

4. Big.js

It may not seem like it, but sometimes working with numbers in JavaScript can be a tricky, especially due to precision.

A great example is working with currency. Sometimes it is really frustrating. For this, we have this great package that provides you with an easy API to work with numbers with precision.

Basically, you will create Big instances that represent numbers and you can perform various math calculations with precision from them.

The documentation is pretty straightforward.

5. Jest

Any good project needs to have good tests that ensure the reliability of the code. We must keep in mind that this is extremely important in a project.

Jest is a package that provides you with a framework so that you can implement JavaScript and TypeScript tests in a simple and fast way. You will not need to set up anything complicated. It’s super easy to get started.

It is framework built to serve you in a simple and smooth way. The documentation is very comprehensive and didactic.

6. Cron

This package is so simple and useful… Cron is basically a tool that allows you to run a piece of code, a routine or something according to a schedule.

A simple example: Every day, at 1 a.m. you want to run a routine that sends an email to all users who have not yet confirmed their account.

The examples are countless and the possibilities are endless, anything you need to schedule to run, you will use Cron to trigger the process.

The documentation is on NPM itself.

To set the parameters such as frequency, day, time, etc., you will need to write an expression that may seem strange at first glace. For that, I recommend using a tool. There are many on the internet, by searching for “cron expression generator” on Google, you will find several. I recommend Free Formatter.

7. Validator

To put it simply: a package that provides you with a library of various validators and sanitizers for text.

Need to validate an email?

validator.isEmail('your-email@email.com'); //=> True
validator.isEmail('this-is-not-an-email.com'); //=> False

There is nothing simpler than that. Email validation was just an example. You can check out all the possibilities available in the documentation on NPM.

8. Yup

Yup is a package that provides a way to create JavaScript and TypeScrippt schemas for validation and parsing.

The API provided by the package is quite comprehensive and allows you to create data shapes as needed.

The documentation is available on NPM with good content and examples.

Yup is slightly more for the client and an alternative is Joi, which serves the same purpose. In fact, Yup is inspired by Joi.

9. Faker

As the name itself suggests, it is a package that allows you to create fake — but realistic — data.

This is extremely useful in testing and development. Imagine you are creating automated end-to-end tests and need to fill out a register form for a new user with data that simulates real life.

const username = faker.internet.userName();
const email = faker.internet.email();
const password = faker.internet.password();

There you go, you already have realistic data to use in your test.

And there is a big amount of fake data available that can be checked and used following the documentation. There are data about addresses, finances, music, animals, nouns, images, vehicles, etc. It’ is not possible to list them all here.

Fun fact about this package: Initially, the author of this library sabotaged the package and repository (which no longer exists) in protest in 2022. It was restored and the community has been maintaining it.

10. Socket IO & Socket IO Client

You see two packages but they serve a common purpose.

Socket IO is a wonderful tool that allows you to build true event-based communication. And best of all, it’s all in real-time.

For this, two packages will be necessary. Socket IO will be used on the server side being responsible for controlling all communication. The Socket IO Client will be required on the client side to receive and send events.

These packages will allow you to build features for chats, games, notifications, live updates and everything that requires active and real-time communication.

It’s beautiful and the possibilities are endless.

Did Like it? Go ahead and check out more in the documentation.

The end

I hope that at least one package listed was new to you. Use it in the best possible way.

If you’ve enjoyed, consider buying me a coffee as a token of appreciation.

Thank you!

--

--