NestJS Guide

Summary
- NestJS Introduction
- NestJS Concepts
- NestJS Coding
- References
1. NestJS Introduction
Hello, nest!
A progressive Node.js framework for building efficient, reliable and scalable server-side applications.

[GitHub - nestjs/nest: A progressive Node.js framework for building efficient, scalable, and…
A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications on top…github.com](https://github.com/nestjs/nest "https://github.com/nestjs/nest")
Comapre NestJS vs NodeJS


Types of NodeJS Frameworks

NodeJS Frameworks
Some statistics

Advantages of using NestJS
- Nest can be scalable thanks to the flexibility of JavaScript and the robustness of TypeScript
- Detailed and well-maintained documentation
- It has active codebase development and maintenance
- It is open source (MIT license)
- Code generation helps to develop applications faster
- Has a quickly growing community
- Follows strict design principles that do a lot of basic development activities for developers
Disadvantages of using NestJS
- It has Angular concepts, so for developers who don’t know Angular, it may be hard to grasp at first, even if you don’t need to know Angular before working with Nest
- Steep learning curve
- The community is small when compared with Express
Who uses NestJS?
- Adidas
- Autodesk
- Neoteric
- Sanofi
3. NestJS Coding

What is NestJS ?
- NodeJS Framework
- Architecture MVC — Model, View, Controller
- Model — Business Layer
- Controller — Persistent Layer
- View — Process HTML, JSON
Advantages NestJS + TypeScript
- Strongly Typed Language
- Visualization of Development Errors
Advantages NestJS + Angular
- Incorporates Modular Ideas and Angular Dependence Injection
Advantages NestJS
- COC — Convention Over Configuration
- Files
- Folders
- Structures of Development
- TypeScript
- Scalable Architecture
- Easy Database Integration
- Microservices Integration
- Support REST API, GraphQL
NestJS Guide GitHub Repository
[GitHub - Software-Engineering-2030/NestJS-Guide: NestJS Guide Software Engenieering
A progressive Node.js framework for building efficient and scalable server-side applications. Nest framework TypeScript…github.com](https://github.com/Software-Engineering-2030/NestJS-Guide "https://github.com/Software-Engineering-2030/NestJS-Guide")
# sudo npm install -g @nestjs/cli
nest help

nest new nestjs-guide


yarn start



NestJS Architechture Application

- Create an Test Controller
nest g controller test

nest g controller test
- Create an test Service
nest g service test
- Create an Resource
nest g resource






API REST



API Resource Name
NestJS Database Integration

SQL (Sequelize)
This chapter applies only to TypeScript
WARNING*In this article, you’ll learn how to create a `DatabaseModule` based on the Sequelize package from scratch using custom components. As a consequence, this technique contains a lot of overhead that you can avoid by using the dedicated, out-of-the-box `@nestjs/sequelize` package. To learn more, see [here](https://docs.nestjs.com/techniques/database#sequelize-integration).*
Sequelize is a popular Object Relational Mapper (ORM) written in a vanilla JavaScript, but there is a sequelize-typescript TypeScript wrapper which provides a set of decorators and other extras for the base sequelize.
Getting started#
To start the adventure with this library we have to install the following dependencies:
$ npm install --save sequelize sequelize-typescript mysql2
$ npm install --save-dev @types/sequelize

yarn add --save sequelize sequelize-typescript sqlite3
yarn add @nestjs/sequelize
yarn add -D @types/sequelize
`import { Sequelize } from 'sequelize-typescript';
import { Cat } from '../cats/cat.entity';
export const databaseProviders = [
{
provide: 'SEQUELIZE',
useFactory: async () => {
const sequelize = new Sequelize({
dialect: 'mysql',
host: 'localhost',
port: 3306,
username: 'root',
password: 'password',
database: 'nest',
});
sequelize.addModels([Cat]);
await sequelize.sync();
return sequelize;
},
},
];`

[Sequelize
Sequelize is a promise-based Node.js ORM for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server. It features…sequelize.org](https://sequelize.org/ "https://sequelize.org/")




