Move db components in lib