This application was developed to demonstrate my experience, knowledge and skills. In this project, the DDD architecture was used.
Main libraries used:
- Nest.js;
- Express;
- Prisma;
- Nodemail;
Project structure:
.
├── cargo.toml
└── src
├── controllers
│ ├── auth.controller.ts
│ └── recover.controller.ts
├── dtos
│ ├── auth
│ │ ├── login.dto.ts
│ │ └── register.dto.ts
│ └── recover
│ ├── recover.dto.ts
│ └── change-password.dto.ts
├── infrastructure
│ └── exception.middleware.ts
├── repositories
│ └── prisma.repository.ts
├── services
│ ├── user.service.ts
│ ├── auth.service.ts
│ ├── email.service.ts
│ └── recover.service.ts
├── module.ts
└── main.ts
- Download and install NodeJS on your machine: https://nodejs.org/en
- Clone repository.
- Configure the
.env
file.
To run this project, you will need to add the following environment variables to your .env
EMAIL_HOST
- Endereço provider address.
EMAIL_USERNAME
- Username provider address.
EMAIL_PASSWORD
- Password provider address.
JWT_SECRET
- Hash key.
FRONT_END_URL
- Domain front-end (example:"http://localhost")
DATABASE_URL
- Database informations (example:"postgres://username:password@ip:port/database_name")
Running migrate:
npx prisma db push
Start server:
npm run dev
Build project:
npm run build
Start production server:
npm run start
POST /api/v1/auth/login
Parâmetro | Tipo | Descrição |
---|---|---|
email |
string |
User email |
password |
string |
User password |
DELETE /api/v1/auth/logout
Parâmetro | Tipo | Descrição |
---|
POST /api/v1/auth/register
Parâmetro | Tipo | Descrição |
---|---|---|
username |
string |
Username |
email |
string |
User email |
password |
string |
User password |
POST /api/v1/recover
Parâmetro | Tipo | Descrição |
---|---|---|
email |
string |
Target Email |
PATCH /api/v1/recover
Parâmetro | Tipo | Descrição |
---|---|---|
id |
uuid |
Recover code |
password |
string |
New password |