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.
- Host: GitHub
- URL: https://github.com/phuonghieuto/nestjs-auth-backend
- Owner: phuonghieuto
- License: mit
- Created: 2024-10-26T08:58:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-31T02:07:40.000Z (over 1 year ago)
- Last Synced: 2025-01-22T02:29:44.212Z (over 1 year ago)
- Topics: authentication, cors, mongodb, nestjs, swagger, typescript
- Language: TypeScript
- Homepage: https://nestjs-auth-backend.vercel.app/api
- Size: 412 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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.