Full Stack NestJS + NextJS JWT Authentication Tutorial
GitHub Repos:
- https://github.com/fullstackbook/fullstackbook-nestjs-jwt
- https://github.com/fullstackbook/fullstackbook-jwt-nextjs
Description
How to set up JWT authentication and authorization with NestJS and NextJS.
Terminal
npm i -g @nestjs/cli
nest new fullstackbook-nestjs-jwt
npm install --save @nestjs/passport passport passport-local
npm install --save-dev @types/passport-local
nest g module auth
nest g service auth
nest g module users
nest g service users
createdb fullstackbook-nestjs-jwt
npm i --save @nestjs/config @nestjs/typeorm typeorm pg
npx typeorm migration:create src/migration/create-users-table
npx typeorm migration:create src/migration/create-roles-table
npx typeorm migration:create src/migration/create-users-to-roles-table
npx typeorm migration:create src/migration/insert-roles
npm run typeorm migration:run
npm run typeorm migration:revert
npm i bcrypt
npm i -D @types/bcrypt