# Getting Started With NestJS

## Introduction

Hello everyone, we are starting a series where we will be learning about NestJS as a framework, understanding fundamental concepts and getting down to its depth.

## Node.js → Express.js → NestJS

Lets discover how we arrived at NestJS.

The arrival of NestJS by no means makes Node.js or Express.js obsolete.

Node.js in itself can be used in variety of applications like scripting, automation and stuff, while Express.js is also being utilized substantially in industry, on top of which great applications have been built and are currently in use.

### Node.js

Initially, JavaScript used to execute only in Web Browser.

Node.js came with a **BANG** and allowed JavaScript to be written and executed on the server.

*Note: Node.js is not a library or framework of JavaScript but it's a Runtime Environment.*

However, in Node.js, we had to write a lot of code for a server to make simple CRUD applications.

Thus came: Express.js!

### Express.js

It is an unopinionated, minimalist framework built on top of Node.js

It solved extra over-code which we used to do it in Node.js. However, it's unopinionated, meaning anyone can create and use their own structure however they wish. It doesn’t enforce any strict conventions —developers are free to do whatever they want, in whatever way they prefer. No specific design pattern is enforced. It's essentially a 'do as you like' approach.

Next came: NestJS!

### NestJS

NestJS uses Express.js as underlying technology which is built on top of Node.js.

It provides a proper structure for development, with implied design patterns and a standardized modular approach for using Controllers and Services. You have to follow a global standard to make things work.

*Note: NestJS also allows you to use Fastify as underlying tech if you don't want to use Express.js.*

### Problems tackled in each of these

Each of these frameworks solved their own problems. Node.js allowed JavaScript to be written on server. Express.js removed extra code which we used to write in Node.js and allowed ease in development and NestJS restricted developers to use good coding practices.

### Prerequisite

You should have knowledge of the following before moving forward with our the NestJS series:

* JavaScript
    
* TypeScript
    
* Node.js
    
* Client-Server Architecture
    
* Express.js (at least a basic understanding)
    

### Installing Nest.js

You should have Node.js installed. You can verify it by running the following command in CMD:

```javascript
node -v
```

Open command prompt in *Administrative* mode and run this:

```javascript
npm i -g @nestjs/cli
```

This will install NestJS globally in your system.

### Creating our first NestJS Project

After installing NestJS, you can create scaffold a project with the following:

```javascript
nest new <project-name>
```

For example:

```javascript
nest new shameel-project
```

You will be provided with these three package managers:

* npm
    
* yarn
    
* pnpm
    

I proceeded with `npm`. After waiting for a minute, your first NestJS project will be created.

### What's Next?

Next, we will be exploring and understanding the folder structure and what each file means which have been created by default from executing the above command.

Stay tuned! =)

  
If you’re a visual learner, check out the following video tutorial for this blog:

[https://www.youtube.com/watch?v=l2W2FxK0WjU&t=1s](https://www.youtube.com/watch?v=l2W2FxK0WjU&t=1s)

  
***Follow us for more such content:***

[**https://www.linkedin.com/company/hasabtech**](https://www.linkedin.com/company/hasabtech)

[https://www.youtube.com/@hasabTech](https://www.youtube.com/@hasabTech)

[https://www.instagram.com/hasab.tech/](https://www.instagram.com/hasab.tech/)

[https://www.facebook.com/hasabTech](https://www.facebook.com/hasabTech)
