Skip to content

Commit 78f749a

Browse files
committed
Setup Authentication SignIn / SignUp by  JWT
Setup Authentication SignIn / SignUp by  JWT includes: access-token and refreshtoken
1 parent 1dac614 commit 78f749a

31 files changed

+1051
-388
lines changed

server/.env

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1+
# Docker Postgres
12
POSTGRES_USER=zenfection
23
POSTGRES_PASSWORD=123456
34
POSTGRES_DB=task-management
45

5-
# This was inserted by `prisma init`:
6-
# Environment variables declared in this file are automatically made available to Prisma.
7-
# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema
6+
# Docker Redis
7+
REDIS_URL=redis://localhost:6379
88

9-
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
10-
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
9+
# Prisma
10+
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:5432/${POSTGRES_DB}?schema=public
1111

12-
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:5432/${POSTGRES_DB}?schema=public
12+
# JWT TOKEN
13+
JWT_SECRET=secret
14+
JWT_AUDIENCE=localhost:3000
15+
JWT_ISSUER=localhost:3000
16+
JWT_ACESSS_TOKEN_TTL=3600
17+
JWT_REFRESH_TOKEN_TTL=86400

server/package.json

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.0.1",
44
"description": "",
55
"author": "",
6-
"private": true,
6+
"vate": true,
77
"license": "UNLICENSED",
88
"scripts": {
99
"build": "nest build",
@@ -20,47 +20,53 @@
2020
"test:e2e": "jest --config ./test/jest-e2e.json"
2121
},
2222
"dependencies": {
23-
"@nestjs/common": "^10.0.0",
24-
"@nestjs/core": "^10.0.0",
25-
"@nestjs/platform-express": "^10.0.0",
23+
"@nestjs/common": "^10.2.5",
24+
"@nestjs/config": "^3.1.1",
25+
"@nestjs/core": "^10.2.5",
26+
"@nestjs/jwt": "^10.1.1",
27+
"@nestjs/passport": "^10.0.2",
28+
"@nestjs/platform-express": "^10.2.5",
2629
"@nestjs/swagger": "^7.1.11",
2730
"@prisma/client": "^5.3.1",
2831
"bcrypt": "^5.1.1",
2932
"class-transformer": "^0.5.1",
3033
"class-validator": "^0.14.0",
3134
"nestjs-prisma": "^0.22.0",
35+
"passport": "^0.6.0",
36+
"passport-jwt": "^4.0.1",
3237
"reflect-metadata": "^0.1.13",
3338
"rxjs": "^7.8.1"
3439
},
3540
"devDependencies": {
3641
"@compodoc/compodoc": "^1.1.21",
37-
"@nestjs/cli": "^10.0.0",
42+
"@nestjs/cli": "^10.1.17",
3843
"@nestjs/mapped-types": "^2.0.2",
39-
"@nestjs/schematics": "^10.0.0",
40-
"@nestjs/testing": "^10.0.0",
44+
"@nestjs/schematics": "^10.0.2",
45+
"@nestjs/testing": "^10.2.5",
4146
"@swc/cli": "^0.1.62",
4247
"@swc/core": "^1.3.86",
4348
"@swc/jest": "^0.2.29",
4449
"@types/bcrypt": "^5.0.0",
4550
"@types/express": "^4.17.17",
46-
"@types/jest": "^29.5.2",
47-
"@types/node": "^20.6.0",
51+
"@types/jest": "^29.5.5",
52+
"@types/node": "^20.6.3",
53+
"@types/passport-jwt": "^3.0.9",
4854
"@types/supertest": "^2.0.12",
49-
"@typescript-eslint/eslint-plugin": "^6.0.0",
50-
"@typescript-eslint/parser": "^6.0.0",
51-
"eslint": "^8.42.0",
55+
"@typescript-eslint/eslint-plugin": "^6.7.2",
56+
"@typescript-eslint/parser": "^6.7.2",
57+
"eslint": "^8.49.0",
5258
"eslint-config-prettier": "^9.0.0",
5359
"eslint-plugin-prettier": "^5.0.0",
54-
"jest": "^29.6.4",
55-
"prettier": "^3.0.0",
60+
"jest": "^29.7.0",
61+
"prettier": "^3.0.3",
5662
"prisma": "^5.3.1",
5763
"source-map-support": "^0.5.21",
5864
"supertest": "^6.3.3",
59-
"ts-jest": "^29.1.0",
60-
"ts-loader": "^9.4.3",
65+
"ts-jest": "^29.1.1",
66+
"ts-loader": "^9.4.4",
6167
"ts-node": "^10.9.1",
6268
"tsconfig-paths": "^4.2.0",
63-
"typescript": "^5.1.3"
69+
"typescript": "^5.2.2"
6470
},
6571
"jest": {
6672
"moduleFileExtensions": [

0 commit comments

Comments
 (0)