├── .env.example
├── .gitignore
├── .prettierrc
├── .vscode
└── settings.json
├── CONTRIBUTING.md
├── Dockerfile
├── README.md
├── docker-compose.yml
├── nest-cli.json
├── nodemon-debug.json
├── nodemon.json
├── package.json
├── src
├── app.controller.spec.ts
├── app.controller.ts
├── app.module.ts
├── app.service.ts
├── auth
│ ├── auth.module.ts
│ ├── controller
│ │ └── auth
│ │ │ ├── auth.controller.spec.ts
│ │ │ └── auth.controller.ts
│ ├── dto
│ │ ├── login-credential.dto.ts
│ │ ├── refresh-token.dto.ts
│ │ └── token.dto.ts
│ └── service
│ │ ├── auth.service.spec.ts
│ │ └── auth.service.ts
├── logger.ts
├── main.ts
├── migrations
│ └── 1567653805565-createUsers.ts
├── orm.config.ts
├── shared
│ └── shared.module.ts
├── user
│ ├── controller
│ │ └── user
│ │ │ ├── user.controller.spec.ts
│ │ │ └── user.controller.ts
│ ├── dto
│ │ └── create-user.dto.ts
│ ├── entity
│ │ └── user.entity.ts
│ ├── index.ts
│ ├── repository
│ │ └── user.repository.ts
│ ├── service
│ │ ├── user.service.spec.ts
│ │ └── user.service.ts
│ └── user.module.ts
└── utils
│ ├── decorator
│ ├── auth-user.decorator.spec.ts
│ ├── auth-user.decorator.ts
│ └── roles.decorator.ts
│ ├── guard
│ ├── is-role-user
│ │ └── is-role-user.guard.ts
│ └── is-user
│ │ └── is-user.guard.ts
│ ├── index.ts
│ ├── interceptor
│ ├── logger.interceptor.spec.ts
│ └── logger.interceptor.ts
│ ├── interface
│ └── user.ts
│ ├── middleware
│ ├── jwt-token.middleware.spec.ts
│ └── jwt-token.middleware.ts
│ └── utils.module.ts
├── test
├── app.e2e-spec.ts
└── jest-e2e.json
├── tsconfig.build.json
├── tsconfig.json
├── tslint.json
└── yarn.lock
/.env.example:
--------------------------------------------------------------------------------
1 | NODE_ENV=development
2 |
3 | DB_NAME=nestjs-starter-db
4 | DB_HOST=db
5 | DB_USER=root
6 | DB_PASS=example
7 |
8 | # Number of iteration for password encription
9 | ENCRIPTION_SALT=10
10 | #JWT Secret hash
11 | JWT_SECRET=M6[n0@u0t[O$Q1(
12 | # JWT issuer
13 | JWT_KEY_ISSUER=nest-starter
14 | # Intendent token user
15 | JWT_KEY_AUDIENCE=example.com
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | yarn-error.log
3 | keys/
4 | documentation/
5 | coverage/
6 | .env
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "singleQuote": true,
3 | "trailingComma": "all"
4 | }
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "deno.enable": false
3 | }
4 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to nest jwt auth
2 |
3 | ### Submitting a Pull Request (PR)
4 | Before you submit your Pull Request (PR) consider the following guidelines:
5 |
6 | * Fork this repo in your github account
7 |
8 | * Make your changes in a new git branch:
9 |
10 | ```shell
11 | git checkout -b my-fix-branch develop
12 | ```
13 |
14 | * Follow the [Coding Rules](#rules).
15 | * Run follwoing command to generate documendation. Ensure 100% documendation coverage.
16 | ```shell
17 | yarn run start:api-doc
18 | ```
19 |
20 | * Run the project with `yarn run start:prod` to make sure build is ok with production mode
21 | * Commit your changes using a descriptive commit message that follows our
22 | [commit message conventions](#commit). Adherence to these conventions
23 | is necessary because release notes are automatically generated from these messages.
24 |
25 | ```shell
26 | git commit -a
27 | ```
28 | Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files.
29 |
30 | * Push your branch to GitHub:
31 |
32 | ```shell
33 | git push my-remote my-fix-branch
34 | ```
35 |
36 | * In GitHub, send a pull request to `develop`.
37 | * If we suggest changes then:
38 | * Make the required updates.
39 | * Re-run the build to ensure things are still ok
40 | * Rebase your branch and force push to your GitHub repository
41 | That's it! Thank you for your contribution!
42 |
43 |
44 | ## Coding Rules
45 | To ensure consistency throughout the source code, keep these rules in mind as you are working:
46 |
47 | * All public API methods **must be documented**.
48 | * follow code commending guideline https://compodoc.app/guides/comments.html
49 | * Use https://atom.io/packages/linter-tslint while coding
50 | * We follow [Google's JavaScript Style Guide][js-style-guide]
51 | * Check your code formatting using
52 | ```shell
53 | yarn run lint
54 | ```
55 |
56 | ## Commit Message Guidelines
57 |
58 | We have very precise rules over how our git commit messages can be formatted. This leads to **more
59 | readable messages** that are easy to follow when looking through the **project history**. But also,
60 | we use the git commit messages to **generate the change log**.
61 |
62 | ### Commit Message Format
63 | Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
64 | format that includes a **type**, a **scope** and a **subject**:
65 |
66 | ```
67 | ():
68 |
69 |
70 |
71 |