Code Monkey home page Code Monkey logo

nestjs-permission-boilerplate's Introduction

Nest Logo

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

License

Nest is MIT licensed

nestjs-permission-boilerplate's People

Contributors

fdubeetech avatar ferdysd96 avatar tmtung144 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.