Add database config and model and simplify file structure'