modularizes global middleware and db event emitters