/typescript-clean-arch-nestjs

TypeScript Clean Architecture with NestJs

Primary LanguageTypeScript

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Description

Nest framework TypeScript starter repository.

Installation

$ npm install

Running the app

# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Nest is MIT licensed.


Inicializa o projeto criando o package.json

$ npm init -y

instala o typescript em modo dev

$ npm i typescript --save-dev

cria o manifesto (arquivo de configuração) tsconfig.json do typescript

$ npx tsc --init

instala o jest e ts-node para testes

$ npm i jest @types/jest --save-dev

cria o manifesto (arquivo de configuração) jest.config.ts do jest

$ npx jest --init

Instalar o swc, ferramenta da vercel que compila typescript para javascript

$ npm i @swc/jest @swc/core --save-dev

### Alterar o arquivo jest.config.ts
 linha 176:
   transform: {
     "^.+\\.ts?$": ["@swc/jest"],
   },

Instala o Framework Express

$ npm i express --save

Instala a tipagem do Express

$ npm i @types/express --save-dev

NESTJS

Instalar NestJs

$ npm i -g @nestjs/cli

Criar projeto

$ nest new project-name

Executar o projeto

$ npm run start:dev

Gera artefatos nest

$ nest generate [artefact] [name]
$ nest g resource routes
$ npm i sqlite3 typeorm @nestjs/typeorm --save