Skip to content

abedzantout/nest-authentication-and-user-management-starter

Nest Logo

Nest Authentication and User Management Starter

CodeQL

by @techhive.IO

Description

Nest Js Authentication and User Management Starter is a starter pack for seamlessly kick-starting your API development with the industry's and TechHive.IO's best practices and recommendations.

Table of Content

Getting Started

git clone --depth 1 https://github.com/techhiveIO/nest-authentication-and-user-management-starter
cd my-project
rm -r .git
cp .env.example .env
npm run dev

Make sure you enter the correct values in your .env file:

MONGODB_CONNECTION_STRING=<your mongodb uri>
MONGODB_CONNECTION_TEST_STRING=<test mongo uri>
NODEMAILER_EMAIL=<your email>
NODEMAILER_PASSWORD=<your email password/auth key>
HOST=<host> # defaults to http://localhost:3000/
PORT=<port> # defaults to 3000
JWT_KEY=<your secret key> # defaults to secretKey

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

Useful Commands

  • start:dev - start application in development mode
  • start:debug - start application in development and debug mode
  • format - runs prettier to format whole code base (.ts and .css)
  • lint - lints project using eslint,
  • start - Run Nest application
  • build - Build application
  • start:prod - Start application in production

Goals

Developers often want a good starting point when implementing a new API. Common tasks such as authentication and user management are re-implemented on a regualar basis. With this starter kit, the developer directly bootstrap the development of their new API, or use it as a inspiration to build any powerful API server using Nest Js.

Features

  • JWT authentication with email verification out of the box
  • Powerful Nest API out of the box
  • Built-in powerful authentication and user management APIs
  • User invitation
  • MongoDB and Mongoose Integration
  • Optimized for speed and scalability
  • Postman file included for easy testing
  • HMR integration
  • Security integration out of the box

Stack

Security

The project implements some of nodejs security techniques :

  • Helmet : can help protect your app from some well-known web vulnerabilities by setting HTTP headers appropriately
  • Express Rate Limit: to protect your applications from brute-force attacks
    • In the main.ts you can set a limit of requests in a time window (default is 100 requests in 15 minutes for all endpoints, and 3 requests in a 1 hour for sign up endpoint)

Learning Materials

Bugs

Please make sure you fill in the appropriate fields when submitting an issue. Our team will try to resolve it as soon as possible.

Contributors

Want to start contributing to open source with the Nest Authentication and User Management Starter ?

Leave your mark and join the growing team of contributors!

Get started by checking out list of open issues and reading Contributor Guide

Abdul Rahman Zantout
Abdul Rahman Zantout

💻 📖 ⚠️ 🎨 📝

License

Nest Js Authentication and User Management Starter Kit is © 2020 TechHive.IO LLC . It is distributed under the Creative Commons Attribution License.

The names and logos for TechHive.IO LLC are trademarks of TechHive.IO LLC.