Angular for back-ends

Goodies inside Nest

A lot to learn?

Gorrion approves.

Nest combines what’s best in more sophisticated and more accessible solutions. It’s so simple that you can learn it in less than an afternoon.

You don’t always have to look really far to find great things. Sometimes the good stuff is laying right in front of us. This applies to my latest discovery which is a Node.js platform build here, in Gorrion’s hometown – Gliwice.
Today I’d like to present you Nest framework. Build on top of express, Nest combines what’s best in more mature and more popular solutions. Squeezing most of its juice from what Google did in Angular, it’s so familiar and simple that you can learn it in less than an afternoon.

Angular for back-ends

Nest is 100% TypeScript focused. If you’re into strongly-typed OOP programming, then you’d like how it makes use of all the mechanisms it gives. Getting TypeScript configured out of the box is a great boost for productivity. It also makes your code more reliable and easier to maintain.
Strong-typing is not even close to where Nest’s romance with Angular ends. Built-in dependency injection is what I love in the new release of Google’s front-end platform. Guess what? It’s available here too. It works almost exactly like in Angular. It can be either used straight forward or allow to manually define how specific object should be created and then provided.
Modularity is another feature we loved in Angular. In Nest, you can precisely define, which parts of your code belong to which module and then share them by explicitly exporting module members. Simple.
Heavy use of annotations is just another thing that will make Angular developers feel like home.

Goodies inside Nest

As many of modern frameworks Nest incorporates socket.io to provide a real-time web. It gives developers consistent with its core functionality interface that allows to build apps and can communicate with hooked clients via web sockets.
Microservice part of Nest was something new for me. Like Microsoft’s WCF it puts an abstraction over communication in SOA apps. It is a solid foundation for message exchange between applications distributed in microservice manner using not HTTP, but other transport methods. Out of the box, we get direct TCP communication. We can also make use of Redis publish/subscribe feature.
Other features that Nest is packed with are express-like middleware functions, guards for routes access control, pipes for generic request processing and validation and interceptors that are Nest’s AOP implementation.
Nest supports both unit and end to end testing. It provides additional tools to unleash the full potential of included dependency injection.

A lot to learn?

Surprisingly, this framework is very well-documented. Full API reference, mechanisms overview with separation for basic and more advanced subjects cookbook with recipes for most popular problems, is an impressive amount of knowledge. Easy to read, full of code examples and additional notes. You can really feel that this is a mature product. The author understands that to be successful, he needs to put developers first and allow them to use it with ease.
It took me just one of my son’s mid-day naps to build a simple web API with it, using most of the basic mechanisms. A simple proof of concept, testing if module-based architecture and dependency injection works as expected. It was very pleasurable. Knowing Angular, I knew exactly how to use all Nest’s features and build the test app.

Gorrion approves.

It might sound stupid, but knowing that framework so good came to life so close to us, even in the age of global communication makes me feel a little proud. It’s nothing new that Polish developers are the world’s best, but still…
We’ve already started using Nest in one of our projects, so you can be sure that there will be more to it in Gorrion. So far it is great, fingers crossed that it’ll prove itself with application growth – I believe it will.

color-orb
color-orb

Other worthy reads