This project is a small NestJS API for JWT authentication. It uses MongoDB as the database and Swagger for API documentation. This project was created to get familiar with using NestJS for JWT authentication.
- JWT Authentication
- MongoDB for data storage
- Swagger for API documentation
Clone the repository
git clone https://github.com/ayoubbuoya/nestjs-jwt-auth.git
cd nestjs-jwt-auth
Install dependencies
$ pnpm install
Set up environment variables
Create a .env
file in the root directory and add the following environment variables:
MONGODB_URI=<your-mongodb-uri>
JWT_SECRET=<your-jwt-secret>
# development
$ pnpm run start
# watch mode
$ pnpm run start:dev
# production mode
$ pnpm run start:prod
Once the application is running, you can access the API documentation at http://localhost:3000/api
.
Swagger is used to document the API. Below is a demo picture of the Swagger UI of our API :