Introduction to Nest.js — A Progressive node.js framework for backend.
-
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?
-
Nest JS is an open-source framework for building efficient, scalable Node.js server-side applications.
-
Built-in typescript support. (yet still enables developers to code in pure JavaScript).
-
Combines elements of Object-Oriented Programming, Functional Programming, and Reactive Programming.
-
Nest.js provides a similar kind of architecture to other server-side applications like .NET Core, Java Spring Boot, etc.
-
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.
-
First of all you need to install Node.js. Click here to download Node.js for your operating system.
-
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
- Now you can generate a new project using this command. Replace “my-nest-project” with your project name.
nest new my-nest-project
- Go to the project directory and execute the 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/
Read my original post on medium - https://dlbnprabath.medium.com/introduction-to-nest-js-a-progressive-node-js-framework-for-backend-acd76a018681
Happy Coding :)
-
-
how about adonisjs ?
-
@root didn't try it yet. need to give it a try. :)
-
try make a small overview about adonis
-
Thank you ,
-
Good post @BuddhikaNelum ! But be careful about Nest. I have worked with it before. The framework is good. It gives you a good standard to start on. But NestJS blindly follows Angular. They were willing to keep outdated packages in their framework just because Angular forgot to update them on their framework even if there's no connection between the two. Kamil might be a good developer. But he is not that good when it comes to the community. It's mostly him working in the project. He does not approve PRs that much. If something happens to him, the project might go down. This is what I understood when I was working with it earlier. Hope things have improved now. But being that said, I would like to have a framework like this for the back end rather than having nothing.
-
@thpubs Thank u for the valuable information. Currently, I am working on a NestJS project. I am coming from a .Net Core background yet I was easily able to catch up with Nest.JS because of its architecture. As you said it's great to have something like Nest rather than having nothing. That's why I thought of writing an article about Nest. But still, I like to work with .Net Core than any Node.JS framework out there. :)
-
great explanation .
-
@root Thanks :)