Javascript

Build modern & scalable Node.js web applications with Nest

26 lutego 2017

JavaScript is awesome. Node.js gave us a possibility to use this language also on the server side. There are a lot of amazing libraries, helpers and tools on this platform, but non of them do not solve the main problem – the architecture. This is why I decided to create Nest framework.

Why Nest?

Nest is a powerful web framework for Node.js, which allows you to easily build efficient, scalable applications. It uses modern JavaScript, is built with TypeScript and bring best concepts to JavaScript back-end world such as Dependency Injection.

It is not just another framework. You do not have to wait on large community, because Nest is built with awesome, popular well-known libraries – Express and socket.io! It means, that you could quickly start using framework with no worries about a third party plugins.

Modular

With Nest you can naturally split your code into separated and reusable modules. Nest Module is a class with @Module() decorator. This decorator provides metadata, which framework uses to organize application structure.

By default, modules encapsulate each dependency. Read more about modules here.

Components as a building blocks

Almost everything is a component – Service, Repository, Provider etc. and they might be injected to controllers or to another component by constructor (as in Angular). Component is a plain class with @Component() decorator.

Testing

Nest gives you a set of test utilities, which boost application testing process. There are two different approaches to test your components and controllers – isolated tests or with dedicated Nest test utilities.

Those Test Utilities are placed in static Test class (nest.js/testing module). This class provide two methods:

createTestingModule(metadata: ModuleMetadata), which receives as an parameter simple module metadata. This method creates a Test Module (the same as in real Nest Application) and stores it in memory.

get<T>(metatype: Metatype<T>), which returns instance of chosen (metatype passed as parameter) controller / component (or null if it is not a part of module).

Middlewares, error handling and more…

There are plenty of another awesome Nest features. You can read about them in Documentation & Overview. If you are looking for starter repos and more specific details about Nest, take a look at GitHub repository. Let’s bring modern concepts to Node.js together!