GitHub - wpcodevo/node_typeorm at jwt_auth_node_typeorm

API with Node.js + PostgreSQL + TypeORM: JWT Authentication

This article will teach you how to implement JSON Web Token (JWT) Authentication with Node.js, PostgreSQL, TypeORM, ExpressJs, Redis, Docker, and Docker-compose. We will implement the assymetric (RS256 algorithm) JSON Web Token authentication manually without using any Node.js authentication library like PassportJs.

API with Node.js + PostgreSQL + TypeORM: JWT Authentication

Topics Covered

  • List the Node.js API Routes
  • User Login and Register Flow with JWT Authentication
  • Defining Base and User Entities with TypeORM
  • Defining Zod Schemas to Validate Request Body
  • Create Middleware to Parse Zod Schema
  • Password Management with Bcrypt
  • Create Services to Interact with the Database
  • Asymmetric Encryption (RS256 algorithm) Json Web Tokens
  • Service to Sign Access and Refresh Tokens
  • Error Handling in Express
  • Create Authentication Route Controllers
  • Create User Route Controller
  • Create Authentication Middleware Guard
  • Create the API Routes
    • Authentication Routes
    • User Routes
  • Add the Routes to the Express Middleware Stack
  • Run Database Migrations with TypeORM
  • Inspect the Data with VS Code MySQL Extension

Read the entire article here: https://codevoweb.com/api-node-postgresql-typeorm-jwt-authentication

Articles in this series:

1. API with Node.js + PostgreSQL + TypeORM: Project Setup

API with Node.js + PostgreSQL + TypeORM: Project Setup

2. API with Node.js + PostgreSQL + TypeORM: JWT Authentication

API with Node.js + PostgreSQL + TypeORM: JWT Authentication

3. API with Node.js + PostgreSQL + TypeORM: Send Emails

API with Node.js + PostgreSQL + TypeORM: Send Emails

4. Node.js, Express, TypeORM, PostgreSQL: CRUD Rest API

Node.js, Express, TypeORM, PostgreSQL: CRUD Rest API

5. Node.js and PostgreSQL: Upload and Resize Multiple Images

Node.js and PostgreSQL: Upload and Resize Multiple Images