NestJS Boilerplate

使用 Typescript、Postgres、TypeORM 和 Docker 的生产就绪 NestJS 模板。『A production-ready NestJS boilerplate using Typescript, Postgres, TypeORM, and Docker.』

Github星跟蹤圖

NestJS Boilerplate

All Contributors
License: MIT
GitHub issues
Known Vulnerabilities
GitHub stars

📖 Description

Open Source Love
Maintenance
GitHub last commit
GitHub repo size
GitHub code size in bytes
GitHub top language
GitHub language count
GitHub contributors
GitHub commit activity the past week, 4 weeks, year
GitHub commit activity the past week, 4 weeks, year
GitHub commit activity the past week, 4 weeks, year
GitHub package.json version

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

  1. Install the insomnia app
  2. Import the endpoints.json file
  3. Enjoy

Generate SSL certificates

  1. 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
  1. 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.


Made with ♥ by Joseph Göksu

Star History

Star History Chart

主要指標

概覽
名稱與所有者josephgoksu/prime-nestjs
主編程語言TypeScript
編程語言 (語言數: 4)
平台
許可證MIT License
所有者活动
創建於2021-09-25 16:59:13
推送於2025-10-28 10:56:54
最后一次提交
發布數0
用户参与
星數419
關注者數11
派生數69
提交數39
已啟用問題?
問題數10
打開的問題數6
拉請求數12
打開的拉請求數2
關閉的拉請求數10
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?