Nest framework TypeScript starter project & boilerplate (Nest, MongoDB, JWT, Roles, Guards, Filters, Interceptors) including auth and user modules.
This boilerplate includes the following:
APP_PORT= //Port of the app
MONGO_CLOUD_CONNECTION_URL= //MongoDB URL
CORS_LIST= //Whitelist for CORS
JWT_SECRET= //JWT Secret
get your env variables
get(key: string): string
getPortConfig()
getMongoConfig()
Errors will be returned as:
code: status,
timestamp: new Date().toLocaleString(),
path: request.url,
error: {
response: {
message: exception['response'].message,
error: exception['error'],
},
message: exception.message,
},
good for logging and consistent error response for the frontend.
All responses will have the following interface:
export interface Response<T> {
code: number;
message: string;
data: T;
}
Good for consistent responses for the frontend.
[To write]
- Roles decorator
- User decorator
- Roles enum
- JWT and Roles Guard
- JWT Services (Generate, Compare Password, Hash Password)
- Module
- Model
- Interface
- 2 DTOs
- Controller implementing Guards and Roles Decorators
- Service
This module is intented to set the standard of work and get you started with it after reading it well :)
$ npm install
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov