After adding DB connection, it won't start

will be reverted to previous version first
Revert "After adding DB connection, it won't start"

This reverts commit 61ddfa4c1754e78908d1ff25a6d90705cf96f15d.
Move connection logic and email feature in lib

Able to use it from the service and also app of course. Must check for
connection pooling