Awesome
<p align="center"> <a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a> </p>Nestjs Permission Boilerplate
Description
This is a basic Nest boilerplate project built on the more powerful node.js framework. The main purpose of this project is to dynamically handle roles and permissions assigned to the user
Installation
- make sure you have node.js installed version 11+
- copy
.env.examaple
to.env
and set environments for use
# install nodejs packages
$ npm install
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
Database
Postgres is the database we use in the project, on the other hand you can install the package for your database and start enjoying.
# create database
$ docker-compose up
# generate database structure
$ npm run migrate
# insert roles, permissions and users
$ npm run seed
Swagger
Users
- username:
Admin
- password:Hello123
Features
- NestJS - A progressive Node.js framework for building efficient, reliable and scalable server-side applications
- TypeORM - ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, WebSQL databases
- TypeScript - superset of JS which compiles to JS, providing compile-time type checking
- Swagger ui - allows you to visualize and interact with the API’s resources without having any of the implementation logic in placechecking
- Passport - a popular library used to implement JavaScript authentication (Facebook, Google+)
- jsonwebtoken - a JavaScript json web tokens implementation by auth0
- pg - Non-blocking PostgreSQL client for Node.js. Pure JavaScript and optional native libpq bindings
Project Structure
src
├── common
│ ├── decorators
│ ├── dtos
│ ├── enums
│ └── http
│ ├── exceptions
│ ├── http-error-type.ts
│ ├── http-exception.filter.ts
│ └── response.interceptor.ts
├── config
│ └── swagger.config.ts
├── database
│ ├── entities
│ │ └── base.entity.ts
│ ├── migrations
│ ├── seeds
│ ├── database.module.ts
│ └── database.providers.ts
├── helpers
│ └── hash.helper.ts
├── libs
│ └── pagination
├── modules
│ ├── admin
│ │ ├── access
│ │ │ ├── permissions
│ │ │ ├── roles
│ │ │ ├── users
│ │ │ └── access.module.ts
│ │ └── admin.module.ts
│ └── auth
│ ├── decorators
│ ├── dtos
│ ├── enums
│ ├── guards
│ ├── services
│ ├── auth.controller.ts
│ ├── auth.module.ts
│ └── jwt.strategy.ts
├── app.module.ts
└── main.ts
Stay in touch
- Author - Ferdys Durán
- Linkedin - Ferdys Durán
License
Nest is MIT licensed