To watch for changes in MySQL database tables you can use my forked package zongji which use binary logs to retrive changes.

Simple TypeScript usage

const connectionConfig: mysql.PoolOptions = {
  port: process.env.PORT as unknown as number,
  host: process.env.HOST,
  user: process.env.USER,
  password: process.env.PASSWORD,
  database: process.env.DB_NAME,
  queueLimit: 0,
  enableKeepAlive: true,
  keepAliveInitialDelay: 0,
  connectionLimit: 5,
}
 
const altcoinWatcher = new ZongJi(connectionConfig)
 
const handleChangeInAltcoinsStream() {
  return async (event: ZongJiEvent) => {
    // bussines logic
  }
}
 
altcoinWatcher.on('binlog', handleChangeInAltcoinsStream())