sequelize.js Modify attributes in beforeCreate hook


We might need to modify the attributes before record is created. My use case was encrypting password when user is created.

Hooks doc is here It documents the way to use it with a library / function that returns a Promise. But the use case with a callback is not clearly documented.


  • beforeCreate(instance)
  • beforeCreate(instance, options, fn)