A Backend That Feels Like Angular

If you are reading this, there is a good chance you already know Angular — and probably enjoy working with it. What makes Angular so appealing?

The framework ships with a wealth of well-crafted, ready-to-use solutions. Dependency injection, testing utilities, a powerful CLI, and much more come bundled out of the box.

Angular also embodies proven best practices. It weaves together established design patterns and applies them to everyday programming challenges. When these patterns are used properly, building large, maintainable systems becomes noticeably simpler. The real strength, however, lies in the abstraction Angular offers. This abstraction helps keep code organized and split into coherent, logical modules.

Many of these same principles are not confined to frontend development. They translate remarkably well to the server side as well.

Introducing NestJS

Nest, much like Angular, is a platform in its own right. The difference is that it targets server-side application development. Nest draws heavy inspiration from Angular, and that kinship pays off for developers who work with both.

The first benefit is knowledge reuse. Nest follows nearly the same set of conventions as Angular, so there is little need to start over. Modular architecture, dependency injection, clear separation of concerns, decorators, and TypeScript as the core language — all of these are present in Nest.

Second, there is the reuse of experience. Many APIs in Nest are almost identical to what Angular developers already know. There is no need to learn a new API surface, memorize new keywords, or get used to different syntax.

Finally, beyond developer comfort, there is code reuse. DTOs, interfaces, and even services — including base forms of interceptors and guards — can be shared between the frontend and backend.

The synergy between Angular and NestJS has not gone unnoticed. Our colleagues at Nrwl have also embraced it, which is why the Nest + Angular full-stack setup is one of the default options when scaffolding a monorepo with Nx.

What does the creator of Nest have to say about all this? Let us take a look.

Kamil Myśliwiec o NestJS

A Brief History

The concept is compelling, but are you still hesitant? Is NestJS really mature enough to stand next to Angular?

Here is what we know about NestJS:

Development started in November 2016. The first official release followed in May 2017, exactly a year after Angular 2 hit the scene.

At the time of writing, NestJS is at version 8, while Angular is on version 12.

NestJS was created by Kamil Myśliwiec, who holds the title of Google Developer Expert and co-founded the Trilon organization.

Kamil still steers the development of the core modules. A large community of contributors supports him, and those who go above and beyond form the “Core Team”.

Like Angular, Nest is split into a number of separate packages. The foundational ones are similarly named @nestjs/core and @nestjs/common. Beyond those, the platform covers a wide range of needs — there are dedicated libraries for GraphQL, microservices, Swagger, configuration, CQRS, and even server-side rendering for Angular.

Popularity and Growth

Nest arrived in 2017. By 2018, its GitHub star count had grown by 300%.

NestJS – Angular style backend framework — figure 2

In 2019, it had not yet made the predefined list of backend frameworks on State of JS, but it outshone every manually entered competitor.

NestJS – Angular style backend framework — figure 3

NestJS – Angular style backend framework — figure 4

By the time the 2020 statistics were collected, more data was available — for instance, 87% of users reported being satisfied with NestJS.

Importantly, interest in the framework is far from plateauing. It continues to climb steadily.

NestJS – Angular style backend framework — figure 5

The rising popularity of Nest is also visible in the analysis prepared by statisticsanddata.org.

NestJS – Angular style backend framework — figure 6

Moreover, a growing list of companies — Adidas, Decathlon, and many others — openly use NestJS in production. You can follow this on the official documentation site as well as in a dedicated GitHub issue.

Final Thoughts

NestJS is a framework built on solid architectural principles, and it borrows a great deal from Angular. For anyone familiar with Angular, it is likely the fastest route to writing your own backend. Nest already boasts a substantial community and a roster of companies relying on it, and its momentum shows no signs of slowing. For Angular developers aiming to build server-side applications, this is arguably the strongest option available.