Nest.js common libraries
This Nest.js module comes with several modules which provide basic functionality such as loading configuration, making http requests and more.
The module contains a sub module for each service, which can either be imported individually, or collectively by importing the CommonModule
.
See the module folder for the available sub modules that you can import.
// app.module.ts
import { Module } from '@nestjs/common';
import { CommonModule } from '@moesjarraf/nestjs-common';
@Module({
imports: [CommonModule],
})
export class AppModule {}
$ npm install @moesjarraf/nestjs-common
The modules by default load their configuration through .env
files which are placed in the root folder. These can be suffixed with the environment.
The available suffixes can be found below, and are loaded in the order as they are displayed.
'.env.development.local',
'.env.development',
'.env.staging',
'.env.production',
'.env.test',
'.env',
The default configuration for each sub module can be found below, and can be changed by modifying the env variables.
APP_NAME=Application
APP_SHORT_NAME=App
APP_DESCRIPTION=
NODE_ENV=development
PORT=3000
DEBUG=true # false if NODE_ENV=producition
FRONTEND_INDEX=../frontend/dist/index.html
CORS_ORIGIN=*
CORS_CREDENTIALS=false
CORS_EXPOSED_HEADERS=
COOKIE_SAME_SITE=
COOKIE_SECURE=
BODY_PARSER_RAW_PATHS=
MONGO_DEFAULT_URL=mongodb://0.0.0.0:27017/nestjs
HTTP_AUTH_BEARER_TOKEN=
LOGGER_LEVEL=
LOGGER_FORCE=
ROLLBAR_ACCESS_TOKEN=
ROLLBAR_ENVIRONMENT=
ROLLBAR_LEVEL=
MAILER_TEST=false
MAILER_HOST=
MAILER_PORT=
MAILER_PASS=
SSL_ENABLED=false
See this repository for an example.
Commit messages should be formatted according to semantic-release standards, see this link for more information. A tool has been added to the project to make adhering to the standards easier.
# add source files
git add .
# format commit message
npm run commit
# push
git push -u origin master