Introduction to Nest.js — A Progressive node.js framework for backend.

Buddhika Nelum
2 min readApr 3, 2021

--

Nowadays we use JavaScript not only for front-end applications but also for server-side applications with the help of node.js. There are lots of popular frameworks out there for node.js. Express is the most popular framework so far. but there are other frameworks like Meteor, Koa, Sails, Hapi, Loopback, etc. Nest.js is also a server-side node.js framework built by Kamil Mysliwiec and the community, In the past 2 years nest.js become the fastest-growing node.js technology, and currently, it has 35.9K GitHub stars.

As I mentioned before Node.js (for the server-side) has plenty of great libraries, But none of them solves the main problem of architecture. Nest provides an out-of-the-box application architecture that allows developers and teams to create highly testable, scalable, loosely coupled, and easily maintainable applications. The architecture is heavily inspired by Angular.

What so special about this framework?

01. Nest JS is an open-source framework for building efficient, scalable Node.js server-side applications.

02. Built-in typescript support. (yet still enables developers to code in pure JavaScript).

03. Combines elements of Object-Oriented Programming, Functional Programming, and Reactive Programming.

04. Nest.js provides a similar kind of architecture to other server-side applications like .NET Core, Java Spring Boot, etc.

05. Under the hood, Nest makes use of robust HTTP Server frameworks like Express (the default) and optionally can be configured to use Fastify as well.

Let’s create a “Hello World” app with Nest JS.

01. First of all you need to install Node.js. Click here to download Node.js for your operating system.

02. Then You need Nest-CLI. This helps you to initialize and develop your applications. Open the command line and execute this command.

npm install -g @nestjs/cli

03. Now you can generate a new project using this command. Replace “my-nest-project” with your project name.

nest new my-nest-project

04. Go to the project directory and execute below command to start the application.

npm run start:dev

That's it, Now In your browser, open http://localhost:3000 to see a new application running. The app will automatically recompile and reload when you change any of the source files.

You can easily learn lots of things by referring to Nest JS documentation. The Nest JS documentation is well-maintained and contains a lot of information with real examples. https://docs.nestjs.com/

Happy Coding :)

--

--