NestJS Boilerplate
π Description
Introducing the NestJS boilerplate - a great way to get started on your next Node.js project! It's built using the latest version of NestJS, which is a powerful and flexible framework for creating efficient and scalable server-side applications. The boilerplate includes TypeScript, PostgreSQL, and JWT authentication right out of the box, so you don't have to worry about setting those up yourself.
Other awesome features include configuration support with Dotenv, RBAC and CBAC for authorization, TypeORM for interacting with databases, Swagger for API documentation, and Docker Compose for container orchestration. Plus, the boilerplate also comes with pre-configured linting tools and secure HTTP headers with Helmet.
Getting started is easy - just clone the repository, install the dependencies, and you're ready to start building your next great idea!
π Features
π± NestJS β latest versionπ TypeScript - Type checkingβοΈ Dotenv - Supports environment variablesπ Authentication - JWT, RSA256π¬ Authorization - RBAC, CBACπͺ TypeORM - Database ORMπͺ PostgreSQL - Open-Source Relational Databaseπ§ Configuration - Single config for allπ Swagger - API Documentationπ³ Docker Compose - Container Orchestrationπ Helmet - secure HTTP headersπ΄ Insomnia - Insomnia config for endpointsπ ESLint β Pluggable JavaScript linterπ Prettier - Opinionated Code Formatterβ¨ Commitlint - Lint your conventional commitsπ΅οΈββοΈ Code Scanning - Code scanning with CodeQL
Quick Setup (Production)
bash ./setup.sh
Installation (Development)
$ 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
Endpoints
- Install the insomnia app
- Import the
endpoints.json
file - Enjoy
Generate SSL certificates
- Generate an RSA private key, of size 2048, and output it to a file named key.pem:
openssl genrsa -out private_key.pem 2048
# It needs be copied&pasted from terminal manually
awk 'NF {sub(/\r/, ""); printf"%s\\n",$0;}' private_key.pem
- Extract the public key from the key pair, which can be used in a certificate:
openssl rsa -in private_key.pem -outform PEM -pubout -out public_key.pem
# It needs be copied&pasted from terminal manually
awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' public_key.pem
π License
This project is licensed under the MIT License - see the LICENSE.md file for more information.
Joey Goksu |
Made with