Unpacking the Latest Features of NestJS v10
Tags: javascript, nestjs, typescript
Published: 2023-07-25 07:32:24

---
title: Unpacking the Latest Features of NestJS v10
published: true
date: 2023-07-24 07:30:09 UTC
tags: javascript, nestjs, typescript
canonical_url: https://blog.amanpreet.dev/unpacking-the-latest-features-of-nestjs-v10
---

![Unpacking the Latest Features of NestJS v10](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vmsnfi5npp0d0w1iq0ct.png)

## Introduction

NestJS v10 is here! This progressive Node.js framework offers efficient, reliable, and scalable server-side app building.

As per the StackOverflow Developer survey, NestJS is one of the top 10 most popular backend frameworks in the world. Check the survey results [here](https://survey.stackoverflow.co/2023/).

It has more than 58k Github stars on its [repository](https://github.com/nestjs/nest).

## What's New?

Recently NestJS has officially released v10 for building efficient and enterprise-grade, server-side applications. Let's deep dive and see what are the new features of the new version.

### SWC Integration

SWC stands for Speedy Web Compiler. It is an extensible Rust-based platform that can be used for both compilation and bundling. To speed up your development process, using SWC with NestJs CLI is a great way.

Installation of required packages is as follows:

```
$ npm install --save-dev @swc/cli @swc/core

```

You can now use SWC with NestJs CLI as follows:

```
$ nest start -b swc
# or
$ nest start --builder swc

```

Another way to use SWC by default is via `nest-cli.json` file, as mentioned below:

```
{
    "compilerOptions": {
        "builder": "swc"
    }
}

```

By default, SWC does not perform any type-checking itself, so to enable this option we need to use `--type-check` flag, as mentioned below:

```
$ nest start -b swc --type-check
# or
$ nest start --builder swc --type-check

```

> 💡 SWC is approximately 20 times faster than the default TypeScript compiler.

### Redis Wildcard Subscriptions

Added support for Redis wildcard subscriptions. This feature allows one to subscribe to all messages that match a given pattern.

To start using Redis-based microservices, install the required packages as follows:

```
$ npm install ioredis

```

By default wildcard subscription is `false,` to enable the wildcard subscription

```
const app = await NestFactory.createMicroservice(AppModule, {
  transport: Transport.REDIS,
  options: {
    host: 'localhost',
    port: 6379,
    wildcard: true, // this is the new option available
  },
});

```

With wildcards enabled, we can use glob-type patterns in our subscriptions, such as:

- `ne?tjs` subscribes to `nestjs`, `nextjs` and `nuxtjs`

- `ne*tjs` subscribes to `netjs` and `neetjs`

## What's Improved or Changed?

Together with new changes, there are some improvements in the latest v10 of NestJS.

### Changes to Cache Module

Caching is a great and simple technique to improve your app's performance.

The `CacheModule` is now available as a standalone package `@nestjs/cache-manager`. Earlier this package was available under `@nestjs/common`

To install the required packages:

```
$ npm install @nestjs/cache-manager cache-manager

```

### Overriding Modules in tests

Overriding of modules in tests has been introduced in v10. This feature is useful when you want to mock the entire module all at once instead of mocking each provider individually.

### CLI Plugins and TypeScript >= 4.8

NestJS CLI plugins will now require TypeScript >= v4.8. This is due to breaking changes in TypeScript v4.8.

### Dropping Support for Node.js v12

Since Node.js v12 went _end of life (EOL)_, to use the new features of NestJS v10, a minimum version of Node.js v16 or higher is required.

This also allows the NestJS package to be compiled as ES2021 by default which results in a smaller library size and better performance.

## Migration Guidelines

To migrate your existing NestJS project to the latest version, follow the links available below:

[Migration from v9 to v10](https://docs.nestjs.com/migration-guide)

[Migration from v8 to v9](https://docs.nestjs.com/v9/migration-guide)

[Migration from v7 to v8](https://docs.nestjs.com/v8/migration-guide)

## Conclusion

NestJS v10 brings a lot of new exciting and improved features as compared to its older versions. If you are using NestJS in your projects please share it via comments.

I hope you have learned something new as I did. **If so, kindly like it or share it with others so they can also see it.**

## References

Below are some of the references which you can follow for more in-depth knowledge

[Redis Microservices](https://docs.nestjs.com/microservices/redis)

[SWC or Speedy Web Compiler](https://docs.nestjs.com/recipes/swc)