bonkx / express-jwt-postgres

Express JS JWT Postgres with Sequelize ORM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

express-jwt-postgres

Express JS JWT Postgres with Sequelize ORM

How to Run

# redis available
$ redis-cli

# clone the repo
$ git clone repo

# go into repo's directory
$ cd repo

# copy and edit env file
$ cp .env.example .env

# migrate database
$ npx sequelize db:migrate

# seeds data to database such as admin user, status, roles
$ npx sequelize db:seed:all

# start app
$ npm run dev

Sequelize CLI:

$ npx sequelize-cli init

Create a new migration:

$ npx sequelize-cli migration:create --name create_users

Running Migrations:

$ npx sequelize-cli db:migrate

Running Seeds:

$ npx sequelize-cli db:seed:all

Todo List

  • Favicon using serve-favicon
  • Morgan Log file
  • Express Architecture Pattern
    • Routes (bridge - logic process)
    • Services (controller)
    • Sequelize ORM (process to DB)
    • Error Handling
    • Validator using express-validator
  • DB
    • Make migration files using sequelize6-auto-migrations
    • DB migrate using sequelize db:migrate
  • Auth
    • Register + Verification Link
    • Send Email with background task and Redis
    • Open Link Verification Email
    • Resend Verification Email Code
    • Login
    • JWT Auth Middleware
    • Refresh Token
    • Forgot Password, send email OTP
    • Forgot Password Verify OTP
    • Reset Password
    • Logout
  • Account
    • Get Profile
    • Update Profile
    • Upload Photo Profile
    • Upload image(compressed)
    • Change Password
    • Deletion Account with OTP
    • Recover deleted account (Admin role)
    • User Activity with interval (last login at, ip address in middleware)
  • Express JS Swagger
  • CRUD
    • Pagination with Sequelize Limits and Pagination
    • Sort + Search function in List Data
    • Create Data
    • Edit Data
    • Delete Data
  • Associations Sequelize Model
  • Virtual field (Custom representation)
  • Open API with API KEY middleware
  • Upload Files
  • Remove Files
  • Upload Videos
  • Create thumbnail from videos with ffmpeg
  • Upload Images and Compress Image with libvips
  • Create thumbnail from image
  • Image Processing with libvips

Credits

https://github.com/dividedbynil/ko-architecture/tree/master
https://dev.to/mihaiandrei97/jwt-authentication-using-prisma-and-express-37nk
https://jwt-keys.21no.de/ https://www.npmjs.com/package/sequelize6-auto-migrations https://supertokens.com/blog/revoking-access-with-a-jwt-blacklist https://rishi58rishi.medium.com/uploading-and-compressing-image-with-multer-and-sharp-i-3070ff2512ad https://dev.to/jobizil/encrypt-and-decrypt-data-in-nodejs-using-aes-256-cbc-2l6d

Sequelize migration generator

https://www.npmjs.com/package/sequelize-mig

Create migration:

$ npx sequelize-mig migration:make -n <migration name>

Preview migration:

$ npx sequelize-mig migration:make --preview

About

Express JS JWT Postgres with Sequelize ORM


Languages

Language:JavaScript 91.4%Language:Handlebars 7.1%Language:Dockerfile 0.7%Language:Makefile 0.5%Language:CSS 0.1%Language:Shell 0.1%