An open API service indexing awesome lists of open source software.

https://github.com/phuonghieuto/nestjs-auth-backend

A NestJS backend for user authentication, including registration, login, and user retrieval, using MongoDB, Swagger for API docs, and CORS for specified frontend URLs.
https://github.com/phuonghieuto/nestjs-auth-backend

authentication cors mongodb nestjs swagger typescript

Last synced: about 2 months ago
JSON representation

A NestJS backend for user authentication, including registration, login, and user retrieval, using MongoDB, Swagger for API docs, and CORS for specified frontend URLs.

Awesome Lists containing this project

README

          


NestJS Logo


nestjs-auth-backend




# Getting started

## Installation

Clone the repository

git clone https://github.com/phuonghieuto/nestjs-auth-backend.git

Switch to the repo folder

cd nestjs-auth-backend

Install dependencies

npm install

Create a `.env` file and write it as follows

MONGODB_URI='your-mongodb-uri'
JWT_SECRET='jwt-secret'
JWT_EXPIRATION='1h'

----------

## Database

The example codebase uses [Mongoose](https://mongoosejs.com/).

----------

## NPM scripts
- `npm run start` - Start application
- `npm run start:dev` - Start application in development mode

----------

# Authentication

This application uses JSON Web Token (JWT) to handle authentication.

----------

# Swagger API docs

Visit http://127.0.0.1:8080/api in your browser

This example repo uses the NestJS swagger module for API documentation. [NestJS Swagger](https://github.com/nestjs/swagger) - [www.swagger.io](https://swagger.io/)

# :link: Demo

- Click Here to checkout how this api works.