Emergn / nestjs-boilerplate

NestJS application with JWT Authentication.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Node.js CI

Nest Logo

Description

Nest boilerplate with JWT authentication which used RS256 encrypt.

Structure of project

.
│   .env            # Environment variables. Ignored file. Make it from .env.template
│   .env.template   # Template file for .env
│   private.pem     # Required file
│   private.pem.pub # Optional
│   public.pem      # Required file
│
├───coverage            # Folder with test coverage results
├───dist                # Compiled application
└───src                 # Source folder
    │   app.module.ts
    │   constants.ts
    │   main.ts
    │   
    ├───components      # Base folder with application components
    │   │   components.module.ts
    │   │   
    │   ├───auth        # Authentication module
    │   │   ├───guards  # Authentication guard
    │   │   │       jwt-auth.guard.ts       # JWT guard will check Authorization header
    │   │   │       local-auth.guard.ts     # Local guard will check payload for the first step of authentication which returns JWT token
    │   │   │       
    │   │   ├───strategies                  # Rules, how guard will validate requests
    │   │   │       jwt.strategy.ts
    │   │   │       local.strategy.ts
    │   │
    │   ├───dashboard                       # Just secured route for checking that authentication works
    │   └───users       # Component which should work with some entity. For example you could add here your DA services for getting users from DB
    │               
    ├───decorators      # Useful decorators
    ├───typings
    └───utils

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

License

Nest is MIT licensed.

About

NestJS application with JWT Authentication.

License:MIT License


Languages

Language:TypeScript 95.8%Language:JavaScript 4.2%