Skip to content

Fernando-Medeiros/DBOARD-Auth-Nest-API

Repository files navigation

Dashboard-Auth-Backend-RestAPI

Node Nest Jest TypeScript Prisma Docker Postgres Swagger

Dependências

Ferramenta / Pacote Versão Opcional
Docker Desktop ^4
Docker Compose ^2 x
VsCode ^1.8 x
Node ^18
Yarn ou Npm ^1.22 ou ^9.8

Funcionalidades

route get post patch delete
auth [ token, refresh ]
customers [ findOne ] [ register ] [ update ] [ remove ]
passwords [ recover ] [ update, reset ]

Instalação

Copie o template do env para .env

cp env-example .env

Instale as dependências do package.json

yarn install && yarn build

Variáveis de ambiente

PORT=3000
NODE_ENV=dev

DATABASE_URL="postgresql://postgres:docker@localhost:5432/DEVELOPMENT?schema=public"

CORS_ORIGIN=http://localhost:5173
URL_RESET_PASSWORD=http://localhost:5173/password/reset

RATE_LIMITER_MAX_REQUEST=100
RATE_LIMITER_DURATION=10 # Set Minutes

JWT_SECRET=001001001001
JWT_EXPIRATION=3h
JWT_EXPIRATION_RECOVER=5m
ENCRYPT_JWT_SECRET=1001001001001

NODEMAILER_USER=example@email.com
NODEMAILER_PASS=password
NODEMAILER_HOST=smtp.gmail.com
NODEMAILER_PORT=465

Docker

# Para subir o container
docker compose up -d

Prisma

yarn prisma generate # atualizar o prisma.schema
yarn prisma db push # subir o schema para o banco de dados
yarn prisma studio # visualizar os dados

Servidor

yarn start # production  - [node dist/src/main]
yarn start:dev # watch  - [nest start --watch]

http://localhost:3000/

Testes

yarn test # unit tests
yarn test:e2e # e2e tests

Licença

Nest is MIT licensed.

Endpoints

endpoints schemas